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 <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2015-05-19 18:46:10 -07:00
parent e5cc509c34
commit d8dc52578c
2 changed files with 9 additions and 13 deletions

View File

@ -1218,6 +1218,12 @@ dnl ----------
AC_MSG_CHECKING(for GNU libc >= 2.1) AC_MSG_CHECKING(for GNU libc >= 2.1)
AC_DEFINE(HAVE_IPV6,1,Linux IPv6) AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack) 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, [ AC_EGREP_CPP(yes, [
#include <features.h> #include <features.h>

View File

@ -496,16 +496,6 @@ sockopt_cork (int sock, int onoff)
#endif #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 int
sockopt_minttl (int family, int sock, int minttl) sockopt_minttl (int family, int sock, int minttl)
{ {
@ -520,13 +510,13 @@ sockopt_minttl (int family, int sock, int minttl)
return ret; return ret;
} }
#endif /* IP_MINTTL */ #endif /* IP_MINTTL */
#ifdef IPV6_MINHOPCNT #ifdef IPV6_MINHOPCOUNT
if (family == AF_INET6) 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) if (ret < 0)
zlog (NULL, LOG_WARNING, 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)); minttl, sock, safe_strerror (errno));
return ret; return ret;
} }