8222562: Don't set IPV6_V6ONLY when IPv4 is not available

Reviewed-by: dfuchs, chegar
This commit is contained in:
Arthur Eubanks 2019-04-16 13:16:49 -07:00 committed by Arthur Eubanks
parent 6f8821cadc
commit 0465104af6
7 changed files with 37 additions and 6 deletions

View file

@ -27,12 +27,19 @@
#include "java_net_InetAddress.h"
int IPv4_supported();
int IPv6_supported();
int reuseport_supported();
static int IPv4_available;
static int IPv6_available;
static int REUSEPORT_available;
JNIEXPORT jint JNICALL ipv4_available()
{
return IPv4_available;
}
JNIEXPORT jint JNICALL ipv6_available()
{
return IPv6_available;
@ -68,6 +75,7 @@ DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
* check now whether we have IPv6 on this platform and if the
* supporting socket APIs are available
*/
IPv4_available = IPv4_supported();
IPv6_available = IPv6_supported() & (!preferIPv4Stack);
/* check if SO_REUSEPORT is supported on this platform */

View file

@ -126,6 +126,7 @@ void NET_ThrowCurrent(JNIEnv *env, char *msg);
jfieldID NET_GetFileDescriptorID(JNIEnv *env);
JNIEXPORT jint JNICALL ipv4_available();
JNIEXPORT jint JNICALL ipv6_available();
JNIEXPORT jint JNICALL reuseport_available();