Get this compiling again on FreeBSD
authorEmil Mikulic <emikulic@gmail.com>
Tue, 1 Jun 2010 10:48:44 +0000 (20:48 +1000)
committerEmil Mikulic <emikulic@gmail.com>
Mon, 9 May 2011 12:40:22 +0000 (22:40 +1000)
acct.c
localip.c

diff --git a/acct.c b/acct.c
index ef6d514..a00e86f 100644 (file)
--- a/acct.c
+++ b/acct.c
@@ -28,6 +28,7 @@
 #include <arpa/inet.h> /* for inet_aton() */
 #define __FAVOR_BSD
 #include <netinet/tcp.h>
+#include <sys/socket.h>
 #include <stdlib.h> /* for free */
 #include <string.h> /* for memcpy */
 
index 96d5b87..622decf 100644 (file)
--- a/localip.c
+++ b/localip.c
@@ -13,6 +13,7 @@
 #include "err.h"
 #include "localip.h"
 
+#include <sys/socket.h>
 #include <net/if.h>
 #include <ifaddrs.h>
 #include <errno.h>
@@ -73,8 +74,13 @@ localip_update(void)
       if( ifa->ifa_addr->sa_family == AF_INET6 ) {
          struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *) ifa->ifa_addr;
 
+#ifdef __FreeBSD__
+         if( IN6_IS_ADDR_LINKLOCAL(&(sa6->sin6_addr))
+            || IN6_IS_ADDR_SITELOCAL(&(sa6->sin6_addr)) )
+#else
          if( IN6_IS_ADDR_LINKLOCAL(&(sa6->sin6_addr.s6_addr))
             || IN6_IS_ADDR_SITELOCAL(&(sa6->sin6_addr.s6_addr)) )
+#endif
             continue;
          else
             /* Only standard IPv6 can reach this point. */