RFR 8144672: (ch) PipeImpl should use localhost instead of loopback address

Martin Buchholz martinrb at google.com
Wed Feb 14 02:01:11 UTC 2018


At least in tests, we've been replacing "127.0.0.1" with
InetAddress.getLoopbackAddress().getHostAddress()

On Tue, Feb 13, 2018 at 4:09 PM, Brian Burkhalter <
brian.burkhalter at oracle.com> wrote:

> https://bugs.openjdk.java.net/browse/JDK-8144672
>
> Replace the hard-coded IPv4 loopback address:
>
> --- a/src/java.base/windows/classes/sun/nio/ch/PipeImpl.java
> +++ b/src/java.base/windows/classes/sun/nio/ch/PipeImpl.java
> @@ -110,7 +110,7 @@
>                      ByteBuffer bb = ByteBuffer.allocate(NUM_
> SECRET_BYTES);
>
>                      // Loopback address
> -                    InetAddress lb = InetAddress.getByName("127.0.0.1");
> +                    InetAddress lb = InetAddress.getLoopbackAddress();
>                      assert(lb.isLoopbackAddress());
>
> Or would it be better to replace getLoopbackAddress() in the above with
> getLocalHost()? Doing the latter may impose a security manager check.
>
> Thanks,
>
> Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180213/33573073/attachment.html>


More information about the nio-dev mailing list