mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8046500: GetIpAddrTable function failed on Pure Ipv6 environment
Reviewed-by: chegar
This commit is contained in:
parent
0126fdbef0
commit
4444bac1b1
2 changed files with 26 additions and 7 deletions
|
@ -202,8 +202,9 @@ int enumInterfaces(JNIEnv *env, netif **netifPP)
|
|||
|
||||
JNU_ThrowByName(env, "java/lang/Error",
|
||||
"IP Helper Library GetIfTable function failed");
|
||||
|
||||
return -1;
|
||||
// this different error code is to handle the case when we call
|
||||
// GetIpAddrTable in pure IPv6 environment
|
||||
return -2;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -400,7 +401,9 @@ int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP)
|
|||
}
|
||||
JNU_ThrowByName(env, "java/lang/Error",
|
||||
"IP Helper Library GetIpAddrTable function failed");
|
||||
return -1;
|
||||
// this different error code is to handle the case when we call
|
||||
// GetIpAddrTable in pure IPv6 environment
|
||||
return -2;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -557,7 +560,7 @@ jobject createNetworkInterface
|
|||
*/
|
||||
if (netaddrCount < 0) {
|
||||
netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
|
||||
if (netaddrCount == -1) {
|
||||
if (netaddrCount < 0) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,6 +253,10 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
|
|||
ret = enumInterfaces(env, netifPP);
|
||||
if (ret == -1) {
|
||||
return -1;
|
||||
} else if( ret == -2){
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
(*env)->ExceptionClear(env);
|
||||
}
|
||||
} else {
|
||||
count = ret;
|
||||
}
|
||||
|
@ -272,10 +276,16 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
|
|||
ret = enumAddresses_win(env, curr, &netaddrP);
|
||||
if (ret == -1) {
|
||||
return -1;
|
||||
} else if (ret == -2) {
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
(*env)->ExceptionClear(env);
|
||||
}
|
||||
break;
|
||||
} else{
|
||||
curr->addrs = netaddrP;
|
||||
curr->naddrs += ret;
|
||||
curr = curr->next;
|
||||
}
|
||||
curr->addrs = netaddrP;
|
||||
curr->naddrs += ret;
|
||||
curr = curr->next;
|
||||
}
|
||||
|
||||
ret = getAdapters (env, &adapters);
|
||||
|
@ -558,6 +568,12 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs)
|
|||
if (netaddrCount == -1) {
|
||||
return NULL;
|
||||
}
|
||||
if (netaddrCount == -2) {
|
||||
// Clear the exception and continue.
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
(*env)->ExceptionClear(env);
|
||||
}
|
||||
}
|
||||
netaddrP = netaddrPToFree;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue