src/java.base/share/native/libnet/net_util.c
changeset 54627 22323f20401b
parent 51151 d6b131d2bc8b
child 59243 fb1d9bf1be2b
equal deleted inserted replaced
54626:3fb6efa2c9f1 54627:22323f20401b
    25 
    25 
    26 #include "net_util.h"
    26 #include "net_util.h"
    27 
    27 
    28 #include "java_net_InetAddress.h"
    28 #include "java_net_InetAddress.h"
    29 
    29 
       
    30 int IPv4_supported();
    30 int IPv6_supported();
    31 int IPv6_supported();
    31 int reuseport_supported();
    32 int reuseport_supported();
    32 
    33 
       
    34 static int IPv4_available;
    33 static int IPv6_available;
    35 static int IPv6_available;
    34 static int REUSEPORT_available;
    36 static int REUSEPORT_available;
       
    37 
       
    38 JNIEXPORT jint JNICALL ipv4_available()
       
    39 {
       
    40     return IPv4_available;
       
    41 }
    35 
    42 
    36 JNIEXPORT jint JNICALL ipv6_available()
    43 JNIEXPORT jint JNICALL ipv6_available()
    37 {
    44 {
    38     return IPv6_available;
    45     return IPv6_available;
    39 }
    46 }
    66     /*
    73     /*
    67      * Since we have initialized and loaded the socket library we will
    74      * Since we have initialized and loaded the socket library we will
    68      * check now whether we have IPv6 on this platform and if the
    75      * check now whether we have IPv6 on this platform and if the
    69      * supporting socket APIs are available
    76      * supporting socket APIs are available
    70      */
    77      */
       
    78     IPv4_available = IPv4_supported();
    71     IPv6_available = IPv6_supported() & (!preferIPv4Stack);
    79     IPv6_available = IPv6_supported() & (!preferIPv4Stack);
    72 
    80 
    73     /* check if SO_REUSEPORT is supported on this platform */
    81     /* check if SO_REUSEPORT is supported on this platform */
    74     REUSEPORT_available = reuseport_supported();
    82     REUSEPORT_available = reuseport_supported();
    75     platformInit();
    83     platformInit();