Detect RTM_NEWNEIGH rather than force a define based on __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
#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>
#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>
# 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
#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>
#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)
}
}
-#ifdef HAVE_RTM_GETNEIGH
+#ifdef RTM_NEWNEIGH
void
ipv6nd_neighbour(struct dhcpcd_ctx *ctx, struct in6_addr *addr, int flags)
{
}
}
}
-
#else
-
static void
ipv6nd_checkreachablerouters(void *arg)
{
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);
/* 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);
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