]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
ifas without an ifa_addr seem to indicate a link without a hwaddr, so
authorRoy Marples <roy@marples.name>
Mon, 11 May 2009 07:16:24 +0000 (07:16 +0000)
committerRoy Marples <roy@marples.name>
Mon, 11 May 2009 07:16:24 +0000 (07:16 +0000)
treat them as such. This allows static and 3rdparty configuration.

net.c

diff --git a/net.c b/net.c
index c4e5f155d2a290dcab7d2c6f1b73d4cb28205fbf..d917b271d326bd1298131717f1a504786c873e66 100644 (file)
--- 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) {