netutils
netutils copied to clipboard
Incorrect response when using 'is_netmask` with inverse netmask.
Environment
- Python version: 3.11
- netutils version: 1.9.0
Expected Behavior
Expected to get a True response when passing "0.31.255.255" to is_netmask().
Observed Behavior
It was returned as False:
In [1]: from netutils.ip import is_netmask
In [2]: is_netmask("0.31.255.255")
Out[2]: False
Steps to Reproduce
- Import
is_netmask()in REPL. - Pass inverse/wildcard netmasks to the
is_netmask(). - See results.
This also means the netmask_to_cidr() function doesn't work as the is_netmask() returns False. If you test what's returned with that function ignoring the is_netmask() check you get the CIDR returned when using an inverse netmask.
netmask == subnet mask wildcardmask is what you are looking for, and being looked at in #616