提交 dbd2622f 编写于 作者: M michaelm

8048212: Two tests failed with "java.net.SocketException: Bad protocol option"...

8048212: Two tests failed with "java.net.SocketException: Bad protocol option" on Windows after 8029607
Reviewed-by: alanb
上级 e80a5178
...@@ -443,6 +443,13 @@ NET_GetSockOpt(int s, int level, int optname, void *optval, ...@@ -443,6 +443,13 @@ NET_GetSockOpt(int s, int level, int optname, void *optval,
{ {
int rv; 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); rv = getsockopt(s, level, optname, optval, optlen);
......
...@@ -295,9 +295,9 @@ Java_sun_nio_ch_Net_getIntOption0(JNIEnv *env, jclass clazz, jobject fdo, ...@@ -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 * HACK: IP_TOS is deprecated on Windows and querying the option
* returns a protocol error. NET_GetSockOpt handles this and uses * 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; mayNeedConversion = JNI_TRUE;
} }
...@@ -340,6 +340,11 @@ Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo, ...@@ -340,6 +340,11 @@ Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
arglen = sizeof(arg); arglen = sizeof(arg);
} }
if (level == IPPROTO_IPV6 && opt == IPV6_TCLASS) {
/* No op */
return;
}
if (mayNeedConversion) { if (mayNeedConversion) {
n = NET_SetSockOpt(fdval(env, fdo), level, opt, parg, arglen); n = NET_SetSockOpt(fdval(env, fdo), level, opt, parg, arglen);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册