]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Include linux/rtnetlink.h in config.h rather than each file that needs it.
authorRoy Marples <roy@marples.name>
Wed, 10 Dec 2014 22:42:12 +0000 (22:42 +0000)
committerRoy Marples <roy@marples.name>
Wed, 10 Dec 2014 22:42:12 +0000 (22:42 +0000)
Detect RTM_NEWNEIGH rather than force a define based on __linux__.

configure
dhcp.c
if.c
if.h
ipv4.c
ipv6.c
ipv6nd.c
ipv6nd.h

index fc62a5b6faf198d01336503fe97463faf735bb74..f250d0181e7340b4bea63cca4fd0fa021e80e2a6 100755 (executable)
--- a/configure
+++ b/configure
@@ -366,6 +366,9 @@ linux*)
        # glibc-2.20
        echo "CPPFLAGS+=        -D_DEFAULT_SOURCE" >>$CONFIG_MK
        echo "DHCPCD_SRCS+=     if-linux.c" >>$CONFIG_MK
+       # for RTM_NEWADDR and friends
+       echo "#include <asm/types.h> /* fix broken headers */" >>$CONFIG_H
+       echo "#include <linux/rtnetlink.h>" >>$CONFIG_H
        ;;
 kfreebsd*)
        echo "CPPFLAGS+=        -D_GNU_SOURCE" >>$CONFIG_MK
diff --git a/dhcp.c b/dhcp.c
index b9a6fb1e90dcc8ee3796b798577e782db876ae26..4fd3294b61e66c06f05b197547a36e4e8074ff70 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
 #include <sys/socket.h>
 #include <sys/stat.h>
 
-#ifdef __linux__
-#  include <asm/types.h> /* for systems with broken headers */
-#  include <linux/rtnetlink.h>
-#endif
-
 #include <arpa/inet.h>
 #include <net/if.h>
 #include <net/route.h>
diff --git a/if.c b/if.c
index 315f8b765b4c3a230c1f355c4468f3683111919c..419064471a40704bd70b70bb668b58caab75f9ef 100644 (file)
--- a/if.c
+++ b/if.c
 #ifdef SIOCGIFMEDIA
 #  include <net/if_media.h>
 #endif
-
 #include <net/route.h>
-#ifdef __linux__
-#  include <asm/types.h> /* for systems with broken headers */
-#  include <linux/rtnetlink.h>
-#endif
 
 #include <ctype.h>
 #include <errno.h>
diff --git a/if.h b/if.h
index f657f52cee833c14da88dbdfb43406a75811137b..4f874cb41baad492f3dcc35d4773c5c3adb4f815 100644 (file)
--- a/if.h
+++ b/if.h
 # endif
 #endif
 
-/* Neighbour reachability and router updates */
-#ifndef HAVE_RTM_GETNEIGH
-# ifdef __linux__
-#  define HAVE_RTM_GETNEIGH
-# endif
-#endif
-
 #define EUI64_ADDR_LEN                 8
 #define INFINIBAND_ADDR_LEN            20
 
diff --git a/ipv4.c b/ipv4.c
index c87dec44ccc837529b514f7e43f526a89b990328..0d3c74f3a33a5ddd63bf73f5a3c3165ff06b0bdc 100644 (file)
--- a/ipv4.c
+++ b/ipv4.c
 #include <arpa/inet.h>
 #include <net/route.h>
 
-#ifdef __linux__
-#  include <asm/types.h> /* for systems with broken headers */
-#  include <linux/rtnetlink.h>
-#endif
-
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
diff --git a/ipv6.c b/ipv6.c
index 08a0972d6ca06bd1b7bb69c1435eb98c120ddb6a..e66bddd8052addb03d1f7e95bd04d76771acc7ef 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -36,8 +36,6 @@
 #include <netinet/if_ether.h>
 
 #ifdef __linux__
-#  include <asm/types.h> /* for systems with broken headers */
-#  include <linux/rtnetlink.h>
    /* Match Linux defines to BSD */
 #  ifdef IFA_F_OPTIMISTIC
 #    define IN6_IFF_TENTATIVE  (IFA_F_TENTATIVE | IFA_F_OPTIMISTIC)
index 56a7a4b36f2b7452d1773818bb8c299b550900f6..ea6f0db72fef1b57cd630c753dd799355bc1cf17 100644 (file)
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -343,7 +343,7 @@ ipv6nd_reachable(struct ra *rap, int flags)
        }
 }
 
-#ifdef HAVE_RTM_GETNEIGH
+#ifdef RTM_NEWNEIGH
 void
 ipv6nd_neighbour(struct dhcpcd_ctx *ctx, struct in6_addr *addr, int flags)
 {
@@ -358,9 +358,7 @@ ipv6nd_neighbour(struct dhcpcd_ctx *ctx, struct in6_addr *addr, int flags)
                }
        }
 }
-
 #else
-
 static void
 ipv6nd_checkreachablerouters(void *arg)
 {
@@ -431,7 +429,7 @@ void ipv6nd_freedrop_ra(struct ra *rap, int drop)
        eloop_timeout_delete(rap->iface->ctx->eloop, NULL, rap);
        if (!drop)
                TAILQ_REMOVE(rap->iface->ctx->ipv6->ra_routers, rap, next);
-#ifndef HAVE_RTM_GETNEIGH
+#ifndef RTM_NEWNEIGH
        if (TAILQ_FIRST(rap->iface->ctx->ipv6->ra_routers) == NULL)
                eloop_timeout_delete(rap->iface->ctx->eloop,
                    ipv6nd_checkreachablerouters, rap->iface->ctx);
@@ -1128,7 +1126,7 @@ nodhcp6:
        /* Expire should be called last as the rap object could be destroyed */
        ipv6nd_expirera(ifp);
 
-#ifndef HAVE_RTM_GETNEIGH
+#ifndef RTM_NEWNEIGH
        /* Start our reachability tests now */
        eloop_timeout_add_sec(ifp->ctx->eloop, ND6REACHABLE_TIMER,
            ipv6nd_checkreachablerouters, ifp->ctx);
index 7538f3609a075a0f0cd6f9abf98838b3457378ed..a3c9a2838f194bced297e776dca8691a387ef6ac 100644 (file)
--- a/ipv6nd.h
+++ b/ipv6nd.h
@@ -98,7 +98,7 @@ void ipv6nd_handleifa(struct dhcpcd_ctx *, int,
 int ipv6nd_dadcompleted(const struct interface *);
 void ipv6nd_drop(struct interface *);
 
-#ifdef HAVE_RTM_GETNEIGH
+#ifdef RTM_NEWNEIGH
 void ipv6nd_neighbour(struct dhcpcd_ctx *, struct in6_addr *, int);
 #endif
 #else