dustinrue/ControlPlane — pull request #206 by VladimirTechMan (2013-02-05 19:01:58+00:00)
Title: Fix the issue with "false IP evidences" on non-octet-aligned netmasks

IP Evidence does not work correctly when the network mask is not aligned to an octet (8-bit) boundary. If the mask is for class A, B, or C, everything is fine. But when the network mask is, for example, 255.255.254.0, then ControlPlane will just check the first two octets of the IP address to match. And it won't check on the third octet though 7 bits of that octet do belong to the network ID according to the network mask. That gives false positives -- for example, IP address 192.168.1.33 will be considered as an evidence for a network defined by IP address 192.168.60.0 and network mask 255.255.254.0.

The root cause is as follows: In IPEvidenceSource.m, inside the isIP method, variables interesting_octet and jump_size are calculated based on the prefix value _after_ changing the value of prefix from the number of bits to the number of octets. That makes the calculated values of the former two variables invalid. They need to be initialized while the prefix value corresponds to for the number of bits set in the netmask, not octets.