diff options
author | Klemens Nanni <klemens@posteo.de> | 2023-01-07 22:35:28 +0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2023-01-09 18:27:52 +0000 |
commit | 37f1e243b4814e12a7a1a0f2302012fb6ae5b36c (patch) | |
tree | 6be676f96b6f0a0104dfd02d83c0a662ee5b5c6f | |
parent | f4e2838f664f4007838f4c635d7a4fe653aae68b (diff) | |
download | libnice-37f1e243b4814e12a7a1a0f2302012fb6ae5b36c.tar.gz |
Use ifr_index to fix build on OpenBSD
`struct ifreq` from `<net/if.h>` has no `ifr_ifindex` on OpenBSD.
The canonical member access macro in all BSDs is
```
#define ifr_index ifr_ifru.ifru_index /* interface index */
```
The existing `g_critical()` message already uses the correct name, so
rectify the rest.
FreeBSD has `ifr_ifindex` in what appears to be linux-compat code.
Found by updating libnice from 0.1.19 to 0.1.20 on OpenBSD/amd64 -current.
-rw-r--r-- | agent/interfaces.c | 6 | ||||
-rw-r--r-- | meson.build | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/agent/interfaces.c b/agent/interfaces.c index 30944f5..9133b2c 100644 --- a/agent/interfaces.c +++ b/agent/interfaces.c @@ -373,7 +373,7 @@ get_local_ips_ioctl (gboolean include_loopback) static guint get_local_if_index_by_addr_ioctl (NiceAddress *addr) { -#ifdef HAVE_IFR_IFINDEX +#ifdef HAVE_IFR_INDEX gint sockfd; gint size = 0; struct ifreq *ifr; @@ -417,10 +417,10 @@ get_local_if_index_by_addr_ioctl (NiceAddress *addr) if (!nice_address_equal_no_port (myaddr, addr)) continue; - if (ifr->ifr_ifindex == 0) + if (ifr->ifr_index == 0) continue; - if_index = ifr->ifr_ifindex; + if_index = ifr->ifr_index; break; } diff --git a/meson.build b/meson.build index 5c46425..c644024 100644 --- a/meson.build +++ b/meson.build @@ -119,8 +119,8 @@ 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) +if cc.has_member('struct ifreq', 'ifr_index', prefix: '#include <net/if.h>') + cdata.set('HAVE_IFR_INDEX', 1) endif if cc.has_argument('-fno-strict-aliasing') |