netutils icon indicating copy to clipboard operation
netutils copied to clipboard

Incorrect response when using 'is_netmask` with inverse netmask.

Open jdrew82 opened this issue 1 year ago • 1 comments

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

  1. Import is_netmask() in REPL.
  2. Pass inverse/wildcard netmasks to the is_netmask().
  3. See results.

jdrew82 avatar Jul 12 '24 21:07 jdrew82

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.

jdrew82 avatar Jul 12 '24 21:07 jdrew82

netmask == subnet mask wildcardmask is what you are looking for, and being looked at in #616

itdependsnetworks avatar Jan 30 '25 20:01 itdependsnetworks