8048212: Two tests failed with "java.net.SocketException: Bad protocol option" on Windows after 8029607
Reviewed-by: alanb
This commit is contained in:
parent
f7d6809219
commit
c5665a7027
@ -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);
|
||||
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user