]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: libxt_TRACE: Add translation to nft
authorLiping Zhang <liping.zhang@spreadtrum.com>
Wed, 8 Jun 2016 12:47:03 +0000 (20:47 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 8 Jun 2016 14:55:41 +0000 (16:55 +0200)
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>
extensions/libxt_TRACE.c

index 0282e6ff4189f3efad5c91fa5712d37dc725fb9c..7cb3585b37c14df68280408bfc2a4058986e670e 100644 (file)
@@ -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)