]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile on FreeBSD
authorRoy Marples <roy@marples.name>
Wed, 22 May 2013 18:16:32 +0000 (18:16 +0000)
committerRoy Marples <roy@marples.name>
Wed, 22 May 2013 18:16:32 +0000 (18:16 +0000)
Document why we don't set IN6_IFF_TENTATIVE when adding addresses
and a possible error on FreeBSD.

if-bsd.c
net.c
net.h

index 81632a97a45ec0fb0f186615ee0e1e0f7ece2b6c..f7f0741fb3b272194cd5bcf632566a9f8694cb4a 100644 (file)
--- a/if-bsd.c
+++ b/if-bsd.c
@@ -311,7 +311,15 @@ if_address6(const struct interface *ifp, const struct ipv6_addr *a, int action)
                return -1;
        memset(&ifa, 0, sizeof(ifa));
        strlcpy(ifa.ifra_name, ifp->name, sizeof(ifa.ifra_name));
-       ifa.ifra_flags = IN6_IFF_TENTATIVE;
+       /*
+        * We should not set IN6_IFF_TENTATIVE as the kernel should be
+        * able to work out if it's a new address or not and set it accordingly
+        * although FreeBSD seems to be buggy here.
+        *
+        * We should set IN6_IFF_AUTOCONF, but the kernel won't let us.
+        * This is probably a safety measure, but still it's not entirely right
+        * either.
+        */
 #if 0
        if (a->autoconf)
                ifa.ifra_flags |= IN6_IFF_AUTOCONF;
diff --git a/net.c b/net.c
index ef5ab5d1cafbcff08b3d1b400a7a9236fc17f7a0..c090e05db5700ed1c6bcb4bcbc51c52816de396b 100644 (file)
--- a/net.c
+++ b/net.c
@@ -34,6 +34,7 @@
 #include <netinet/in.h>
 #ifdef AF_LINK
 #  include <net/if_dl.h>
+#  include <net/if_var.h>
 #  include <net/if_types.h>
 #  include <netinet/in_var.h>
 #endif
diff --git a/net.h b/net.h
index 3394ba1405f9ddf5389922f0796e05fcfb193d96..50c8f3c468250df05095900f2ef3855baef42d78 100644 (file)
--- a/net.h
+++ b/net.h
@@ -28,6 +28,8 @@
 #ifndef INTERFACE_H
 #define INTERFACE_H
 
+#include <sys/socket.h>
+
 #include <net/if.h>
 #include <netinet/in.h>
 #include <netinet/if_ether.h>