diff --git a/jdk/src/windows/native/java/net/net_util_md.c b/jdk/src/windows/native/java/net/net_util_md.c index f9a61bf5787..ae71733d8ad 100644 --- a/jdk/src/windows/native/java/net/net_util_md.c +++ b/jdk/src/windows/native/java/net/net_util_md.c @@ -443,6 +443,13 @@ NET_GetSockOpt(int s, int level, int optname, void *optval, { 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 --git a/jdk/src/windows/native/sun/nio/ch/Net.c b/jdk/src/windows/native/sun/nio/ch/Net.c index fc96ea206ae..fb0faa87b84 100644 --- a/jdk/src/windows/native/sun/nio/ch/Net.c +++ b/jdk/src/windows/native/sun/nio/ch/Net.c @@ -295,9 +295,9 @@ Java_sun_nio_ch_Net_getIntOption0(JNIEnv *env, jclass clazz, jobject fdo, /** * 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; } @@ -340,6 +340,11 @@ Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo, 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 {