Comment 3 for bug 1195974

Revision history for this message
yong sheng gong (gongysh) wrote :

following is my experiment with the wrong CIDR in python console:
>>> net = ip.IPNetwork('10.0.0.3/24')
>>> net.cidr
IPNetwork('10.0.0.0/24')
>>> net.netmask
IPAddress('255.255.255.0')

the conclusion is we need enhance the validation:
def _validate_subnet(data, valid_values=None):
    try:
        netaddr.IPNetwork(_validate_no_whitespace(data))
        if len(data.split('/')) == 2:
            return
    except Exception:
        pass