]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: py: Test TCP flags match with parentheses
authorPhil Sutter <phil@nwl.cc>
Wed, 30 Nov 2016 21:07:14 +0000 (22:07 +0100)
committerFlorian Westphal <fw@strlen.de>
Wed, 30 Nov 2016 21:19:48 +0000 (22:19 +0100)
This should test the fix in commit 7222680eb328b ("parser_bison: Allow
parens on RHS of relational_expr").

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/inet/tcp.t
tests/py/inet/tcp.t.payload.inet
tests/py/inet/tcp.t.payload.ip
tests/py/inet/tcp.t.payload.ip6
tests/py/inet/tcp.t.payload.netdev

index d959284b70adaa5cc9f6fda615f96a00494f3864..5a0aab6755b52940f8b9bfcbf76f94e78ffc988e 100644 (file)
@@ -74,6 +74,7 @@ tcp flags { fin, syn, rst, psh, ack, urg, ecn, cwr} drop;ok
 tcp flags != { fin, urg, ecn, cwr} drop;ok
 tcp flags cwr;ok
 tcp flags != cwr;ok
+tcp 'flags & (syn|fin) == (syn|fin)';ok;tcp flags & (fin | syn) == fin | syn
 
 tcp window 22222;ok
 tcp window 22;ok
index 583fcd431eec481bbc673c19646752712fe629f4..bf2ffaaff3bc98982a12cd6cb21298e5cba7a77f 100644 (file)
@@ -421,6 +421,14 @@ inet test-inet input
   [ payload load 1b @ transport header + 13 => reg 1 ]
   [ cmp neq reg 1 0x00000080 ]
 
+# tcp 'flags & (syn|fin) == (syn|fin)'
+inet test-inet input
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ payload load 1b @ transport header + 13 => reg 1 ]
+  [ bitwise reg 1 = (reg=1 & 0x00000003 ) ^ 0x00000000 ]
+  [ cmp eq reg 1 0x00000003 ]
+
 # tcp window 22222
 inet test-inet input
   [ meta load l4proto => reg 1 ]
index 065a2b117a1535f5a733fcddc8c7261ebbf6631d..79fd500aef37d1a19d0fc69bb04d1b40fb598ba4 100644 (file)
@@ -421,6 +421,14 @@ ip test-ip4 input
   [ payload load 1b @ transport header + 13 => reg 1 ]
   [ cmp neq reg 1 0x00000080 ]
 
+# tcp 'flags & (syn|fin) == (syn|fin)'
+ip test-ip4 input
+  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ payload load 1b @ transport header + 13 => reg 1 ]
+  [ bitwise reg 1 = (reg=1 & 0x00000003 ) ^ 0x00000000 ]
+  [ cmp eq reg 1 0x00000003 ]
+
 # tcp window 22222
 ip test-ip4 input
   [ payload load 1b @ network header + 9 => reg 1 ]
index a4ddc164723b73f7d945f7d0a2842b30c291e1b8..b1b361ec77f507bd4d0cfa78842b5105d598c6e4 100644 (file)
@@ -421,6 +421,14 @@ ip6 test-ip6 input
   [ payload load 1b @ transport header + 13 => reg 1 ]
   [ cmp neq reg 1 0x00000080 ]
 
+# tcp 'flags & (syn|fin) == (syn|fin)'
+ip6 test-ip6 input
+  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ payload load 1b @ transport header + 13 => reg 1 ]
+  [ bitwise reg 1 = (reg=1 & 0x00000003 ) ^ 0x00000000 ]
+  [ cmp eq reg 1 0x00000003 ]
+
 # tcp window 22222
 ip6 test-ip6 input
   [ payload load 1b @ network header + 6 => reg 1 ]
index dd79898e97a8194b7baea11df3705879c30f054e..dbf4b131ea45202b890d6ca78fa91c8d38e6a700 100644 (file)
@@ -421,6 +421,14 @@ inet test-inet input
   [ payload load 1b @ transport header + 13 => reg 1 ]
   [ cmp neq reg 1 0x00000080 ]
 
+# tcp 'flags & (syn|fin) == (syn|fin)'
+inet test-inet input
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ payload load 1b @ transport header + 13 => reg 1 ]
+  [ bitwise reg 1 = (reg=1 & 0x00000003 ) ^ 0x00000000 ]
+  [ cmp eq reg 1 0x00000003 ]
+
 # tcp window 22222
 inet test-inet input
   [ meta load l4proto => reg 1 ]