-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pflua doesn't allow libpcap-style keyword elision #157
Comments
It's particularly hard to parse with named hosts: "host foo or bar". Is bar a hostname that should be looked up via DNS? Or is it a keyword? :) Likewise for "port ftp or http", is ftp a port or a server? pflang has strange grammar :) Consciously excluding this bit of the grammar might be an OK option, though this feature was lauded by the libpcap creator in some paper I saw last year :/ |
In the |
@kbara I think what happens with those expressions is the following:
|
Good point! |
Sorry for bumping this old issue, but I wanted to note for completeness sake that there's also another form of elision in which the end can be omitted (like the
This filter is equivalent to the following:
|
The following are libpcap pflang expressions which pflua doesn't allow, and their pflua equivalents. The root issue is that libpcap-pflang automatically uses the previous keyword if it's elided.
port 3 and 4
(this meansport 3 and port 4
)src host 127.0.0.1 or 127.0.0.2
(meanssrc host 127.0.0.1 or src host 127.0.0.1
).This is trickier than it appears, due to examples like
port 3 and 4
isport 3 and port 4
, whileport 3 and 4 == 4
is also valid in both pflangs, and means the same thing in both - it does not mean "port 3 and port 4 == 4", which is invalid.Workarounds:
a) Use pflua's bpf front-end (which also compiles to Lua), rather than the pflua's pure-lua pipeline.
b) Rewrite pflang expressions to not rely on keyword elision.
Other impact: at least one error message is quite verbose to account for this possibility: see #153 .
The text was updated successfully, but these errors were encountered: