;
shift_expr : primary_expr
- | shift_expr LSHIFT primary_expr
+ | shift_expr LSHIFT primary_rhs_expr
{
$$ = binop_expr_alloc(&@$, OP_LSHIFT, $1, $3);
}
- | shift_expr RSHIFT primary_expr
+ | shift_expr RSHIFT primary_rhs_expr
{
$$ = binop_expr_alloc(&@$, OP_RSHIFT, $1, $3);
}
;
and_expr : shift_expr
- | and_expr AMPERSAND shift_expr
+ | and_expr AMPERSAND shift_rhs_expr
{
$$ = binop_expr_alloc(&@$, OP_AND, $1, $3);
}
;
exclusive_or_expr : and_expr
- | exclusive_or_expr CARET and_expr
+ | exclusive_or_expr CARET and_rhs_expr
{
$$ = binop_expr_alloc(&@$, OP_XOR, $1, $3);
}
;
inclusive_or_expr : exclusive_or_expr
- | inclusive_or_expr '|' exclusive_or_expr
+ | inclusive_or_expr '|' exclusive_or_rhs_expr
{
$$ = binop_expr_alloc(&@$, OP_OR, $1, $3);
}
{
$$ = relational_expr_alloc(&@2, $2, $1, $3);
}
- | expr relational_op '(' rhs_expr ')'
- {
- $$ = relational_expr_alloc(&@2, $2, $1, $4);
- }
;
list_rhs_expr : basic_rhs_expr COMMA basic_rhs_expr
BYTEORDER_HOST_ENDIAN,
sizeof(data) * BITS_PER_BYTE, &data);
}
+ | '(' basic_rhs_expr ')' { $$ = $2; }
;
relational_op : EQ { $$ = OP_EQ; }
}
]
+# tcp flags & (fin | syn | rst | psh | ack | urg | ecn | cwr) == fin | syn | rst | psh | ack | urg | ecn | cwr
+[
+ {
+ "match": {
+ "left": {
+ "&": [
+ {
+ "payload": {
+ "field": "flags",
+ "protocol": "tcp"
+ }
+ },
+ {
+ "|": [ "fin", { "|": [ "syn", { "|": [ "rst", { "|": [ "psh", { "|": [ "ack", { "|": [ "urg", { "|": [ "ecn", "cwr" ] } ] } ] } ] } ] } ] } ]
+ }
+ ]
+ },
+ "op": "==",
+ "right": { "|": [ "fin", { "|": [ "syn", { "|": [ "rst", { "|": [ "psh", { "|": [ "ack", { "|": [ "urg", { "|": [ "ecn", "cwr" ] } ] } ] } ] } ] } ] } ] }
+ }
+ }
+]
+
# tcp window 22222
[
{
[ 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 ]