/hg/release/icedtea7-forest-2.5/jdk: 7 new changesets

andrew at icedtea.classpath.org andrew at icedtea.classpath.org
Mon Jul 6 11:04:17 UTC 2015


changeset 1a4d0c3331bf in /hg/release/icedtea7-forest-2.5/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.5/jdk?cmd=changeset;node=1a4d0c3331bf
author: andrew
date: Fri Apr 24 17:45:59 2015 +0100

	4890063, PR2305, RH1214835: HPROF: default text truncated when using doe=n option


changeset a5fcd1d93d68 in /hg/release/icedtea7-forest-2.5/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.5/jdk?cmd=changeset;node=a5fcd1d93d68
author: robm
date: Mon Apr 27 17:17:07 2015 +0100

	6991580, PR2308: IPv6 Nameservers in resolv.conf throws NumberFormatException
	Reviewed-by: michaelm, andrew, alanb, rriggs
	Contributed-by: sgehwolf at redhat.com


changeset 4ca679b197d8 in /hg/release/icedtea7-forest-2.5/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.5/jdk?cmd=changeset;node=4ca679b197d8
author: prr
date: Wed Jun 03 15:52:40 2015 +0100

	8078654, PR2333: CloseTTFontFileFunc callback should be removed
	Reviewed-by: prr, martin


changeset ef3273e2be46 in /hg/release/icedtea7-forest-2.5/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.5/jdk?cmd=changeset;node=ef3273e2be46
author: robm
date: Mon Mar 23 17:05:01 2015 +0000

	8072385, PR2387: Only the first DNSName entry is checked for endpoint identification
	Reviewed-by: xuelei


changeset f4334685483a in /hg/release/icedtea7-forest-2.5/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.5/jdk?cmd=changeset;node=f4334685483a
author: michaelm
date: Fri Aug 15 14:50:27 2014 +0100

	8029607, PR2418: Type of Service (TOS) cannot be set in IPv6 header
	Reviewed-by: alanb


changeset c9edd4f4aee1 in /hg/release/icedtea7-forest-2.5/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.5/jdk?cmd=changeset;node=c9edd4f4aee1
author: michaelm
date: Mon Jul 07 12:42:14 2014 +0100

	8048212, PR2418: Two tests failed with "java.net.SocketException: Bad protocol option" on Windows after 8029607
	Reviewed-by: alanb


changeset f4a43a71c2ba in /hg/release/icedtea7-forest-2.5/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.5/jdk?cmd=changeset;node=f4a43a71c2ba
author: andrew
date: Mon Jul 06 11:59:12 2015 +0100

	Added tag icedtea-2.5.6pre01 for changeset c9edd4f4aee1


diffstat:

 .hgtags                                                        |    1 +
 src/share/classes/sun/nio/ch/DatagramChannelImpl.java          |   23 +-
 src/share/classes/sun/nio/ch/Net.java                          |    5 +-
 src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java      |    9 +
 src/share/classes/sun/nio/ch/SocketChannelImpl.java            |   17 +-
 src/share/classes/sun/security/ssl/ClientHandshaker.java       |  107 +++++++--
 src/share/demo/jvmti/hprof/hprof_init.c                        |    2 +-
 src/share/native/sun/font/freetypeScaler.c                     |   16 +-
 src/share/native/sun/nio/ch/genSocketOptionRegistry.c          |    1 +
 src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java |    9 +
 src/solaris/native/java/net/net_util_md.c                      |    8 +-
 src/solaris/native/sun/nio/ch/Net.c                            |    9 +-
 src/windows/native/java/net/net_util_md.c                      |    7 +
 src/windows/native/sun/nio/ch/Net.c                            |   11 +-
 test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java   |  104 +++++++++
 15 files changed, 247 insertions(+), 82 deletions(-)

diffs (truncated from 557 to 500 lines):

diff -r 80f2e59761dd -r f4a43a71c2ba .hgtags
--- a/.hgtags	Tue Apr 14 21:40:47 2015 +0100
+++ b/.hgtags	Mon Jul 06 11:59:12 2015 +0100
@@ -558,3 +558,4 @@
 e1bfd77b6e1ae3b78172fd9d5166e28262c0822c icedtea-2.5.5pre01
 fbace7bbfb811c902795fdee441aff90b6f8e13f icedtea-2.5.5pre02
 fb9961d8dfda7df558b15feb6010ecd9f3ebfc89 icedtea-2.5.5
+c9edd4f4aee1ee6c1dbde18343c8c6cafbfe6ede icedtea-2.5.6pre01
diff -r 80f2e59761dd -r f4a43a71c2ba src/share/classes/sun/nio/ch/DatagramChannelImpl.java
--- a/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Mon Jul 06 11:59:12 2015 +0100
@@ -194,15 +194,8 @@
         synchronized (stateLock) {
             ensureOpen();
 
-            if (name == StandardSocketOptions.IP_TOS) {
-                // IPv4 only; no-op for IPv6
-                if (family == StandardProtocolFamily.INET) {
-                    Net.setSocketOption(fd, family, name, value);
-                }
-                return this;
-            }
-
-            if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
+            if (name == StandardSocketOptions.IP_TOS ||
+                name == StandardSocketOptions.IP_MULTICAST_TTL ||
                 name == StandardSocketOptions.IP_MULTICAST_LOOP)
             {
                 // options are protocol dependent
@@ -255,16 +248,8 @@
         synchronized (stateLock) {
             ensureOpen();
 
-            if (name == StandardSocketOptions.IP_TOS) {
-                // IPv4 only; always return 0 on IPv6
-                if (family == StandardProtocolFamily.INET) {
-                    return (T) Net.getSocketOption(fd, family, name);
-                } else {
-                    return (T) Integer.valueOf(0);
-                }
-            }
-
-            if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
+            if (name == StandardSocketOptions.IP_TOS ||
+                name == StandardSocketOptions.IP_MULTICAST_TTL ||
                 name == StandardSocketOptions.IP_MULTICAST_LOOP)
             {
                 return (T) Net.getSocketOption(fd, family, name);
diff -r 80f2e59761dd -r f4a43a71c2ba src/share/classes/sun/nio/ch/Net.java
--- a/src/share/classes/sun/nio/ch/Net.java	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/share/classes/sun/nio/ch/Net.java	Mon Jul 06 11:59:12 2015 +0100
@@ -370,7 +370,8 @@
         }
 
         boolean mayNeedConversion = (family == UNSPEC);
-        setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg);
+        boolean isIPv6 = (family == StandardProtocolFamily.INET6);
+        setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg, isIPv6);
     }
 
     static Object getSocketOption(FileDescriptor fd, ProtocolFamily family,
@@ -507,7 +508,7 @@
         throws IOException;
 
     private static native void setIntOption0(FileDescriptor fd, boolean mayNeedConversion,
-                                             int level, int opt, int arg)
+                                             int level, int opt, int arg, boolean isIPv6)
         throws IOException;
 
     // -- Multicast support --
diff -r 80f2e59761dd -r f4a43a71c2ba src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
--- a/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java	Mon Jul 06 11:59:12 2015 +0100
@@ -133,6 +133,14 @@
         synchronized (stateLock) {
             if (!isOpen())
                 throw new ClosedChannelException();
+
+            if (name == StandardSocketOptions.IP_TOS) {
+                ProtocolFamily family = Net.isIPv6Available() ?
+                    StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+                Net.setSocketOption(fd, family, name, value);
+                return this;
+            }
+
             if (name == StandardSocketOptions.SO_REUSEADDR &&
                     Net.useExclusiveBind())
             {
@@ -177,6 +185,7 @@
             HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(2);
             set.add(StandardSocketOptions.SO_RCVBUF);
             set.add(StandardSocketOptions.SO_REUSEADDR);
+            set.add(StandardSocketOptions.IP_TOS);
             return Collections.unmodifiableSet(set);
         }
     }
diff -r 80f2e59761dd -r f4a43a71c2ba src/share/classes/sun/nio/ch/SocketChannelImpl.java
--- a/src/share/classes/sun/nio/ch/SocketChannelImpl.java	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/share/classes/sun/nio/ch/SocketChannelImpl.java	Mon Jul 06 11:59:12 2015 +0100
@@ -172,14 +172,14 @@
             if (!isOpen())
                 throw new ClosedChannelException();
 
-            // special handling for IP_TOS: no-op when IPv6
             if (name == StandardSocketOptions.IP_TOS) {
-                if (!Net.isIPv6Available())
-                    Net.setSocketOption(fd, StandardProtocolFamily.INET, name, value);
+                ProtocolFamily family = Net.isIPv6Available() ?
+                    StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+                Net.setSocketOption(fd, family, name, value);
                 return this;
-            } else if (name == StandardSocketOptions.SO_REUSEADDR &&
-                           Net.useExclusiveBind())
-            {
+            }
+
+            if (name == StandardSocketOptions.SO_REUSEADDR && Net.useExclusiveBind()) {
                 // SO_REUSEADDR emulated when using exclusive bind
                 isReuseAddress = (Boolean)value;
                 return this;
@@ -214,8 +214,9 @@
 
             // special handling for IP_TOS: always return 0 when IPv6
             if (name == StandardSocketOptions.IP_TOS) {
-                return (Net.isIPv6Available()) ? (T) Integer.valueOf(0) :
-                    (T) Net.getSocketOption(fd, StandardProtocolFamily.INET, name);
+                ProtocolFamily family = Net.isIPv6Available() ?
+                    StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
+                return (T) Net.getSocketOption(fd, family, name);
             }
 
             // no options that require special handling
diff -r 80f2e59761dd -r f4a43a71c2ba src/share/classes/sun/security/ssl/ClientHandshaker.java
--- a/src/share/classes/sun/security/ssl/ClientHandshaker.java	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/share/classes/sun/security/ssl/ClientHandshaker.java	Mon Jul 06 11:59:12 2015 +0100
@@ -62,6 +62,10 @@
  */
 final class ClientHandshaker extends Handshaker {
 
+    // constants for subject alt names of type DNS and IP
+    private final static int ALTNAME_DNS = 2;
+    private final static int ALTNAME_IP  = 7;
+
     // the server's public key from its certificate.
     private PublicKey serverKey;
 
@@ -1466,20 +1470,49 @@
             return true;
         }
 
-        // check the iPAddress field in subjectAltName extension
-        Object thisIPAddress = getSubjectAltName(thisCert, 7);  // 7: iPAddress
-        Object prevIPAddress = getSubjectAltName(prevCert, 7);
-        if (thisIPAddress != null && prevIPAddress!= null) {
-            // only allow the exactly match
-            return Objects.equals(thisIPAddress, prevIPAddress);
+        // check subject alternative names
+        Collection<List<?>> thisSubjectAltNames = null;
+        try {
+            thisSubjectAltNames = thisCert.getSubjectAlternativeNames();
+        } catch (CertificateParsingException cpe) {
+            if (debug != null && Debug.isOn("handshake")) {
+                System.out.println(
+                        "Attempt to obtain subjectAltNames extension failed!");
+            }
         }
 
-        // check the dNSName field in subjectAltName extension
-        Object thisDNSName = getSubjectAltName(thisCert, 2);    // 2: dNSName
-        Object prevDNSName = getSubjectAltName(prevCert, 2);
-        if (thisDNSName != null && prevDNSName!= null) {
-            // only allow the exactly match
-            return Objects.equals(thisDNSName, prevDNSName);
+        Collection<List<?>> prevSubjectAltNames = null;
+        try {
+            prevSubjectAltNames = prevCert.getSubjectAlternativeNames();
+        } catch (CertificateParsingException cpe) {
+            if (debug != null && Debug.isOn("handshake")) {
+                System.out.println(
+                        "Attempt to obtain subjectAltNames extension failed!");
+            }
+        }
+
+        if ((thisSubjectAltNames != null) && (prevSubjectAltNames != null)) {
+            // check the iPAddress field in subjectAltName extension
+            Collection<String> thisSubAltIPAddrs =
+                        getSubjectAltNames(thisSubjectAltNames, ALTNAME_IP);
+            Collection<String> prevSubAltIPAddrs =
+                        getSubjectAltNames(prevSubjectAltNames, ALTNAME_IP);
+            if ((thisSubAltIPAddrs != null) && (prevSubAltIPAddrs != null) &&
+                (isEquivalent(thisSubAltIPAddrs, prevSubAltIPAddrs))) {
+
+                return true;
+            }
+
+            // check the dNSName field in subjectAltName extension
+            Collection<String> thisSubAltDnsNames =
+                        getSubjectAltNames(thisSubjectAltNames, ALTNAME_DNS);
+            Collection<String> prevSubAltDnsNames =
+                        getSubjectAltNames(prevSubjectAltNames, ALTNAME_DNS);
+            if ((thisSubAltDnsNames != null) && (prevSubAltDnsNames != null) &&
+                (isEquivalent(thisSubAltDnsNames, prevSubAltDnsNames))) {
+
+                return true;
+            }
         }
 
         // check the certificate subject and issuer
@@ -1500,29 +1533,43 @@
     /*
      * Returns the subject alternative name of the specified type in the
      * subjectAltNames extension of a certificate.
+     *
+     * Note that only those subjectAltName types that use String data
+     * should be passed into this function.
      */
-    private static Object getSubjectAltName(X509Certificate cert, int type) {
-        Collection<List<?>> subjectAltNames;
+    private static Collection<String> getSubjectAltNames(
+            Collection<List<?>> subjectAltNames, int type) {
 
-        try {
-            subjectAltNames = cert.getSubjectAlternativeNames();
-        } catch (CertificateParsingException cpe) {
-            if (debug != null && Debug.isOn("handshake")) {
-                System.out.println(
-                        "Attempt to obtain subjectAltNames extension failed!");
-            }
-            return null;
-        }
-
-        if (subjectAltNames != null) {
-            for (List<?> subjectAltName : subjectAltNames) {
-                int subjectAltNameType = (Integer)subjectAltName.get(0);
-                if (subjectAltNameType == type) {
-                    return subjectAltName.get(1);
+        HashSet<String> subAltDnsNames = null;
+        for (List<?> subjectAltName : subjectAltNames) {
+            int subjectAltNameType = (Integer)subjectAltName.get(0);
+            if (subjectAltNameType == type) {
+                String subAltDnsName = (String)subjectAltName.get(1);
+                if ((subAltDnsName != null) && !subAltDnsName.isEmpty()) {
+                    if (subAltDnsNames == null) {
+                        subAltDnsNames =
+                                new HashSet<>(subjectAltNames.size());
+                    }
+                    subAltDnsNames.add(subAltDnsName);
                 }
             }
         }
 
-        return null;
+        return subAltDnsNames;
+    }
+
+    private static boolean isEquivalent(Collection<String> thisSubAltNames,
+            Collection<String> prevSubAltNames) {
+
+        for (String thisSubAltName : thisSubAltNames) {
+            for (String prevSubAltName : prevSubAltNames) {
+                // Only allow the exactly match.  Check no wildcard character.
+                if (thisSubAltName.equalsIgnoreCase(prevSubAltName)) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
     }
 }
diff -r 80f2e59761dd -r f4a43a71c2ba src/share/demo/jvmti/hprof/hprof_init.c
--- a/src/share/demo/jvmti/hprof/hprof_init.c	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/share/demo/jvmti/hprof/hprof_init.c	Mon Jul 06 11:59:12 2015 +0100
@@ -1361,7 +1361,7 @@
         } rawMonitorExit(gdata->dump_lock);
 
         /* Dump everything if we need to */
-        if (gdata->dump_on_exit && need_to_dump) {
+        if (gdata->dump_on_exit || need_to_dump) {
 
             dump_all_data(env);
         }
diff -r 80f2e59761dd -r f4a43a71c2ba src/share/native/sun/font/freetypeScaler.c
--- a/src/share/native/sun/font/freetypeScaler.c	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/share/native/sun/font/freetypeScaler.c	Mon Jul 06 11:59:12 2015 +0100
@@ -151,20 +151,6 @@
 
 #define FILEDATACACHESIZE 1024
 
-/* NB: is it ever called? */
-static void CloseTTFontFileFunc(FT_Stream stream) {
-    FTScalerInfo *scalerInfo = (FTScalerInfo *) stream->pathname.pointer;
-    JNIEnv* env = scalerInfo->env;
-    jclass tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont");
-    jfieldID platNameField =
-         (*env)->GetFieldID(env, tmpClass, "platName", "Ljava/lang/String;");
-    jstring platName = (*env)->GetObjectField(env,
-                                              scalerInfo->font2D,
-                                              platNameField);
-    const char *name = JNU_GetStringPlatformChars(env, platName, NULL);
-    JNU_ReleaseStringPlatformChars(env, platName, name);
-}
-
 static unsigned long ReadTTFontFileFunc(FT_Stream stream,
                                         unsigned long offset,
                                         unsigned char* destBuffer,
@@ -309,7 +295,7 @@
                 ftstream->size = filesize;
                 ftstream->pos = 0;
                 ftstream->read = (FT_Stream_IoFunc) ReadTTFontFileFunc;
-                ftstream->close = (FT_Stream_CloseFunc) CloseTTFontFileFunc;
+                ftstream->close = NULL;
                 ftstream->pathname.pointer = (void *) scalerInfo;
 
                 memset(&ft_open_args, 0, sizeof(FT_Open_Args));
diff -r 80f2e59761dd -r f4a43a71c2ba src/share/native/sun/nio/ch/genSocketOptionRegistry.c
--- a/src/share/native/sun/nio/ch/genSocketOptionRegistry.c	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/share/native/sun/nio/ch/genSocketOptionRegistry.c	Mon Jul 06 11:59:12 2015 +0100
@@ -110,6 +110,7 @@
     emit_inet("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IP,     IP_MULTICAST_LOOP);
 
 #ifdef AF_INET6
+    emit_inet6("StandardSocketOptions.IP_TOS",            IPPROTO_IPV6,  IPV6_TCLASS);
     emit_inet6("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IPV6,  IPV6_MULTICAST_IF);
     emit_inet6("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IPV6,  IPV6_MULTICAST_HOPS);
     emit_inet6("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IPV6,  IPV6_MULTICAST_LOOP);
diff -r 80f2e59761dd -r f4a43a71c2ba src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java
--- a/src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java	Mon Jul 06 11:59:12 2015 +0100
@@ -85,6 +85,15 @@
                     if (val.charAt(0) == '#' || val.charAt(0) == ';') {
                         break;
                     }
+                    if ("nameserver".equals(keyword)) {
+                        if (val.indexOf(':') >= 0 &&
+                            val.indexOf('.') < 0 && // skip for IPv4 literals with port
+                            val.indexOf('[') < 0 &&
+                            val.indexOf(']') < 0 ) {
+                            // IPv6 literal, in non-BSD-style.
+                            val = "[" + val + "]";
+                        }
+                    }
                     ll.add(val);
                     if (--maxvalues == 0) {
                         break;
diff -r 80f2e59761dd -r f4a43a71c2ba src/solaris/native/java/net/net_util_md.c
--- a/src/solaris/native/java/net/net_util_md.c	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/solaris/native/java/net/net_util_md.c	Mon Jul 06 11:59:12 2015 +0100
@@ -1355,7 +1355,7 @@
      *    or sending UDP packet.
      * 2. IPv6 on Linux: By default Linux ignores flowinfo
      *    field so enable IPV6_FLOWINFO_SEND so that flowinfo
-     *    will be examined.
+     *    will be examined. We also set the IPv4 TOS option in this case.
      * 3. IPv4: set socket option based on ToS and Precedence
      *    fields (otherwise get invalid argument)
      */
@@ -1371,8 +1371,10 @@
 #if defined(AF_INET6) && defined(__linux__)
         if (ipv6_available()) {
             int optval = 1;
-            return setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND,
-                              (void *)&optval, sizeof(optval));
+            if (setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND,
+                           (void *)&optval, sizeof(optval)) < 0) {
+                return -1;
+            }
         }
 #endif
 
diff -r 80f2e59761dd -r f4a43a71c2ba src/solaris/native/sun/nio/ch/Net.c
--- a/src/solaris/native/sun/nio/ch/Net.c	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/solaris/native/sun/nio/ch/Net.c	Mon Jul 06 11:59:12 2015 +0100
@@ -441,7 +441,8 @@
 
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
-                                  jboolean mayNeedConversion, jint level, jint opt, jint arg)
+                                  jboolean mayNeedConversion, jint level,
+                                  jint opt, jint arg, jboolean isIPv6)
 {
     int result;
     struct linger linger;
@@ -484,6 +485,12 @@
                                      JNU_JAVANETPKG "SocketException",
                                      "sun.nio.ch.Net.setIntOption");
     }
+#ifdef __linux__
+    if (level == IPPROTO_IPV6 && opt == IPV6_TCLASS && isIPv6) {
+        // set the V4 option also
+        setsockopt(fdval(env, fdo), IPPROTO_IP, IP_TOS, parg, arglen);
+    }
+#endif
 }
 
 JNIEXPORT jint JNICALL
diff -r 80f2e59761dd -r f4a43a71c2ba src/windows/native/java/net/net_util_md.c
--- a/src/windows/native/java/net/net_util_md.c	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/windows/native/java/net/net_util_md.c	Mon Jul 06 11:59:12 2015 +0100
@@ -443,6 +443,13 @@
 {
     int rv;
 
+    if (level == IPPROTO_IPV6 && optname == IPV6_TCLASS) {
+        int *intopt = (int *)optval;
+        *intopt = 0;
+        *optlen = sizeof(*intopt);
+        return 0;
+    }
+
     rv = getsockopt(s, level, optname, optval, optlen);
 
 
diff -r 80f2e59761dd -r f4a43a71c2ba src/windows/native/sun/nio/ch/Net.c
--- a/src/windows/native/sun/nio/ch/Net.c	Tue Apr 14 21:40:47 2015 +0100
+++ b/src/windows/native/sun/nio/ch/Net.c	Mon Jul 06 11:59:12 2015 +0100
@@ -294,9 +294,9 @@
     /**
      * HACK: IP_TOS is deprecated on Windows and querying the option
      * returns a protocol error. NET_GetSockOpt handles this and uses
-     * a fallback mechanism.
+     * a fallback mechanism. Same applies to IPV6_TCLASS
      */
-    if (level == IPPROTO_IP && opt == IP_TOS) {
+    if ((level == IPPROTO_IP && opt == IP_TOS) || (level == IPPROTO_IPV6 && opt == IPV6_TCLASS)) {
         mayNeedConversion = JNI_TRUE;
     }
 
@@ -318,7 +318,7 @@
 
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
-                                  jboolean mayNeedConversion, jint level, jint opt, jint arg)
+                                  jboolean mayNeedConversion, jint level, jint opt, jint arg, jboolean ipv6)
 {
     struct linger linger;
     char *parg;
@@ -339,6 +339,11 @@
         arglen = sizeof(arg);
     }
 
+    if (level == IPPROTO_IPV6 && opt == IPV6_TCLASS) {
+        /* No op */
+        return;
+    }
+
     if (mayNeedConversion) {
         n = NET_SetSockOpt(fdval(env, fdo), level, opt, parg, arglen);
     } else {
diff -r 80f2e59761dd -r f4a43a71c2ba test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java	Mon Jul 06 11:59:12 2015 +0100
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2015, Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.NamingManager;
+
+import com.sun.jndi.dns.DnsContext;
+
+/**
+ * @test
+ * @bug 6991580
+ * @summary IPv6 Nameservers in resolv.conf throws NumberFormatException
+ * @run main/manual IPv6NameserverPlatformParsingTest
+ *
+ * In order to run this test be sure to place, for example, the following
+ * snippet into your platform's {@code /etc/resolv.conf}:
+ * <pre>
+ * nameserver 127.0.0.1
+ * nameserver 2001:4860:4860::8888
+ * nameserver [::1]:5353
+ * nameserver 127.0.0.1:5353
+ * </pre>
+ *


More information about the distro-pkg-dev mailing list