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

Arthur Eubanks aeubanks at google.com
Wed May 1 22:53:13 UTC 2019


Webrev: http://cr.openjdk.java.net/~aeubanks/8223214/webrev.00/
Bug: https://bugs.openjdk.java.net/browse/JDK-8223214

Bug description:
Currently, Inet6AddressImpl.loopbackAddress() will unconditionally choose
the IPv6 loopback address if java.net.preferIPv6Address is set to "system"
or "true", else unconditionally choose the IPv4 loopback address.

Instead it should try out both loopback addresses and return whichever one
works, giving preference to IPv6 if java.net.preferIPv6Address is set to
"system" or "true", else giving preference to IPv4. This way there is no
need to set java.net.preferIPv6Address in an IPv6-only environment to get a
valid loopback address.


Does this need tests? Or is it good enough to assume that existing tests
will cover this, they just need to be run in an IPv6-only environment?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190501/0194f034/attachment.html>


More information about the net-dev mailing list