summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorLiping Zhang <liping.zhang@spreadtrum.com>2016-06-08 20:47:03 +0800
committerPablo Neira Ayuso <pablo@netfilter.org>2016-06-08 16:55:41 +0200
commit4bdf0ae602c4f53b05b8fe903981a92f8f2a65b0 (patch)
tree66e1522eb95fef5ea7e9da6d6fa4e0a675af74cc /extensions
parentcd11b62b477dc4563892d167ca58abfc637cdb1f (diff)
extensions: libxt_TRACE: Add translation to nft
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> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/libxt_TRACE.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/extensions/libxt_TRACE.c b/extensions/libxt_TRACE.c
index 0282e6ff..7cb3585b 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)