]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile on FreeBSD.
authorRoy Marples <roy@marples.name>
Fri, 17 Apr 2009 13:42:44 +0000 (13:42 +0000)
committerRoy Marples <roy@marples.name>
Fri, 17 Apr 2009 13:42:44 +0000 (13:42 +0000)
dhcpcd.c
net.c

index 82831873d3170a150509652d1d4d172b6c199951..b76538839cd541d683064704857b520b270c5ac7 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -28,6 +28,7 @@
 const char copyright[] = "Copyright (c) 2006-2009 Roy Marples";
 
 #include <sys/file.h>
+#include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/uio.h>
diff --git a/net.c b/net.c
index c3d154a0f42036e0908fc0209cc0fe34fd456f72..716911eb00515527c00532f57ab227a24af3619e 100644 (file)
--- a/net.c
+++ b/net.c
@@ -275,12 +275,14 @@ discover_interfaces(int argc, char * const *argv)
 #ifdef AF_LINK
                if (ifa->ifa_addr->sa_family != AF_LINK)
                        continue;
+#ifdef __NetBSD__
                /* 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;
+#endif
 #elif AF_PACKET
                if (ifa->ifa_addr->sa_family != AF_PACKET)
                        continue;
@@ -336,6 +338,9 @@ discover_interfaces(int argc, char * const *argv)
                                break;
                        }
                        ifp->hwlen = sdl->sdl_alen;
+#ifndef CLLADDR
+#  define CLLADDR(s) ((const char *)((s)->sdl_data + (s)->sdl_nlen))
+#endif
                        memcpy(ifp->hwaddr, CLLADDR(sdl), ifp->hwlen);
 #elif AF_PACKET
                        sll = (const struct sockaddr_ll *)(void *)ifa->ifa_addr;