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

SubnetUtils constructor fails on /32 subnets

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None
    • Environment:

      All

      Description

      The following code:

      SubnetUtils subnetUtils = new SubnetUtils("192.168.0.1/32");

      throws the following exception:

      Exception in thread "main" java.lang.IllegalArgumentException: Value [32] not in range (-1,31]
      at org.apache.commons.net.util.SubnetUtils.rangeCheck(SubnetUtils.java:216)
      at org.apache.commons.net.util.SubnetUtils.calculate(SubnetUtils.java:141)
      at org.apache.commons.net.util.SubnetUtils.<init>(SubnetUtils.java:46)
      at com.gs.configmgt.proteus.model.impl.TestTest.main(TestTest.java:12)

      /32 is a perfectly valid subnet of one host. See wikipedia for verification: http://en.wikipedia.org/wiki/IPv4_subnetting_reference.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                kevinschmidt Kevin Schmidt
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: