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

Unintuitive CIDR + Port rule inout #729

Closed
ignoramous opened this issue Jan 1, 2023 · 4 comments
Closed

Unintuitive CIDR + Port rule inout #729

ignoramous opened this issue Jan 1, 2023 · 4 comments
Assignees
Labels
bug Something isn't working P0 Priority: 0 (urgent and important)

Comments

@ignoramous
Copy link
Collaborator

ignoramous commented Jan 1, 2023

Doesn't work: 192.168.0.0/16:443

Incorrect: 192.168/16 => 192.0.0.168/16 (should be, 192.168.0.0/16)

@ignoramous ignoramous added bug Something isn't working P0 Priority: 0 (urgent and important) labels Jan 1, 2023
@ignoramous
Copy link
Collaborator Author

Apparently, the current behaviour is in line with how popular apps (incl browsers) interpret string representations of IP addresses. Closing...

@ignoramous ignoramous closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2023
@Rhys-T
Copy link

Rhys-T commented May 15, 2023

Just ran into this (although I wasn't trying to include a port number). In the context of single IPv4 addresses, the current behavior (putting the zeros in the middle - or more accurately, treating the last number as several bytes stuck together) is 'correct', though I gather it's basically "something that BSD's inet_aton() made up and everyone else copied" rather than an officially-specified syntax.

For a range of IPv4 addresses in CIDR notation, though… I'm not sure. RFC 4632, which seems to contain the official definition for that syntax, says nothing about being able to leave numbers out of the 'address' part. Common usage seems to be that if there are fewer than four numbers in the address part, you add zeros on the right until there are enough (so 192.168/16 would be 192.168.0.0/16). And in particular, RFC 1918 - which defines that 192.168.* range - uses it that way, referring to the three private address ranges as 10/8, 172.16/12, and 192.168/16. That seems to me like the more useful interpretation, because otherwise the last number would tend to fall into the unused/variable bits of the address. But none of that necessarily makes it the correct interpretation - if there even is one…

@ignoramous
Copy link
Collaborator Author

ignoramous commented May 21, 2023

Yeah, I guess you've a point... but the library we use, follows the BSD model. Also, I believe there's an rfc for string representation of IP addresses. I can't find it now, but I (probably incorrectly) recall it preferred the BSD style.

btw, BSD also did ruin multipath TCP (ref)... so they've a lot of blood on their hands ;)

@ignoramous ignoramous reopened this May 21, 2023
@ignoramous
Copy link
Collaborator Author

Impl in v055b: 38cb9ec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 Priority: 0 (urgent and important)
Projects
None yet
Development

No branches or pull requests

3 participants