summaryrefslogtreecommitdiffstats
path: root/tests/py/inet/tcp.t.payload
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-08-24 13:26:57 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-10-04 02:11:17 +0200
commit14a9968a56f8b35138bab172aa7ce796f5d98e03 (patch)
treea901e04ad134ee30ec1fa9b9606e05e7c083898d /tests/py/inet/tcp.t.payload
parenta493147e60d350aca4197975281bf2ffe4cd1009 (diff)
parser_bison: Fix for ECN keyword in LHS of relational
Of all possible TCP flags, 'ecn' is special since it is recognized by lex as a keyword (there is a a field in IPv4 and IPv6 headers with the same name). Therefore it is listed in keyword_expr, but that was sufficient for RHS only. The following statement reproduces the issue: | tcp flags & (syn | ecn) == (syn | ecn) The solution is to limit binop expressions to accept an RHS expression on RHS ("real" LHS expressions don't make much sense there anyway), which then allows keyword_expr to occur there. In order to maintain the recursive behaviour if braces are present, allow primary_rhs_expr to consist of a basic_rhs_expr enclosed in braces. This in turn requires for braced RHS part in relational_expr to be dropped, otherwise bison complains about shift/reduce conflict. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/py/inet/tcp.t.payload')
-rw-r--r--tests/py/inet/tcp.t.payload8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/py/inet/tcp.t.payload b/tests/py/inet/tcp.t.payload
index 09538aed..2390a24e 100644
--- a/tests/py/inet/tcp.t.payload
+++ b/tests/py/inet/tcp.t.payload
@@ -436,6 +436,14 @@ inet test-inet input
[ bitwise reg 1 = (reg=1 & 0x00000003 ) ^ 0x00000000 ]
[ cmp eq reg 1 0x00000003 ]
+# tcp flags & (fin | syn | rst | psh | ack | urg | ecn | cwr) == fin | syn | rst | psh | ack | urg | ecn | cwr
+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 & 0x000000ff ) ^ 0x00000000 ]
+ [ cmp eq reg 1 0x000000ff ]
+
# tcp window 22222
inet test-inet input
[ meta load l4proto => reg 1 ]