From d8dc52578cdf12ce906f7d43f9d42c3c6b7c821e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 19 May 2015 18:46:10 -0700 Subject: [PATCH] bgpd-ttl-fix.patch BGP: Fix MINTTL and IPV6_MINHOPCOUNT The #defines for IP_MINTTL and IPV6_MINHOPCOUNT need to be handled correctly as part of the configure.ac code. Instead of hard coding the values directly in the code Signed-off-by: Donald Sharp --- configure.ac | 6 ++++++ lib/sockunion.c | 16 +++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 83820e4536..309604eb30 100755 --- a/configure.ac +++ b/configure.ac @@ -1218,6 +1218,12 @@ dnl ---------- AC_MSG_CHECKING(for GNU libc >= 2.1) AC_DEFINE(HAVE_IPV6,1,Linux IPv6) AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack) + dnl Linux has a compilation problem with mixing + dnl netinet/in.h and linux/in6.h they are not + dnl compatible. There has been discussion on + dnl how to fix it but no real progress on implementation + dnl when they fix it, remove this + AC_DEFINE(IPV6_MINHOPCOUNT, 73, Linux ipv6 Min Hop Count) AC_EGREP_CPP(yes, [ #include diff --git a/lib/sockunion.c b/lib/sockunion.c index a59bb77f38..efd41362c6 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -496,16 +496,6 @@ sockopt_cork (int sock, int onoff) #endif } -/* For some crazy reason, our build doesn't seem to pick this up */ -#ifdef GNU_LINUX -#ifndef IP_MINTTL -#define IP_MINTTL 21 -#endif -#ifndef IPV6_MINHOPCNT -#define IPV6_MINHOPCNT 73 -#endif -#endif - int sockopt_minttl (int family, int sock, int minttl) { @@ -520,13 +510,13 @@ sockopt_minttl (int family, int sock, int minttl) return ret; } #endif /* IP_MINTTL */ -#ifdef IPV6_MINHOPCNT +#ifdef IPV6_MINHOPCOUNT if (family == AF_INET6) { - int ret = setsockopt (sock, IPPROTO_IPV6, IPV6_MINHOPCNT, &minttl, sizeof(minttl)); + int ret = setsockopt (sock, IPPROTO_IPV6, IPV6_MINHOPCOUNT, &minttl, sizeof(minttl)); if (ret < 0) zlog (NULL, LOG_WARNING, - "can't set sockopt IPV6_MINHOPCNT to %d on socket %d: %s", + "can't set sockopt IPV6_MINHOPCOUNT to %d on socket %d: %s", minttl, sock, safe_strerror (errno)); return ret; } -- 2.39.5