Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8361423

Add IPSupport::printPlatformSupport to java/net/NetworkInterface/IPv4Only.java

XMLWordPrintable

      This is part of a series of diagnostic output updates to java.net tests to assist in the analysis of failures in IPv6 only environments
      for Linux there is not IPv4 configuration but the IPv4 stack remains enabled
      For macOS, and windows the IPv4 stacks are disabled, and IPv4 configuration removed

      add IPSupport::printPlatformSupport(System.out);

      to the start of main

      public class IPv4Only {
          public static void main(String[] args) throws Exception {
      IPSupport::printPlatformSupport(System.out); -
             if (IPSupport.hasIPv4()) {
                  System.out.println("Testing IPv4");
                  Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
                  while (nifs.hasMoreElements()) {
                      NetworkInterface nif = nifs.nextElement();
                      Enumeration<InetAddress> addrs = nif.getInetAddresses();
                      while (addrs.hasMoreElements()) {
                         InetAddress hostAddr = addrs.nextElement();
                         if ( hostAddr instanceof Inet6Address ){
                              throw new RuntimeException( "NetworkInterfaceV6List failed - found v6 address " + hostAddr.getHostAddress() );
                         }
                      }
                  }

            arigal Ayush Rigal
            msheppar Mark Sheppard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: