Skip to contentSkip to conversation

tests: py: Test TCP flags match with parentheses

PATCH Applied Phil Sutter 2 participants 2 messages Nov 30, 2016 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests: py: Test TCP flags match with parentheses

This should test the fix in commit 7222680eb328b ("parser_bison: Allow parens on RHS of relational_expr").

---
 tests/py/inet/tcp.t                | 1 +
 tests/py/inet/tcp.t.payload.inet   | 8 ++++++++
 tests/py/inet/tcp.t.payload.ip     | 8 ++++++++
 tests/py/inet/tcp.t.payload.ip6    | 8 ++++++++
 tests/py/inet/tcp.t.payload.netdev | 8 ++++++++
 5 files changed, 33 insertions(+)
tests/py/inet/tcp.t +1 -0
index 9618e5323acaf..f8600d19d1662 100644
@@ -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
tests/py/inet/tcp.t.payload.inet +8 -0
index 354d013da8848..0b65e792cc0f8 100644
@@ -320,6 +320,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 ]
tests/py/inet/tcp.t.payload.ip +8 -0
index d70a176a3160c..ae014542c3eb6 100644
@@ -320,6 +320,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 ]
tests/py/inet/tcp.t.payload.ip6 +8 -0
index 4e9c4135e4e66..db3de3929a483 100644
@@ -320,6 +320,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 ]
tests/py/inet/tcp.t.payload.netdev +8 -0
index 854f4bbe1f795..c639865bb28f6 100644
@@ -320,6 +320,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 ]
Signature · 1 line
2.10.0
maintainer Applied
#1 lore raw
Quoted 2 lines · Phil Sutter

This should test the fix in commit 7222680eb328b ("parser_bison: Allow parens on RHS of relational_expr").

applied.