diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-07-27 22:21:48 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2021-07-27 22:39:43 +0200 |
commit | 2acc8776e8b436566fc7d73161ef08e6b77b0c45 (patch) | |
tree | 972b873d4163b372e98befbd4252921f39257466 | |
parent | 08c596ce6f4f912e823d65edca761c27df7cb511 (diff) |
tests: py: idempotent tcp flags & syn != 0 to tcp flag syn
Add a test to cover this case.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | tests/py/inet/tcp.t | 1 | ||||
-rw-r--r-- | tests/py/inet/tcp.t.json | 16 | ||||
-rw-r--r-- | tests/py/inet/tcp.t.payload | 8 |
3 files changed, 25 insertions, 0 deletions
diff --git a/tests/py/inet/tcp.t b/tests/py/inet/tcp.t index 13b84215..5e2830b6 100644 --- a/tests/py/inet/tcp.t +++ b/tests/py/inet/tcp.t @@ -69,6 +69,7 @@ tcp flags != cwr;ok tcp flags == syn;ok tcp flags fin,syn / fin,syn;ok tcp flags != syn / fin,syn;ok +tcp flags & syn != 0;ok;tcp flags syn tcp flags & (fin | syn | rst | ack) syn;ok;tcp flags syn / fin,syn,rst,ack tcp flags & (fin | syn | rst | ack) != syn;ok;tcp flags != syn / fin,syn,rst,ack tcp flags & (fin | syn | rst | psh | ack | urg | ecn | cwr) == fin | syn | rst | psh | ack | urg | ecn | cwr;ok;tcp flags == 0xff diff --git a/tests/py/inet/tcp.t.json b/tests/py/inet/tcp.t.json index 033a4f22..6155c81f 100644 --- a/tests/py/inet/tcp.t.json +++ b/tests/py/inet/tcp.t.json @@ -1521,6 +1521,22 @@ } ] +# tcp flags & syn != 0 +[ + { + "match": { + "left": { + "payload": { + "field": "flags", + "protocol": "tcp" + } + }, + "op": "in", + "right": "syn" + } + } +] + # tcp flags & (fin | syn | rst | ack) syn [ { diff --git a/tests/py/inet/tcp.t.payload b/tests/py/inet/tcp.t.payload index eaa7cd09..6b8b4ecd 100644 --- a/tests/py/inet/tcp.t.payload +++ b/tests/py/inet/tcp.t.payload @@ -370,6 +370,14 @@ inet test-inet input [ bitwise reg 1 = ( reg 1 & 0x00000003 ) ^ 0x00000000 ] [ cmp neq reg 1 0x00000002 ] +# tcp flags & syn != 0 +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 & 0x00000002 ) ^ 0x00000000 ] + [ cmp neq reg 1 0x00000000 ] + # tcp flags & (fin | syn | rst | ack) syn inet test-inet input [ meta load l4proto => reg 1 ] |