From 53a0bd44d336f54f26f3364eb075e91d91e4782e Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 30 Nov 2016 22:07:14 +0100 Subject: 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"). Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- 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(+) (limited to 'tests') diff --git a/tests/py/inet/tcp.t b/tests/py/inet/tcp.t index d959284b..5a0aab67 100644 --- a/tests/py/inet/tcp.t +++ b/tests/py/inet/tcp.t @@ -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 diff --git a/tests/py/inet/tcp.t.payload.inet b/tests/py/inet/tcp.t.payload.inet index 583fcd43..bf2ffaaf 100644 --- a/tests/py/inet/tcp.t.payload.inet +++ b/tests/py/inet/tcp.t.payload.inet @@ -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 ] diff --git a/tests/py/inet/tcp.t.payload.ip b/tests/py/inet/tcp.t.payload.ip index 065a2b11..79fd500a 100644 --- a/tests/py/inet/tcp.t.payload.ip +++ b/tests/py/inet/tcp.t.payload.ip @@ -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 ] diff --git a/tests/py/inet/tcp.t.payload.ip6 b/tests/py/inet/tcp.t.payload.ip6 index a4ddc164..b1b361ec 100644 --- a/tests/py/inet/tcp.t.payload.ip6 +++ b/tests/py/inet/tcp.t.payload.ip6 @@ -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 ] diff --git a/tests/py/inet/tcp.t.payload.netdev b/tests/py/inet/tcp.t.payload.netdev index dd79898e..dbf4b131 100644 --- a/tests/py/inet/tcp.t.payload.netdev +++ b/tests/py/inet/tcp.t.payload.netdev @@ -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 ] -- cgit v1.2.3