]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
ebtables: relax -t table restriction, add snat/dnat test cases
authorFlorian Westphal <fw@strlen.de>
Fri, 2 Nov 2018 15:24:24 +0000 (16:24 +0100)
committerFlorian Westphal <fw@strlen.de>
Sat, 3 Nov 2018 19:35:22 +0000 (20:35 +0100)
Its artificial and prevents test cases that need to add rules
to a different table from working.

The test script generates:
-A PREROUTING -t nat

... which works fine for iptables and ip6tables.
Just accept it for ebtables too and add test cases
for snat and dnat.

Signed-off-by: Florian Westphal <fw@strlen.de>
extensions/libebt_dnat.t [new file with mode: 0644]
extensions/libebt_snat.t [new file with mode: 0644]
iptables/xtables-eb.c

diff --git a/extensions/libebt_dnat.t b/extensions/libebt_dnat.t
new file mode 100644 (file)
index 0000000..42f9bff
--- /dev/null
@@ -0,0 +1,5 @@
+:PREROUTING
+*nat
+-i someport -j dnat --to-dst de:ad:0:be:ee:ff;-i someport -j dnat --to-dst de:ad:0:be:ee:ff --dnat-target ACCEPT;OK
+-j dnat --to-dst de:ad:0:be:ee:ff --dnat-target ACCEPT;=;OK
+-j dnat --to-dst de:ad:0:be:ee:ff --dnat-target CONTINUE;=;OK
diff --git a/extensions/libebt_snat.t b/extensions/libebt_snat.t
new file mode 100644 (file)
index 0000000..bb42e75
--- /dev/null
@@ -0,0 +1,4 @@
+:POSTROUTING
+*nat
+-o someport -j snat --to-source a:b:c:d:e:f;-o someport -j snat --to-src a:b:c:d:e:f --snat-target ACCEPT;OK
+-o someport+ -j snat --to-src de:ad:0:be:ee:ff --snat-target CONTINUE;=;OK
index 721bab578ae88e561a1aa4277b333de1c9f38704..c36c12e682227b804c05264e3a48fa8c7a91e6c1 100644 (file)
@@ -1000,9 +1000,6 @@ print_zero:
                        }
                        break;
                case 't': /* Table */
-                       if (OPT_COMMANDS)
-                               xtables_error(PARAMETER_PROBLEM,
-                                             "Please put the -t option first");
                        ebt_check_option2(&flags, OPT_TABLE);
                        if (strlen(optarg) > EBT_TABLE_MAXNAMELEN - 1)
                                xtables_error(PARAMETER_PROBLEM,