8196224: Even better Internet address support

Reviewed-by: chegar, rriggs, rhalade, vtewari
This commit is contained in:
Ivan Gerasimov 2018-02-05 14:18:22 -08:00
parent d68506157a
commit 3a7104760a
2 changed files with 12 additions and 8 deletions

View file

@ -1017,6 +1017,7 @@ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject val
struct in_addr in;
jobjectArray addrArray;
jsize len;
jint family;
jobject addr;
int i;
@ -1047,8 +1048,9 @@ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject val
in.s_addr = 0;
for (i = 0; i < len; i++) {
addr = (*env)->GetObjectArrayElement(env, addrArray, i);
if (getInetAddress_family(env, addr) == java_net_InetAddress_IPv4) {
JNU_CHECK_EXCEPTION(env);
family = getInetAddress_family(env, addr);
JNU_CHECK_EXCEPTION(env);
if (family == java_net_InetAddress_IPv4) {
in.s_addr = htonl(getInetAddress_addr(env, addr));
JNU_CHECK_EXCEPTION(env);
break;
@ -1896,6 +1898,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
jint fd;
jint family;
jint ipv6_join_leave;
if (IS_NULL(fdObj)) {
@ -1916,8 +1919,9 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
ipv6_join_leave = ipv6_available();
#ifdef __linux__
if (getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4) {
JNU_CHECK_EXCEPTION(env);
family = getInetAddress_family(env, iaObj);
JNU_CHECK_EXCEPTION(env);
if (family == java_net_InetAddress_IPv4) {
ipv6_join_leave = JNI_FALSE;
}
#endif