Skip to content

Commit cc84568

Browse files
committed
mask tcp[tcpflags] with 0x0fff to provide tcp flags only
1 parent 4b8ca33 commit cc84568

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

grammar.y.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,10 @@ arth: pnum { CHECK_PTR_VAL(($$ = gen_loadi(cstate, $1))); }
854854
;
855855
tcpflags: TCPFLAGS
856856
;
857-
narth: pname '[' tcpflags ']' { CHECK_PTR_VAL(($$ = gen_load(cstate, $1, gen_loadi(cstate, 12), 2))); }
857+
narth: pname '[' tcpflags ']' { CHECK_PTR_VAL(($$ =
858+
gen_arth(cstate, BPF_AND,
859+
gen_load(cstate, $1, gen_loadi(cstate, 12), 2),
860+
gen_loadi(cstate, 0x0FFF)))); }
858861
| pname '[' arth ']' { CHECK_PTR_VAL(($$ = gen_load(cstate, $1, $3, 1))); }
859862
| pname '[' arth ':' NUM ']' { CHECK_PTR_VAL(($$ = gen_load(cstate, $1, $3, $5))); }
860863
| arth '+' arth { CHECK_PTR_VAL(($$ = gen_arth(cstate, BPF_ADD, $1, $3))); }

0 commit comments

Comments
 (0)