Method NetUtils.netmask_to_cidr()


Method netmask_to_cidr

int netmask_to_cidr(string mask)

Description

Returns the CIDR of a given netmask. Only returns the correct value for netmasks with all-zeroes at the end (eg, 255.255.255.128 works, while 255.255.255.3 will give the wrong return value)

See also

http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation