Skip to content

Commit 70da668

Browse files
committed
mask tcp[tcpflags] with 0x0fff to provide tcp flags only
1 parent fc914fb commit 70da668

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
@@ -856,7 +856,10 @@ arth: pnum { CHECK_PTR_VAL(($$ = gen_loadi(cstate, $1))); }
856856
;
857857
tcpflags: TCPFLAGS
858858
;
859-
narth: pname '[' tcpflags ']' { CHECK_PTR_VAL(($$ = gen_load(cstate, $1, gen_loadi(cstate, 12), 2))); }
859+
narth: pname '[' tcpflags ']' { CHECK_PTR_VAL(($$ =
860+
gen_arth(cstate, BPF_AND,
861+
gen_load(cstate, $1, gen_loadi(cstate, 12), 2),
862+
gen_loadi(cstate, 0x0FFF)))); }
860863
| pname '[' arth ']' { CHECK_PTR_VAL(($$ = gen_load(cstate, $1, $3, 1))); }
861864
| pname '[' arth ':' NUM ']' { CHECK_PTR_VAL(($$ = gen_load(cstate, $1, $3, $5))); }
862865
| arth '+' arth { CHECK_PTR_VAL(($$ = gen_arth(cstate, BPF_ADD, $1, $3))); }

0 commit comments

Comments
 (0)