[ipv6] RFR: 8223214: Inet6AddressImpl.loopbackAddress() should choose loopback address that is available
Chris Hegarty
chris.hegarty at oracle.com
Tue May 7 16:00:03 UTC 2019
Arthur,
> On 1 May 2019, at 23:53, Arthur Eubanks <aeubanks at google.com> wrote:
>
> Webrev: http://cr.openjdk.java.net/~aeubanks/8223214/webrev.00/ <http://cr.openjdk.java.net/~aeubanks/8223214/webrev.00/>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8223214 <https://bugs.openjdk.java.net/browse/JDK-8223214>
I think the changes are good.
Minor comment: after this changes, the Inet6AddressImpl class-level
comment is a little misleading. Maybe it would benefit from a small
update.
* If InetAddress.preferIPv6Address is true then anyLocalAddress(),
* loopbackAddress(), and localHost() will return IPv6 addresses,
* otherwise IPv4 addresses.
In your patch queue have you got any similar-ish changes relating to
`anyLocalAddress`? The reason I ask ( and it may not be an immediate
issue ) is that it is somewhat related, but kinda masked by code in the
native NET_InetAddressToSockaddr function, that maps the IPv4 wildcard
address to the IPv6 equivalent.
This change reminds me that; InetAddress getLoopbackAddress and
anyLocalAddress remove the need by the developer to think about the
particular IP version in use, as the methods should return an
appropriate address for the platform and environment in use. But
sometimes you just want the IPv4 loopback or the IPv6 loopback, etc.
Should we add public API points for just this?
Inet4Address::getIPv4LoopbackAddress
Inet6Address::getIPv6LoopbackAddress
Inet4Address::wildcardAddress
Inet6Address::wildcardAddress
-Chris.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190507/e5c167d2/attachment-0001.html>
More information about the net-dev
mailing list