From: Roy Marples Date: Fri, 17 Apr 2009 13:31:41 +0000 (+0000) Subject: Fix compile on NetBSD X-Git-Tag: v5.0.0~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d5fe47f4534167fc51dffdcd2a50490dfb7c5de;p=thirdparty%2Fdhcpcd.git Fix compile on NetBSD --- diff --git a/if-bsd.c b/if-bsd.c index 43170bd7..7517e714 100644 --- a/if-bsd.c +++ b/if-bsd.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #ifdef __DragonFly__ diff --git a/net.c b/net.c index 062002e1..c3d154a0 100644 --- a/net.c +++ b/net.c @@ -34,6 +34,10 @@ #include #include #include +#ifdef AF_LINK +# include +# include +#endif #include #include #include @@ -271,6 +275,12 @@ discover_interfaces(int argc, char * const *argv) #ifdef AF_LINK if (ifa->ifa_addr->sa_family != AF_LINK) continue; + /* FIXME: Why do I get 2 AF_LINK addresses per interface? */ + for (ifp = ifs; ifp; ifp = ifp->next) + if (strcmp(ifp->name, ifa->ifa_name) == 0) + break; + if (ifp) + continue; #elif AF_PACKET if (ifa->ifa_addr->sa_family != AF_PACKET) continue; @@ -326,7 +336,7 @@ discover_interfaces(int argc, char * const *argv) break; } ifp->hwlen = sdl->sdl_alen; - memcpy(ifp->hwaddr, LLADDR(sdl), ifp->hwlen); + memcpy(ifp->hwaddr, CLLADDR(sdl), ifp->hwlen); #elif AF_PACKET sll = (const struct sockaddr_ll *)(void *)ifa->ifa_addr; ifp->family = sll->sll_hatype; @@ -364,8 +374,12 @@ do_address(const char *ifname, a = (const struct sockaddr_in *)(void *)&ifa->ifa_addr; n = (const struct sockaddr_in *)(void *)&ifa->ifa_netmask; if (ifa->ifa_flags & IFF_POINTOPOINT) - d = (const struct sockaddr_in *) - (void *)&ifa->ifa_ifu.ifu_dstaddr; + d = (const struct sockaddr_in *)(void *) +#ifdef __linux__ + &ifa->ifa_ifu.ifu_dstaddr; +#else + &ifa->ifa_dstaddr; +#endif else d = NULL; if (act == 1) {