From: Roy Marples Date: Wed, 10 Dec 2014 22:42:12 +0000 (+0000) Subject: Include linux/rtnetlink.h in config.h rather than each file that needs it. X-Git-Tag: v6.6.6~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6c54d9e963f256ccb1c071d74a2d8d7ec3adb66;p=thirdparty%2Fdhcpcd.git Include linux/rtnetlink.h in config.h rather than each file that needs it. Detect RTM_NEWNEIGH rather than force a define based on __linux__. --- diff --git a/configure b/configure index fc62a5b6..f250d018 100755 --- 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 /* fix broken headers */" >>$CONFIG_H + echo "#include " >>$CONFIG_H ;; kfreebsd*) echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK diff --git a/dhcp.c b/dhcp.c index b9a6fb1e..4fd3294b 100644 --- a/dhcp.c +++ b/dhcp.c @@ -29,11 +29,6 @@ #include #include -#ifdef __linux__ -# include /* for systems with broken headers */ -# include -#endif - #include #include #include diff --git a/if.c b/if.c index 315f8b76..41906447 100644 --- a/if.c +++ b/if.c @@ -47,12 +47,7 @@ #ifdef SIOCGIFMEDIA # include #endif - #include -#ifdef __linux__ -# include /* for systems with broken headers */ -# include -#endif #include #include diff --git a/if.h b/if.h index f657f52c..4f874cb4 100644 --- a/if.h +++ b/if.h @@ -48,13 +48,6 @@ # 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 c87dec44..0d3c74f3 100644 --- a/ipv4.c +++ b/ipv4.c @@ -32,11 +32,6 @@ #include #include -#ifdef __linux__ -# include /* for systems with broken headers */ -# include -#endif - #include #include #include diff --git a/ipv6.c b/ipv6.c index 08a0972d..e66bddd8 100644 --- a/ipv6.c +++ b/ipv6.c @@ -36,8 +36,6 @@ #include #ifdef __linux__ -# include /* for systems with broken headers */ -# include /* Match Linux defines to BSD */ # ifdef IFA_F_OPTIMISTIC # define IN6_IFF_TENTATIVE (IFA_F_TENTATIVE | IFA_F_OPTIMISTIC) diff --git a/ipv6nd.c b/ipv6nd.c index 56a7a4b3..ea6f0db7 100644 --- 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); diff --git a/ipv6nd.h b/ipv6nd.h index 7538f360..a3c9a283 100644 --- 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