]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: libip[6]t_SNAT/DNAT: use the new nft syntax when do xlate
authorLiping Zhang <liping.zhang@spreadtrum.com>
Sun, 28 Aug 2016 08:50:47 +0000 (16:50 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 30 Aug 2016 09:55:52 +0000 (11:55 +0200)
After commit "src: add 'to' for snat and dnat" in nftables tree,
we should recommend the end user to use the new syntax.

Before this patch:
  # iptables-translate -t nat -A POSTROUTING -j SNAT --to-source 1.1.1.1
  nft add rule ip nat POSTROUTING counter snat 1.1.1.1
  # ip6tables-translate -t nat -A PREROUTING -j DNAT --to-destination
  2001::1
  nft add rule ip6 nat PREROUTING counter dnat 2001::1

Apply this patch:
  # iptables-translate -t nat -A POSTROUTING -j SNAT --to-source 1.1.1.1
  nft add rule ip nat POSTROUTING counter snat to 1.1.1.1
  # ip6tables-translate -t nat -A PREROUTING -j DNAT --to-destination
  2001::1
  nft add rule ip6 nat PREROUTING counter dnat to 2001::1

Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
extensions/libip6t_DNAT.c
extensions/libip6t_SNAT.c
extensions/libipt_DNAT.c
extensions/libipt_SNAT.c

index 3925c3bbb31dedf1b7c500c858507af4d6445a1c..97a8b1cb1deb93a66e5c4c9d82ee188c6ede6f3f 100644 (file)
@@ -259,7 +259,7 @@ static int DNAT_xlate(struct xt_xlate *xl,
        bool sep_need = false;
        const char *sep = " ";
 
-       xt_xlate_add(xl, "dnat ");
+       xt_xlate_add(xl, "dnat to ");
        print_range_xlate(range, xl);
        if (range->flags & NF_NAT_RANGE_PROTO_RANDOM) {
                xt_xlate_add(xl, " random");
index 4d742ea8a35034a7f811d525a9373df1efb5c954..c3d8190d41a9a0f2a062db6c5ed576ef42924a90 100644 (file)
@@ -269,7 +269,7 @@ static int SNAT_xlate(struct xt_xlate *xl,
        bool sep_need = false;
        const char *sep = " ";
 
-       xt_xlate_add(xl, "snat ");
+       xt_xlate_add(xl, "snat to ");
        print_range_xlate(range, xl);
        if (range->flags & NF_NAT_RANGE_PROTO_RANDOM) {
                xt_xlate_add(xl, " random");
index 78907198f9fac02a37b9d61fff89a3c9bec443be..a14d16f773ab7bdf2318695ca1a54da3826e4111 100644 (file)
@@ -271,7 +271,7 @@ static int DNAT_xlate(struct xt_xlate *xl,
        const char *sep = " ";
 
        for (i = 0; i < info->mr.rangesize; i++) {
-               xt_xlate_add(xl, "dnat ");
+               xt_xlate_add(xl, "dnat to ");
                print_range_xlate(&info->mr.range[i], xl);
                if (info->mr.range[i].flags & NF_NAT_RANGE_PROTO_RANDOM) {
                        xt_xlate_add(xl, " random");
index 5c699d322d8a3988384edfd1dd975cbe69a71946..e92d811c2bc93326907b6bf01e993a06969cd492 100644 (file)
@@ -282,7 +282,7 @@ static int SNAT_xlate(struct xt_xlate *xl,
        const char *sep = " ";
 
        for (i = 0; i < info->mr.rangesize; i++) {
-               xt_xlate_add(xl, "snat ");
+               xt_xlate_add(xl, "snat to ");
                print_range_xlate(&info->mr.range[i], xl);
                if (info->mr.range[i].flags & NF_NAT_RANGE_PROTO_RANDOM) {
                        xt_xlate_add(xl, " random");