(original) (raw)
diff --git src/solaris/native/java/net/Inet4AddressImpl.c src/solaris/native/java/net/Inet4AddressImpl.c index 9a5b78e..d859cdc 100644 --- src/solaris/native/java/net/Inet4AddressImpl.c +++ src/solaris/native/java/net/Inet4AddressImpl.c @@ -391,10 +391,10 @@ ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout, sizeof(struct sockaddr)); if (n < 0 && errno != EINPROGRESS ) { #ifdef __linux__ - if (errno != EINVAL) + if (errno != EINVAL && errno != EHOSTUNREACH) /* * On some Linuxes, when bound to the loopback interface, sendto - * will fail and errno will be set to EINVAL. When that happens, + * will fail and errno will be set to EINVAL or EHOSTUNREACH. When that happens, * don't throw an exception, just return false. */ #endif /*__linux__ */ @@ -549,9 +549,10 @@ Java_java_net_Inet4AddressImpl_isReachable0(JNIEnv *env, jobject this, case EADDRNOTAVAIL: /* address is not available on the remote machine */ #ifdef __linux__ case EINVAL: + case EHOSTUNREACH: /* * On some Linuxes, when bound to the loopback interface, connect - * will fail and errno will be set to EINVAL. When that happens, + * will fail and errno will be set to EINVAL or EHOSTUNREACH. When that happens, * don't throw an exception, just return false. */ #endif /* __linux__ */ diff --git src/solaris/native/java/net/Inet6AddressImpl.c src/solaris/native/java/net/Inet6AddressImpl.c index bb5bae7..0ab5a3b 100644 --- src/solaris/native/java/net/Inet6AddressImpl.c +++ src/solaris/native/java/net/Inet6AddressImpl.c @@ -509,10 +509,10 @@ ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout, n = sendto(fd, sendbuf, plen, 0, (struct sockaddr*) him, sizeof(struct sockaddr_in6)); if (n < 0 && errno != EINPROGRESS) { #ifdef __linux__ - if (errno != EINVAL) + if (errno != EINVAL && errno != EHOSTUNREACH) /* * On some Linuxes, when bound to the loopback interface, sendto - * will fail and errno will be set to EINVAL. When that happens, + * will fail and errno will be set to EINVAL or EHOSTUNREACH. When that happens, * don't throw an exception, just return false. */ #endif /*__linux__ */ @@ -677,9 +677,10 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this, case EADDRNOTAVAIL: /* address is not available on the remote machine */ #ifdef __linux__ case EINVAL: + case EHOSTUNREACH: /* * On some Linuxes, when bound to the loopback interface, connect - * will fail and errno will be set to EINVAL. When that happens, + * will fail and errno will be set to EINVAL or EHOSTUNREACH. When that happens, * don't throw an exception, just return false. */ #endif /* __linux__ */