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

Cidr.fromString allows invalid CIDR ranges #532

Closed
martijnhoekstra opened this issue Oct 14, 2023 · 0 comments · Fixed by #533
Closed

Cidr.fromString allows invalid CIDR ranges #532

martijnhoekstra opened this issue Oct 14, 2023 · 0 comments · Fixed by #533

Comments

@martijnhoekstra
Copy link
Contributor

invalid masks are accepted in Cidr.fromString:

scala> Cidr.fromString("0.0.0.0/99")
val res0: Option[com.comcast.ip4s.Cidr[com.comcast.ip4s.IpAddress]] = Some(0.0.0.0/32)

Receipts: https://datatracker.ietf.org/doc/html/rfc4632#section-3.1

In CIDR notation, a prefix is shown as a 4-octet
quantity, just like a traditional IPv4 address or network number,
followed by the "/" (slash) character, followed by a decimal value
between 0 and 32 that describes the number of significant bits.

tangentially also #137 which I do believe is really a bug (but breaking changes are bad).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant