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

Improve CIDR validation for a given mask #137

Closed
elee826 opened this issue May 11, 2020 · 1 comment
Closed

Improve CIDR validation for a given mask #137

elee826 opened this issue May 11, 2020 · 1 comment

Comments

@elee826
Copy link

elee826 commented May 11, 2020

For a given mask, if the IP address has bits set to the right, it should be invalid.

For example:
2.2.2.0/22 should be invalid because there are bits set to the right of the mask.

ip address bit pattern (2.2.2.0):
00000010 00000010 00000010 00000000

mask bit pattern (22):
11111111 11111111 11111100 00000000

@elee826
Copy link
Author

elee826 commented May 12, 2020

This type of validation is overly strict and is only used to model a network’s IP address rather than a device’s IP address. The original thought was that the validation should match that of Postgres SQLs cidr type, but that is too implementation specific.

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

No branches or pull requests

1 participant