[ipv6] RFR: 8223214: Inet6AddressImpl.loopbackAddress() should choose loopback address that is available

Arthur Eubanks aeubanks at google.com
Tue May 7 20:36: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/
> Bug: 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.
>
Updated the comment.

>
> 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.
>
I don't see any other changes that are related to Inet6AddressImpl.

>
> 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
>
I think that makes sense. We could also refactor some of these patches to
use those rather than specifying "::1" or {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}.

New webrev: http://cr.openjdk.java.net/~aeubanks/8223214/webrev.01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190507/374dc0f3/attachment-0001.html>


More information about the net-dev mailing list