Details
Description
In Ipv4 environment, the result of InterfaceAddress.getNetworkPrefixLength() for network interface
which does not have broadcast flag(ex. loopback address) is always 0.
Correct prefix length should be returns even in the above situation.
CONFIGURATION:
JDK: jdk7/jdk6u27
OS : linux(generic)
REPRODUCE:
1. Compile the attached test case
2. launch
"java GetBrodCastAddrAndPrefixLen <interface name>"
ex.
---
$ java GetBrodCastAddrAndPrefixLen lo
<0:0:0:0:0:0:0:1%1>
getBroadcast():null
getNetworkPrefixLength():128
<127.0.0.1>
getBroadcast():null
getNetworkPrefixLength():0
---
The last line of result should not be 0.
which does not have broadcast flag(ex. loopback address) is always 0.
Correct prefix length should be returns even in the above situation.
CONFIGURATION:
JDK: jdk7/jdk6u27
OS : linux(generic)
REPRODUCE:
1. Compile the attached test case
2. launch
"java GetBrodCastAddrAndPrefixLen <interface name>"
ex.
---
$ java GetBrodCastAddrAndPrefixLen lo
<0:0:0:0:0:0:0:1%1>
getBroadcast():null
getNetworkPrefixLength():128
<127.0.0.1>
getBroadcast():null
getNetworkPrefixLength():0
---
The last line of result should not be 0.
Attachments
Issue Links
- duplicates
-
JDK-7107882 getNetworkPrefixLength() does not return correct prefix length
- Closed
-
JDK-7123114 InterfaceAddress.getNetworkPrefixLength() returns -1 for wifi adapter
- Closed