Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-641

SubnetUtils.SubnetInfo.isInRange("0.0.0.0") returns true for CIDR/31, 32

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.6
    • 3.7
    • None
    • None
    • Windows; JDK8; common-net 3.6

    Description

      Code:
      import org.apache.commons.net.util.SubnetUtils;

      public class A {
      public static void main(String[] args)

      { System.out.println(new SubnetUtils("192.168.1.0/30").getInfo().isInRange("0.0.0.0")); System.out.println(new SubnetUtils("192.168.1.0/31").getInfo().isInRange("0.0.0.0")); System.out.println(new SubnetUtils("192.168.1.0/32").getInfo().isInRange("0.0.0.0")); }

      }

      Result:
      false
      true
      true

      Expected:
      false
      false
      false

      Attachments

        Activity

          People

            Unassigned Unassigned
            pin_ptr pin_ptr
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: