Sathyavathy Mohan created NET-651:
-------------------------------------

             Summary: Ip Range Check with Subnte utils provides in correct 
answer
                 Key: NET-651
                 URL: https://issues.apache.org/jira/browse/NET-651
             Project: Commons Net
          Issue Type: Bug
            Reporter: Sathyavathy Mohan


{code:java}
private static void checkIp() {
 System.out.println(verifyCommonsNet("192.168.0.1", "192.168.0.1/32"));
 System.out.println(verifySpringSecurity("192.168.0.1", "192.168.0.1/32"));
}

private static boolean verifyCommonsNet(String ip, String subnet) {
 SubnetUtils.SubnetInfo subnetInfo = (new SubnetUtils(subnet)).getInfo();
 return subnetInfo.isInRange(ip);
}

private static boolean verifySpringSecurity(String ip, String subnet) {
 IpAddressMatcher ipAddressMatcher = new IpAddressMatcher(subnet);
 return ipAddressMatcher.matches(ip);
}{code}
 

Tried to check Ip range functionality with Subnet Utils. But I get an incorrect 
answer when using mask of 32. The same CIDR with Spring security provides the 
right answer. checking 192.168.0.1 against 192.168.0.1/32 should return true. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to