Skip to content
Merged
Prev Previous commit
Next Next commit
Remove check for ifaddrs.h
  • Loading branch information
simonrozsival committed Sep 30, 2022
commit 510dd98a92c3f513f266fd5475af526049a39a9a
3 changes: 0 additions & 3 deletions src/mono/cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,6 @@
/* Have getifaddrs */
#cmakedefine HAVE_GETIFADDRS 1

/* Have struct ifaddrs */
#cmakedefine HAVE_IFADDRS 1

/* Have access */
#cmakedefine HAVE_ACCESS 1

Expand Down
1 change: 0 additions & 1 deletion src/native/libs/Common/pal_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#cmakedefine01 HAVE_F_FULLFSYNC
#cmakedefine01 HAVE_O_CLOEXEC
#cmakedefine01 HAVE_GETIFADDRS
#cmakedefine01 HAVE_IFADDRS
#cmakedefine01 HAVE_UTSNAME_DOMAINNAME
#cmakedefine01 HAVE_STAT64
#cmakedefine01 HAVE_FORK
Expand Down
24 changes: 0 additions & 24 deletions src/native/libs/System.Native/pal_interfaceaddresses.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <assert.h>
#if HAVE_IFADDRS || HAVE_GETIFADDRS
#include <ifaddrs.h>
#endif
#if !HAVE_GETIFADDRS && TARGET_ANDROID
#include <dlfcn.h>
#include <pthread.h>
Expand Down Expand Up @@ -101,26 +99,6 @@ static inline uint8_t mask2prefix(uint8_t* mask, int length)
return len;
}

#if !HAVE_IFADDRS && TARGET_ANDROID
// This structure is exactly the same as struct ifaddrs defined in ifaddrs.h but since the header
// might not be available (e.g., in bionic used in Android before API 24) we need to mirror it here
// so that we can dynamically load the getifaddrs function and use it.
struct ifaddrs
{
struct ifaddrs *ifa_next;
char *ifa_name;
unsigned int ifa_flags;
struct sockaddr *ifa_addr;
struct sockaddr *ifa_netmask;
union
{
struct sockaddr *ifu_broadaddr;
struct sockaddr *ifu_dstaddr;
} ifa_ifu;
void *ifa_data;
};
#endif

#if !HAVE_GETIFADDRS && TARGET_ANDROID
// Try to load the getifaddrs and freeifaddrs functions manually.
// This workaround is necessary on Android prior to API 24 and it can be removed once
Expand Down Expand Up @@ -152,7 +130,6 @@ int32_t SystemNative_EnumerateInterfaceAddresses(void* context,
LinkLayerAddressFound onLinkLayerFound)
{
#if !HAVE_GETIFADDRS && TARGET_ANDROID
// Workaround for Android API < 24
if (!ensure_getifaddrs_is_loaded())
{
errno = ENOTSUP;
Expand Down Expand Up @@ -306,7 +283,6 @@ int32_t SystemNative_EnumerateInterfaceAddresses(void* context,
int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInterfaceInfo **interfaceList, int32_t * addressCount, IpAddressInfo **addressList )
{
#if !HAVE_GETIFADDRS && TARGET_ANDROID
// Workaround for Android API < 24
if (!ensure_getifaddrs_is_loaded())
{
errno = ENOTSUP;
Expand Down
12 changes: 0 additions & 12 deletions src/native/libs/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,6 @@ check_c_source_compiles(
"
HAVE_FLOCK64)

check_c_source_compiles(
"
#include <sys/types.h>
#include <ifaddrs.h>
int main(void)
{
struct ifaddrs ia;
return 0;
}
"
HAVE_IFADDRS)

check_symbol_exists(
O_CLOEXEC
fcntl.h
Expand Down