netmask returned by getifaddrs may not have address family set on macOS
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
c72964027e
commit
27bf91fae6
1 changed files with 5 additions and 0 deletions
|
@ -43,6 +43,11 @@ copyaddr(os_ifaddrs_t **ifap, const struct ifaddrs *sys_ifa)
|
|||
{
|
||||
err = errno;
|
||||
}
|
||||
/* Seen on macOS using OpenVPN: netmask without an address family,
|
||||
in which case copy it from the interface address */
|
||||
if (ifa->addr && ifa->netmask && ifa->netmask->sa_family == 0) {
|
||||
ifa->netmask->sa_family = ifa->addr->sa_family;
|
||||
}
|
||||
}
|
||||
|
||||
if (err == 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue