From: Donald Sharp Date: Wed, 15 Aug 2018 19:06:53 +0000 (-0400) Subject: lib, ripngd, zebra: Remove pre-solaris 9 special cased code X-Git-Tag: frr-6.1-dev~62^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=adf0e7c6d710535951bbe23f96a186fa582a6074;p=matthieu%2Ffrr.git lib, ripngd, zebra: Remove pre-solaris 9 special cased code The CMSG_FIRSTHDR was broken on solaris pre version 9. Version 9 was released in May of 2002 and EOL'ed in 2014. Version 8 EOL'ed in 2012. Remove special case code for a little used platform that has not seen the light of day in a very long time. Signed-off-by: Donald Sharp --- diff --git a/configure.ac b/configure.ac index afebc66e08..8d18817bd2 100755 --- a/configure.ac +++ b/configure.ac @@ -1194,33 +1194,6 @@ case "$host_os" in esac AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ]) -dnl ------------------------------------ -dnl check for broken CMSG_FIRSTHDR macro -dnl ------------------------------------ -AC_MSG_CHECKING(for broken CMSG_FIRSTHDR) -AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#ifdef SUNOS_5 -#define _XPG4_2 -#define __EXTENSIONS__ -#endif -#include -#include -#include - -main() -{ - struct msghdr msg; - char buf[4]; - - msg.msg_control = buf; - msg.msg_controllen = 0; - - if (CMSG_FIRSTHDR(&msg) != NULL) - exit(0); - exit (1); -}]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)], -[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)]) - dnl --------------------------------------------------------------- dnl figure out how to specify an interface in multicast sockets API dnl --------------------------------------------------------------- diff --git a/lib/sockopt.c b/lib/sockopt.c index e979bef174..4ebc438157 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -73,7 +73,7 @@ static void *getsockopt_cmsg_data(struct msghdr *msgh, int level, int type) struct cmsghdr *cmsg; void *ptr = NULL; - for (cmsg = ZCMSG_FIRSTHDR(msgh); cmsg != NULL; + for (cmsg = CMSG_FIRSTHDR(msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(msgh, cmsg)) if (cmsg->cmsg_level == level && cmsg->cmsg_type == type) return (ptr = CMSG_DATA(cmsg)); diff --git a/lib/zebra.h b/lib/zebra.h index c2d135bbeb..b12f6616ba 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -242,23 +242,6 @@ size_t strlcpy(char *__restrict dest, const char *__restrict src, size_t destsize); #endif -#ifdef HAVE_BROKEN_CMSG_FIRSTHDR -/* This bug is present in Solaris 8 and pre-patch Solaris 9 ; - please refer to http://bugzilla.quagga.net/show_bug.cgi?id=142 */ - -/* Check that msg_controllen is large enough. */ -#define ZCMSG_FIRSTHDR(mhdr) \ - (((size_t)((mhdr)->msg_controllen) >= sizeof(struct cmsghdr)) \ - ? CMSG_FIRSTHDR(mhdr) \ - : (struct cmsghdr *)NULL) - -#warning "CMSG_FIRSTHDR is broken on this platform, using a workaround" - -#else /* HAVE_BROKEN_CMSG_FIRSTHDR */ -#define ZCMSG_FIRSTHDR(M) CMSG_FIRSTHDR(M) -#endif /* HAVE_BROKEN_CMSG_FIRSTHDR */ - - /* GCC have printf type attribute check. */ #ifdef __GNUC__ #define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b))) diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 565e151c53..f18b6d7910 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -246,7 +246,7 @@ static int ripng_recv_packet(int sock, uint8_t *buf, int bufsize, if (ret < 0) return ret; - for (cmsgptr = ZCMSG_FIRSTHDR(&msg); cmsgptr != NULL; + for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) { /* I want interface index which this packet comes from. */ if (cmsgptr->cmsg_level == IPPROTO_IPV6 diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 49ffcdd490..edc16c549a 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -123,7 +123,7 @@ static int rtadv_recv_packet(struct zebra_ns *zns, int sock, uint8_t *buf, if (ret < 0) return ret; - for (cmsgptr = ZCMSG_FIRSTHDR(&msg); cmsgptr != NULL; + for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) { /* I want interface index which this packet comes from. */ if (cmsgptr->cmsg_level == IPPROTO_IPV6 @@ -362,7 +362,7 @@ static void rtadv_send_packet(int sock, struct interface *ifp) iov.iov_base = buf; iov.iov_len = len; - cmsgptr = ZCMSG_FIRSTHDR(&msg); + cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); cmsgptr->cmsg_level = IPPROTO_IPV6; cmsgptr->cmsg_type = IPV6_PKTINFO;