JDK-8361422 : java/net/NetworkInterface/IPv4Only.java fail on OL IPv6 only configured environments
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 24
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux_oracle
  • Submitted: 2025-07-04
  • Updated: 2025-07-07
Related Reports
Relates :  
Description
We run jdk_net and nio_networkchannel tests on IPv6 only environments.
For linux it is not possible to fully disable IPv4, as such the env are configured as only IPv6

test fails because IPSupport.hasIPv4() returns
add additional check to IPSupport.isIPv4Configured() and IPSupport.isIPv6Configured() and amend logic to choose IPv6 test block

The windows environment failures should be addressed in another bug 

           try {
                NetworkInterface.getNetworkInterfaces();
                throw new RuntimeException("NetworkInterface.getNetworkInterfaces() should throw SocketException");
            } catch (SocketException expected) {
                System.out.println("caught expected exception: " + expected);
            }

            try {
                NetworkInterface.networkInterfaces();
                throw new RuntimeException("NetworkInterface.networkInterfaces() should throw SocketException");
            } catch (SocketException expected) {
                System.out.println("caught expected exception: " + expected);
            }

the setting of -Djava.net.preferIPv4Stack=true is expecting the filtering NetworkInterfaces without IPv4 configuration ... BUT is that reasonable semantics