-
Notifications
You must be signed in to change notification settings - Fork 38
Description
On the good side: pflua appears to have fairly good libpcap compatibility on this point. The only incompatible detail that has appeared is that pflua does not treat hexadecimal arguments to portrange as a 0.
libpcap version 1.5.3, pflua 5e2c56b
portrange x-y requires both x and y to be decimal numbers; if they are not, it has rather unintuitive behaviour. Numbers starting with an 0x cause a parse error in pflua and are treated as 0 by libpcap, in expressions like "portrange 1-0x3. Numbers starting with a 0 are treated as decimal, rather than octal:
% ./pflua-compile "portrange 1-0151661"
luajit: ../src/pf/parse.lua:425: port 151661 out of range
% tcpdump -d "portrange 1-0151661"
tcpdump: illegal port number 151661 > 65535
Note that port can take octal and hexadecimal values. For instance, port 0151661 is tested against #0xd3b1 in libpcap, and 45523 in pflua on x86 (0xb1d3 - it's not abstracting away network byte order vs x86 byte order, but it gives the correct result).