diff options
| author | Roy Marples <roy@marples.name> | 2009-05-11 07:16:24 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-05-11 07:16:24 +0000 |
| commit | 9e160bfa43fe21e9d2c07ae3cabe4dde341939c8 (patch) | |
| tree | 01cf6be78a118ba69272e00728849d8fd1c10061 /net.c | |
| parent | 7cbab2cf9b5fac8cf805bd9f4491d73cd5529671 (diff) | |
| download | dhcpcd-9e160bfa43fe21e9d2c07ae3cabe4dde341939c8.tar.xz | |
ifas without an ifa_addr seem to indicate a link without a hwaddr, so
treat them as such. This allows static and 3rdparty configuration.
Diffstat (limited to 'net.c')
| -rw-r--r-- | net.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -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) { |
