changeset 1317:46c969507c18 draft

ifas without an ifa_addr seem to indicate a link without a hwaddr, so treat them as such. This allows static and 3rdparty configuration.
author Roy Marples <roy@marples.name>
date Mon, 11 May 2009 07:16:24 +0000
parents a21d1cd02a90
children 905ab2c2467e
files net.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/net.c	Sun May 10 23:31:55 2009 +0000
+++ b/net.c	Mon May 11 07:16:24 2009 +0000
@@ -272,15 +272,16 @@
 
 	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 @@
 				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) {