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

IPNetwork constructor should add a parameter to indicate whether the input mask is an acl mask #123

Open
adamhj opened this issue Jan 13, 2016 · 1 comment · May be fixed by #376
Open

Comments

@adamhj
Copy link

adamhj commented Jan 13, 2016

If you look at a cisco acl list, it is common to have an acl like:
rule 5 permit ip source 1.2.3.4 0.0.0.0
or in some cases:
rule 5 permit ip source 1.2.3.4 0

here both 0.0.0.0 and 0 are cisco acl bitmask, indicating a net mask of 32 bit length
but if I simply concatenate them with ip address, IPNetwork class will treat them as normal netmask and get the wrong result:

IPNetwork('1.2.3.4/0.0.0.0')
IPNetwork('1.2.3.4/0')
IPNetwork('1.2.3.4/0')
IPNetwork('1.2.3.4/0')

I can manually convert the acl bitmask to net mask, but I think it's better to be automatically handled in netaddr, so please add an optional parameter in IPNetwork constructor to separate them out


forgot to say: this also apply to all 1 acl bitmask(255.255.255.255), although it is rare to see this in a device

@jstasiak
Copy link
Contributor

For reference: https://www.cisco.com/c/en/us/support/docs/security/ios-firewall/23602-confaccesslists.html#toc-hId-999156624

I'm not entirely convinced should be supported, I'm trying to think of a good API for this (I'm not a fan of adding boolean flags).

claytonsingh added a commit to claytonsingh/netaddr that referenced this issue Feb 19, 2024
@claytonsingh claytonsingh linked a pull request Feb 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants