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

Remove hardcoded IPv4 available policy on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 19
    • None
    • core-libs
    • None
    • b09
    • x86_64
    • windows

      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;
      }

            msheppar Mark Sheppard
            msheppar Mark Sheppard
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: