|
|
|
@ -40,9 +40,15 @@ |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__APPLE__) |
|
|
|
|
|
|
|
#include <TargetConditionals.h> |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if (defined(__unix__) || defined(__APPLE__)) && !defined(__LINUX__) |
|
|
|
#if (defined(__unix__) || defined(__APPLE__)) && !defined(__LINUX__) |
|
|
|
#include <net/if.h> |
|
|
|
#include <net/if.h> |
|
|
|
|
|
|
|
#if !TARGET_OS_IPHONE |
|
|
|
#include <netinet6/in6_var.h> |
|
|
|
#include <netinet6/in6_var.h> |
|
|
|
|
|
|
|
#endif |
|
|
|
#include <sys/ioctl.h> |
|
|
|
#include <sys/ioctl.h> |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
@ -311,7 +317,7 @@ class Binder { |
|
|
|
if (! gotViaProc) { |
|
|
|
if (! gotViaProc) { |
|
|
|
struct ifaddrs* ifatbl = (struct ifaddrs*)0; |
|
|
|
struct ifaddrs* ifatbl = (struct ifaddrs*)0; |
|
|
|
struct ifaddrs* ifa; |
|
|
|
struct ifaddrs* ifa; |
|
|
|
#if (defined(__unix__) || defined(__APPLE__)) && !defined(__LINUX__) |
|
|
|
#if (defined(__unix__) && !defined(__LINUX__)) || (defined(__APPLE__) && !TARGET_OS_IPHONE) |
|
|
|
// set up an IPv6 socket so we can check the state of interfaces via SIOCGIFAFLAG_IN6
|
|
|
|
// set up an IPv6 socket so we can check the state of interfaces via SIOCGIFAFLAG_IN6
|
|
|
|
int infoSock = socket(AF_INET6, SOCK_DGRAM, 0); |
|
|
|
int infoSock = socket(AF_INET6, SOCK_DGRAM, 0); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
@ -320,7 +326,7 @@ class Binder { |
|
|
|
while (ifa) { |
|
|
|
while (ifa) { |
|
|
|
if ((ifa->ifa_name) && (ifa->ifa_addr)) { |
|
|
|
if ((ifa->ifa_name) && (ifa->ifa_addr)) { |
|
|
|
InetAddress ip = *(ifa->ifa_addr); |
|
|
|
InetAddress ip = *(ifa->ifa_addr); |
|
|
|
#if (defined(__unix__) || defined(__APPLE__)) && !defined(__LINUX__) |
|
|
|
#if (defined(__unix__) && !defined(__LINUX__)) || (defined(__APPLE__) && !TARGET_OS_IPHONE) |
|
|
|
// Check if the address is an IPv6 Temporary Address, macOS/BSD version
|
|
|
|
// Check if the address is an IPv6 Temporary Address, macOS/BSD version
|
|
|
|
if (ifa->ifa_addr->sa_family == AF_INET6) { |
|
|
|
if (ifa->ifa_addr->sa_family == AF_INET6) { |
|
|
|
struct sockaddr_in6* sa6 = (struct sockaddr_in6*)ifa->ifa_addr; |
|
|
|
struct sockaddr_in6* sa6 = (struct sockaddr_in6*)ifa->ifa_addr; |
|
|
|
@ -368,7 +374,7 @@ class Binder { |
|
|
|
else { |
|
|
|
else { |
|
|
|
interfacesEnumerated = false; |
|
|
|
interfacesEnumerated = false; |
|
|
|
} |
|
|
|
} |
|
|
|
#if (defined(__unix__) || defined(__APPLE__)) && !defined(__LINUX__) |
|
|
|
#if (defined(__unix__) && !defined(__LINUX__)) || (defined(__APPLE__) && !TARGET_OS_IPHONE) |
|
|
|
close(infoSock); |
|
|
|
close(infoSock); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|