Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
The processing part of "netmask" is converted an integer to a string to an integer.
/* SubnetUtils.SubnetInfo#getCidrSignature() */ // a binary mask address int netmask = 0b11111111000000000000000000000000; // convert to a dotted decimal address String maskStr = format(toArray(netmask)); // maskStr: "255.0.0.0" /* SubnetUtils#toCidrNotation() */ // counting the 1-bit population int cidr = pop(toInteger(maskStr)); // cidr: 8
So, I suggest to create CIDR from the netmask variable.
https://github.com/apache/commons-net/pull/10