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

CidrGuess considerations #226

Open
maettu-this opened this issue Sep 17, 2022 · 0 comments
Open

CidrGuess considerations #226

maettu-this opened this issue Sep 17, 2022 · 0 comments

Comments

@maettu-this
Copy link
Contributor

Hi Luc,

The behavior of Parse("192.0.43.8") of v2.2.0 is:

  • Network = 192.0.43.0
  • Cidr =24

Apparently this is class-full. Now consider Parse("192.0.43.0"):

  • Network = 192.0.43.0
  • Cidr =24

For class-full of course I would expect the same. But for class-less I would also expect this. Why? Because of the trailing "0". But of course this could result in invalid behavior when somebody expects Cidr = 32 for a trailing "0".

I don't fully see the behavior of the current code. But in case class-less always results in Cidr = 32 (for IPv4), I have a request:

Please provide a third CidrGuess, one that is "network aware". Expectation:

  • Parse("192.0.43.8") => Cidr = 32
  • Parse("192.0.43.0") => Cidr = 24
  • Parse("192.43.0.0") => Cidr = 16
  • Parse("192.0.43.255") => Cidr = 24 (wildcard mask)
  • Parse("192.43.255.255") => Cidr = 16 (wildcard mask)
  • ...

Best regards,
Matthias

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

No branches or pull requests

2 participants