diff options
-rw-r--r-- | agent/interfaces.c | 6 | ||||
-rw-r--r-- | meson.build | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/agent/interfaces.c b/agent/interfaces.c index 4cd988c..3590e0d 100644 --- a/agent/interfaces.c +++ b/agent/interfaces.c @@ -373,6 +373,7 @@ get_local_ips_ioctl (gboolean include_loopback) static guint get_local_if_index_by_addr_ioctl (NiceAddress *addr) { +#ifdef HAVE_IFR_IFINDEX gint sockfd; gint size = 0; struct ifreq *ifr; @@ -427,6 +428,11 @@ get_local_if_index_by_addr_ioctl (NiceAddress *addr) close (sockfd); return if_index; +#else + g_critical ("getifaddrs() should not fail on a platform that doesn't" + " include ifr_index in the struct ifreq. Please report the bug."); + return 0; +#endif } #ifdef HAVE_GETIFADDRS diff --git a/meson.build b/meson.build index 5904367..ad7ae6e 100644 --- a/meson.build +++ b/meson.build @@ -119,6 +119,10 @@ foreach f : ['poll', 'getifaddrs'] endif endforeach +if cc.has_member('struct ifreq', 'ifr_ifindex', prefix: '#include <net/if.h>') + cdata.set('HAVE_IFR_IFINDEX', 1) +endif + if cc.has_argument('-fno-strict-aliasing') add_project_arguments('-fno-strict-aliasing', language: 'c') endif |