InetAddress::initializePlatformLookupPolicy() invokes
isIPv4Available()
this will retrieve a state variable indicating the availability of IPv4. On Windows OS platforms this is hardcoded to true as determined by native function IPv4_supported in
open/src/java.base/windows/native/libnet/net_util_md.c
jint IPv4_supported()
{
/* TODO: properly check for IPv4 support on Windows */
return JNI_TRUE;
}
This has implications on IPv6 only platforms, and as such skews the lookup policy on such platforms
It would seem appropriate to amend this function to test the socket creation as per other OS platforms
jint IPv4_supported()
{
SOCKET s = socket(AF_INET, SOCK_STREAM, 0) ;
if (s == INVALID_SOCKET) {
return JNI_FALSE;
}
closesocket(s);
return JNI_TRUE;
/* TODO: properly check for IPv4 support on Windows */
// return JNI_TRUE;
}