On Mon, 15 Dec 2025 13:32:17 GMT, Daniel Fuchs <[email protected]> wrote:
>> We have a Linux machine with IPV6 disabled.
>> There the test javax/net/ssl/HttpsURLConnection/SubjectAltNameIP.java fails.
>> Error is
>>
>> java.lang.RuntimeException: Server failed to start.
>> at SubjectAltNameIP.doClientSide(SubjectAltNameIP.java:139)
>> at SubjectAltNameIP.<init>(SubjectAltNameIP.java:189)
>> at SubjectAltNameIP.main(SubjectAltNameIP.java:176)
>> at
>> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>> at java.base/java.lang.reflect.Method.invoke(Method.java:565)
>> at
>> com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
>> at java.base/java.lang.Thread.run(Thread.java:1516)
>> Caused by: java.net.SocketException: Protocol family unavailable
>>
>>
>> After looking into the test, it turned out the IPV6 address `::1` was
>> passed in the notion `[::1] `to the isIPv6LiteralAddress, but this method
>> must get the address without '[' and ']' .
>> Additionally I adjusted the exception a bit so that it directly mentions
>> IPV6 and not just some 'protol family' .
>
> src/java.base/unix/native/libnet/net_util_md.c line 288:
>
>> 286: if (family != java_net_InetAddress_IPv4) {
>> 287: if (ipv6av) {
>> 288: JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
>> "Protocol family ipv6, ipv6 on machine available");
>
> This exception does not really make sense. Are you really sure it's possible
> to get here?
Looks like to get into the else case starting at line 284 or before the patch
like 282 , ipv6_available() / ipv6av can be false ; or also the second part of
the if check can be false
!(family == java_net_InetAddress_IPv4 && v4MappedAddress == JNI_FALSE))
so we should distinguish the 2 cases. Not sure if this really happens, on our
system showing the error we got the other one `Caused by:
java.net.SocketException: Protocol family ipv6, ipv6 on machine unavailable`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28825#discussion_r2619541006