Open
Description
IPv6 is unavailable in the OpenJDK 21 builds:
jshell> new Socket("::1", 80).getOutputStream()
| Exception java.net.SocketException: Protocol family unavailable
| at Net.connect0 (Native Method)
| at Net.connect (Net.java:589)
| at Net.connect (Net.java:578)
| at NioSocketImpl.connect (NioSocketImpl.java:583)
| at SocksSocketImpl.connect (SocksSocketImpl.java:327)
| at Socket.connect (Socket.java:751)
| at Socket.connect (Socket.java:686)
| at Socket.<init> (Socket.java:555)
| at Socket.<init> (Socket.java:324)
| at (#2:1)
In OpenJDK 17, IPv6 works as expected.
This bug is caused by the IPv6_supported
function no longer working correctly as it tries to used a closed file descriptor, and is easy to fix:
--- jdk21u-jdk-21.0.6-7/src/java.base/unix/native/libnet/net_util_md.c.orig 2025-03-09 12:46:00.190813687 +0100
+++ jdk21u-jdk-21.0.6-7/src/java.base/unix/native/libnet/net_util_md.c 2025-03-09 13:04:33.720866346 +0100
@@ -233,7 +233,9 @@
*/
return JNI_FALSE;
}
+#ifndef __solaris__
close(fd);
+#endif
/**
* Linux - check if any interface has an IPv6 address.
I'm not sure what the preferred way of fixing a bug in OpenJDK is: should java-solaris-sparc.patch
be updated to correctly patch the IPv6_supported
function, or should a separate patch file be added for this?
Metadata
Metadata
Assignees
Labels
No labels