From: Roy Marples Date: Mon, 11 May 2009 07:16:24 +0000 (+0000) Subject: ifas without an ifa_addr seem to indicate a link without a hwaddr, so X-Git-Tag: v5.0.3~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e160bfa43fe21e9d2c07ae3cabe4dde341939c8;p=thirdparty%2Fdhcpcd.git ifas without an ifa_addr seem to indicate a link without a hwaddr, so treat them as such. This allows static and 3rdparty configuration. --- diff --git a/net.c b/net.c index c4e5f155..d917b271 100644 --- a/net.c +++ b/net.c @@ -272,15 +272,16 @@ discover_interfaces(int argc, char * const *argv) ifs = ifl = NULL; for (ifa = ifaddrs; ifa; ifa = ifa->ifa_next) { - if (ifa->ifa_addr == NULL) - continue; + if (ifa->ifa_addr != NULL) { #ifdef AF_LINK - if (ifa->ifa_addr->sa_family != AF_LINK) - continue; + if (ifa->ifa_addr->sa_family != AF_LINK) + continue; #elif AF_PACKET - if (ifa->ifa_addr->sa_family != AF_PACKET) - continue; + if (ifa->ifa_addr->sa_family != AF_PACKET) + continue; #endif + } + /* It's possible for an interface to have >1 AF_LINK. * For our purposes, we use the first one. */ for (ifp = ifs; ifp; ifp = ifp->next) @@ -327,7 +328,7 @@ discover_interfaces(int argc, char * const *argv) free_interface(ifp); continue; } - } else { + } else if (ifa->ifa_addr != NULL) { #ifdef AF_LINK sdl = (const struct sockaddr_dl *)(void *)ifa->ifa_addr; switch(sdl->sdl_type) {