Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Not A Problem
-
None
-
None
-
None
-
None
Description
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); }
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.