]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: regression: fix NAT tests
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 2 Jun 2015 15:14:59 +0000 (17:14 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 2 Jun 2015 16:08:42 +0000 (18:08 +0200)
snat can be only used from prerouting and input, and dnat from output and
postrouting.

 ip/nat.t: ERROR: line 12: nft add rule ip test-ip4 output iifname eth0 tcp sport 23-34 snat 192.168.3.2: This rule should not have failed.

Split the test file as they require different chain configuration.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/regression/ip/dnat.t [moved from tests/regression/ip/nat.t with 74% similarity]
tests/regression/ip/snat.t [new file with mode: 0644]
tests/regression/ip6/dnat.t [moved from tests/regression/ip6/nat.t with 72% similarity]
tests/regression/ip6/snat.t [new file with mode: 0644]

similarity index 74%
rename from tests/regression/ip/nat.t
rename to tests/regression/ip/dnat.t
index 26c8cbf7fefaf4b742ad515d7f135965999e4056..78fc454da60717aa2f8eb5f07764ddc2cf60701b 100644 (file)
@@ -1,16 +1,10 @@
 *ip;test-ip4
-# bug: Nat tables is not supported yet in inet table.
--*inet;test-inet
-
-:output;type nat hook output priority 0
+:prerouting;type nat hook prerouting priority 0
 
 iifname "eth0" tcp dport 80-90 dnat 192.168.3.2;ok
 iifname "eth0" tcp dport != 80-90 dnat 192.168.3.2;ok
 iifname "eth0" tcp dport {80, 90, 23} dnat 192.168.3.2;ok
 - iifname "eth0" tcp dport != {80, 90, 23} dnat 192.168.3.2;ok
-
-iifname eth0 tcp sport 23-34 snat 192.168.3.2;ok
-
 - iifname "eth0" tcp dport != {80, 90, 23} dnat 192.168.3.2;ok
 # BUG: invalid expression type set
 # nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed.
diff --git a/tests/regression/ip/snat.t b/tests/regression/ip/snat.t
new file mode 100644 (file)
index 0000000..1caf7c7
--- /dev/null
@@ -0,0 +1,12 @@
+*ip;test-ip4
+:postrouting;type nat hook postrouting priority 0
+
+iifname "eth0" tcp dport 80-90 snat 192.168.3.2;ok
+iifname "eth0" tcp dport != 80-90 snat 192.168.3.2;ok
+iifname "eth0" tcp dport {80, 90, 23} snat 192.168.3.2;ok
+- iifname "eth0" tcp dport != {80, 90, 23} snat 192.168.3.2;ok
+- iifname "eth0" tcp dport != {80, 90, 23} snat 192.168.3.2;ok
+# BUG: invalid expression type set
+# nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed.
+
+iifname "eth0" tcp dport != 23-34 snat 192.168.3.2;ok
similarity index 72%
rename from tests/regression/ip6/nat.t
rename to tests/regression/ip6/dnat.t
index 2fb4ac81938bda4fb73c35a04429d569db43a2ea..a2555c72de9f8b8d34b805940af0ed4ba49975eb 100644 (file)
@@ -1,6 +1,5 @@
 *ip6;test-ip6
-- *inet;test-inet
-:input;type nat hook input priority 0
+:prerouting;type nat hook prerouting priority 0
 
 tcp dport 80-90 dnat 2001:838:35f:1::-2001:838:35f:2:: :80-100;ok
 tcp dport 80-90 dnat 2001:838:35f:1::-2001:838:35f:2:: :100;ok
diff --git a/tests/regression/ip6/snat.t b/tests/regression/ip6/snat.t
new file mode 100644 (file)
index 0000000..7345275
--- /dev/null
@@ -0,0 +1,6 @@
+*ip6;test-ip6
+- *inet;test-inet
+:postrouting;type nat hook postrouting priority 0
+
+tcp dport 80-90 snat 2001:838:35f:1::-2001:838:35f:2:: :80-100;ok
+tcp dport 80-90 snat 2001:838:35f:1::-2001:838:35f:2:: :100;ok