Skip to content
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

portrange parsing and validation discrepancies #1440

Open
infrastation opened this issue Jan 16, 2025 · 0 comments
Open

portrange parsing and validation discrepancies #1440

infrastation opened this issue Jan 16, 2025 · 0 comments

Comments

@infrastation
Copy link
Member

The port qualifier accepts either a number or a name, and the name must match the protocol if a protocol is specified (this is what "If a name is used, both the port number and protocol are checked." means, as far as I understand):

$ ./testprogs/filtertest IPV4 udp port http
filtertest: port 'http' is tcp

Likewise, the portrange qualifier also accepts a number or a name for either of its two arguments and seems to follow the same logic, but not quite entirely:

  • port 25 works as expected
  • port smtp works as expected
  • portrange 25 works (undocumented syntax)
  • portrange smtp returns an error ("port range 'smtp' contains no hyphen")
  • portrange 25-25 works as expected
  • portrange 25-smtp works as expected
  • portrange smtp-25 works as expected
  • portrange smtp-smtp works as expected
  • udp port 25 works as expected
  • udp port smtp returns an error as expected ("port 'smtp' is tcp")
  • udp portrange 25 works (undocumented syntax)
  • udp portrange smtp returns an error about a missing hyphen, not an error about protocol mismatch
  • udp portrange 25-25 works as expected
  • udp portrange 25-smtp compiles without an error, which is a failure to fail
  • udp portrange smtp-25 compiles without an error, which is a failure to fail
  • udp portrange smtp-smtp returns an error as expected ("port in range 'smtp-smtp' is tcp")
  • udp portrange smtp-domain compiles without an error, which is a failure to fail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant