-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Expected behavior: the behavior of tcpdump and pflua should match.
The fix: change the pflua parser.
Details:
% tcpdump -d "len < 2 * -5"
(000) ld #pktlen
(001) jge #0xfffffff6 jt 2 jf 3
(002) ret #0
(003) ret #65535
luajit: deps/pflua/src/pf/parse.lua:283:
Error: In expression "len < 2 * -5"
^
bad token while parsing arithmetic expression -
stack traceback:
[C]: in function 'primitive_error'
deps/pflua/src/pf/parse.lua:283: in function 'error'
deps/pflua/src/pf/parse.lua:660: in function 'parse_primary_arithmetic'
deps/pflua/src/pf/parse.lua:674: in function 'parse_arithmetic'
deps/pflua/src/pf/parse.lua:681: in function 'parse_arithmetic'
deps/pflua/src/pf/parse.lua:822: in function 'parse_logical_or_arithmetic'
deps/pflua/src/pf/parse.lua:846: in function 'parse_logical'
deps/pflua/src/pf/parse.lua:854: in function 'parse'
deps/pflua/src/pf.lua:30: in function 'compile_filter'
./pflangmatheval.lua:25: in function 'pflang_eval'
./pflua-quickcheck:148: in function 'property_pflua_and_tcpdump_arithmetic_match'
./pflua-quickcheck:191: in function 'main'
./pflua-quickcheck:196: in main chunk
[C]: at 0x00404bc0