Closed mpeterv closed 9 years ago
Would you explain/give an example of how it improves tcpdump compatibility?
@kbara it's just that, octal arguments. E.g. port 010
is supported in tcpdump. Of course that's very minor, the main benefit is improvement of error messages.
Thanks for the clarification. LGTM, and the extra parse tests look like a sufficient regression test. WDYT, @andywingo ?
LGTM with the nit, please let me know if the nit is correct and if so when you have a fix. Cheers :)
@andywingo assertion has to be moved out completely because a number with a valid terminator still can be start of a hostname, e.g. 0xffffffffff-oo.com
.
I've pushed a simple fix which duplicates the assertion. We could also add optional max_pos
parameter to lex_number and check number size only when it's not used or is equal to position of last digit. If you don't mind the current fix I could do that later along with some refactoring.
LGTM. Thank you @mpeterv :)
Use same function for parsing numerical literals in arithmetic expressions and as arguments of primitives, e.g. 'port'. Add some error reporting to this function; previously lexer had to fallback to address parsing on incorrect number literals.
This improves tcpdump compatibility.