[PATCH iptables 3/6] ebtables: relax -t table restriction, add snat/dnat test cases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 extensions/libebt_dnat.t | 5 +++++
 extensions/libebt_snat.t | 4 ++++
 iptables/xtables-eb.c    | 3 ---
 3 files changed, 9 insertions(+), 3 deletions(-)
 create mode 100644 extensions/libebt_dnat.t
 create mode 100644 extensions/libebt_snat.t

diff --git a/extensions/libebt_dnat.t b/extensions/libebt_dnat.t
new file mode 100644
index 000000000000..42f9bff27b8d
--- /dev/null
+++ b/extensions/libebt_dnat.t
@@ -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
index 000000000000..bb42e758631f
--- /dev/null
+++ b/extensions/libebt_snat.t
@@ -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
diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index 721bab578ae8..c36c12e68222 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -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,
-- 
2.18.1




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux