commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Putinas Piliponis (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (NET-529) SubnetUtils throws exception on valid input
Date Wed, 19 Mar 2014 20:17:42 GMT

    [ https://issues.apache.org/jira/browse/NET-529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13940929#comment-13940929
] 

Putinas Piliponis edited comment on NET-529 at 3/19/14 8:16 PM:
----------------------------------------------------------------

I provided example of 0.0.0.0/0 as most "obvious" one. Bug was closed only for "0.0.0.0/0",
but actually CIDR /0 is valid with any IP.

For example 10.10.10.10/0 is valid syntax. Here is output of popular unix utility "whatmask":

whatmask 10.10.10.10/0

------------------------------------------------
           TCP/IP NETWORK INFORMATION
------------------------------------------------
IP Entered = ..................: 10.10.10.10
CIDR = ........................: /0
Netmask = .....................: 0.0.0.0
Netmask (hex) = ...............: 0x00000000
Wildcard Bits = ...............: 255.255.255.255
------------------------------------------------
Network Address = .............: 0.0.0.0
Broadcast Address = ...........: 255.255.255.255
Usable IP Addresses = .........: 4294967294
First Usable IP Address = .....: 0.0.0.1
Last Usable IP Address = ......: 255.255.255.254


I would expect java class behave same.


was (Author: lapkritinis):
I provided example of 0.0.0.0/0 as most "obvious" one. Bug was closed only for "0.0.0.0/0",
but actually CIDR 0 is valid with any IP.

For example 10.10.10.10/0 is valid syntax. Here is output of popular unix utility "whatmask":

whatmask 10.10.10.10/0

------------------------------------------------
           TCP/IP NETWORK INFORMATION
------------------------------------------------
IP Entered = ..................: 10.10.10.10
CIDR = ........................: /0
Netmask = .....................: 0.0.0.0
Netmask (hex) = ...............: 0x00000000
Wildcard Bits = ...............: 255.255.255.255
------------------------------------------------
Network Address = .............: 0.0.0.0
Broadcast Address = ...........: 255.255.255.255
Usable IP Addresses = .........: 4294967294
First Usable IP Address = .....: 0.0.0.1
Last Usable IP Address = ......: 255.255.255.254


I would expect java class behave same.

> SubnetUtils throws exception on valid input
> -------------------------------------------
>
>                 Key: NET-529
>                 URL: https://issues.apache.org/jira/browse/NET-529
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 3.3
>            Reporter: Putinas Piliponis
>              Labels: SubnetUtils
>
> I think that 0.0.0.0/0 should be accepted value by SubnetUtils. (it's quite commonly
found on internet - indicating basically ALL ipv4 addresses).
> Test case:
> SubnetUtils subnetUtils = new SubnetUtils("0.0.0.0/0");
> However it throws exception:
> java.lang.IllegalArgumentException: Value [0] not in range (0,32]
> 	org.apache.commons.net.util.SubnetUtils.rangeCheck(SubnetUtils.java:304)
> 	org.apache.commons.net.util.SubnetUtils.calculate(SubnetUtils.java:229)
> 	org.apache.commons.net.util.SubnetUtils.<init>(SubnetUtils.java:52)



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message