Prevent segfault for interfaces with no address

This commit is contained in:
Jeremy Lakeman 2012-11-01 14:00:18 +10:30
parent b4b256a5ea
commit 780daa3aa4

3
lsif.c
View File

@ -191,6 +191,9 @@ doifaddrs(void) {
return WHY_perror("getifaddr()");
for (ifa = ifaddr; ifa != NULL ; ifa = ifa->ifa_next) {
if (!ifa->ifa_addr || !ifa->ifa_netmask)
continue;
/* We're only interested in IPv4 addresses */
if (ifa->ifa_addr->sa_family != AF_INET) {
if (debug & DEBUG_OVERLAYINTERFACES) DEBUGF("Skipping non-AF_INET address on %s", ifa->ifa_name);