Commit 37f1e243 authored by Klemens Nanni's avatar Klemens Nanni Committed by Olivier Crête

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.
parent f4e2838f
......@@ -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;
}
......
......@@ -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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment