RFR: 6914801: IPv6 unavailable if stdin is a socket

Michael McMahon michaelm at openjdk.org
Tue Jan 3 18:29:49 UTC 2023


On Mon, 12 Dec 2022 20:30:05 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> This patch reenables IPv6 stack when stdin is an IPv4 socket.
> 
> The code that blocked IPv6 was introduced in JDK-4673940 back when JDK could only operate with either IPv4 or IPv6 sockets, and was using `IPv6_available` to determine which socket type was in use. Now that JDK is able to operate with both IPv4 and IPv6 sockets at the same time, the check for IPv4 stdin is no longer relevant.
> 
> Included test passes with the changes applied, fails without them. Other tier1-3 tests also pass.

test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java line 112:

> 110:         try (ServerSocketChannel ssc = ch) {
> 111:             ssc.socket().bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
> 112:             SocketChannel sc1 = SocketChannel.open(ssc.getLocalAddress());

Could we add some logging/printlns here to indicate the protocol family of `ch` or its local address, to aid in debugging if we ever have problems with the test (eg on IPv6 only systems)?

-------------

PR: https://git.openjdk.org/jdk/pull/11638


More information about the nio-dev mailing list