]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: don't kill dependencies accross statements
authorFlorian Westphal <fw@strlen.de>
Wed, 22 Mar 2017 23:50:45 +0000 (00:50 +0100)
committerFlorian Westphal <fw@strlen.de>
Mon, 8 May 2017 20:01:26 +0000 (22:01 +0200)
add a test case for previous commit.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/ip/ip_tcp.t [new file with mode: 0644]
tests/py/ip/ip_tcp.t.payload [new file with mode: 0644]

diff --git a/tests/py/ip/ip_tcp.t b/tests/py/ip/ip_tcp.t
new file mode 100644 (file)
index 0000000..a97833f
--- /dev/null
@@ -0,0 +1,10 @@
+:input;type filter hook input priority 0
+:ingress;type filter hook ingress device lo priority 0
+
+*ip;test-inet;input
+
+# can remove ip dependency -- its redundant in ip family
+ip protocol tcp tcp dport 22;ok;tcp dport 22
+
+# but not here
+ip protocol tcp meta mark set 1 tcp dport 22;ok;ip protocol 6 mark set 0x00000001 tcp dport 22
diff --git a/tests/py/ip/ip_tcp.t.payload b/tests/py/ip/ip_tcp.t.payload
new file mode 100644 (file)
index 0000000..4f3d962
--- /dev/null
@@ -0,0 +1,16 @@
+# ip protocol tcp tcp dport 22
+ip test-inet input
+  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ payload load 2b @ transport header + 2 => reg 1 ]
+  [ cmp eq reg 1 0x00001600 ]
+
+# ip protocol tcp meta mark set 1 tcp dport 22
+ip test-inet input
+  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ immediate reg 1 0x00000001 ]
+  [ meta set mark with reg 1 ]
+  [ payload load 2b @ transport header + 2 => reg 1 ]
+  [ cmp eq reg 1 0x00001600 ]
+