Added another attempt to detect GETIFADDRS availability, which is more common on newer OS

This commit is contained in:
ANR2ME 2022-01-29 05:41:22 +07:00
parent c37a58d39c
commit 171e2b5713

View File

@ -109,7 +109,8 @@ void DNSResolveFree(addrinfo *res)
bool GetIPList(std::vector<std::string> &IP4s) {
char ipstr[INET6_ADDRSTRLEN]; // We use IPv6 length since it's longer than IPv4
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || (__ANDROID_API__ >= 24) // getifaddrs first appeared in glibc 2.3, On Android officially supported since __ANDROID_API__ >= 24
// getifaddrs first appeared in glibc 2.3, On Android officially supported since __ANDROID_API__ >= 24
#if defined(_IFADDRS_H_) || (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || (__ANDROID_API__ >= 24)
INFO_LOG(SCENET, "GetIPList from getifaddrs");
struct ifaddrs* ifAddrStruct = NULL;
struct ifaddrs* ifa = NULL;