Request for Review: 6707289
Christopher Hegarty - Sun Microsystems Ireland
Christopher.Hegarty at Sun.COM
Fri Jan 22 06:55:22 PST 2010
Hi Micahel, Jessie,
6707289: InterfaceAddress.getNetworkPrefixLength() does not conform to
Javadoc
getAddrsFromAdapter
(src/windows/native/java/net/NetworkInterface_winXP.c) makes an
incorrect assumption that the list of IP_ADAPTER_PREFIX structures
pointed to by the FirstPrefix member has a linear relationship with the
IP_ADAPTER_UNICAST_ADDRESS structures pointed to by the
FirstUnicastAddress member. This is incorrect.
It appears there is no guarantee about the returned IP_ADAPTER_PREFIX
order, making it very difficult to determine what (if any) unicast
address they relate to.
The simplest way to resolve this issue to use enumAddresses_win to
determine the IPv4 addresses, and skip IPv4 addresses in
getAddrsFromAdapter. enumAddresses_win is not IPv6 aware so we call
getAddrsFromAdapter after to determine IPv6 addresses.
Webrev:
http://cr.openjdk.java.net/~chegar/6707289/webrev.0/webrev/
-Chris.
More information about the net-dev
mailing list