* [PATCH iptables] extensions: libxt_TRACE: Add translation to nft
@ 2016-06-08 12:47 Liping Zhang
2016-06-08 14:56 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Liping Zhang @ 2016-06-08 12:47 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, Liping Zhang
From: Liping Zhang <liping.zhang@spreadtrum.com>
For example:
# iptables-translate -t raw -A PREROUTING -j TRACE
nft add rule ip raw PREROUTING counter nftrace set 1
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
---
extensions/libxt_TRACE.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/extensions/libxt_TRACE.c b/extensions/libxt_TRACE.c
index 0282e6f..7cb3585 100644
--- a/extensions/libxt_TRACE.c
+++ b/extensions/libxt_TRACE.c
@@ -7,12 +7,20 @@
#include <xtables.h>
#include <linux/netfilter/x_tables.h>
+static int trace_xlate(const void *ip, const struct xt_entry_target *target,
+ struct xt_xlate *xl, int numeric)
+{
+ xt_xlate_add(xl, "nftrace set 1");
+ return 1;
+}
+
static struct xtables_target trace_target = {
.family = NFPROTO_UNSPEC,
.name = "TRACE",
.version = XTABLES_VERSION,
.size = XT_ALIGN(0),
.userspacesize = XT_ALIGN(0),
+ .xlate = trace_xlate,
};
void _init(void)
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-08 14:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-08 12:47 [PATCH iptables] extensions: libxt_TRACE: Add translation to nft Liping Zhang
2016-06-08 14:56 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).