summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-04-17 13:42:44 +0000
committerRoy Marples <roy@marples.name>2009-04-17 13:42:44 +0000
commit47681a7058d5f9a4235aa42fd509d2c6cd196fb6 (patch)
tree440adfac8002fdba52ce265da2eecbc8125db9bb
parent9d5fe47f4534167fc51dffdcd2a50490dfb7c5de (diff)
downloaddhcpcd-47681a7058d5f9a4235aa42fd509d2c6cd196fb6.tar.xz
Fix compile on FreeBSD.
-rw-r--r--dhcpcd.c1
-rw-r--r--net.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index 82831873..b7653883 100644
--- 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 c3d154a0..716911eb 100644
--- 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;