summaryrefslogtreecommitdiff
path: root/lib/zebra.h
diff options
context:
space:
mode:
authorajs <ajs>2005-01-04 16:24:43 +0000
committerajs <ajs>2005-01-04 16:24:43 +0000
commitb99760ab51abf8c4c9a1f89dab0c1630a6768ff7 (patch)
treedaaf8cabb567c5ff1a01368fa1382d8257b56854 /lib/zebra.h
parent73a7dea305b146febb8e57176295689d6a900f1d (diff)
2005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* configure.ac: Added test for broken CMSG_FIRSTHDR macro (relevant for Solaris 8 and unpatched Solaris 9, don't know whether other platforms are affected). * zebra.h: Define ZCMSG_FIRSTHDR appropriately based on whether config.h indicates HAVE_BROKEN_CMSG_FIRSTHDR (as determined by the configure test program). * sockopt.c: (getsockopt_cmsg_data) Use ZCMSG_FIRSTHDR instead of CMSG_FIRSTHDR. * rtadv.c: (rtadv_recv_packet,rtadv_send_packet) Use ZCMSG_FIRSTHDR instead of CMSG_FIRSTHDR. * ripd.c: (rip_recvmsg) Use ZCMSG_FIRSTHDR instead of CMSG_FIRSTHDR. * ripngd.c: (ripng_recv_packet) Use ZCMSG_FIRSTHDR instead of CMSG_FIRSTHDR.
Diffstat (limited to 'lib/zebra.h')
-rw-r--r--lib/zebra.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/zebra.h b/lib/zebra.h
index 83da37c5..8c2dcaba 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -215,6 +215,23 @@ typedef int socklen_t;
#endif /* BSDI_NRL */
+#ifdef HAVE_BROKEN_CMSG_FIRSTHDR
+/* This bug is present in Solaris 8 and pre-patch Solaris 9 <sys/socket.h>;
+ 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 */
+
+
+
/*
* RFC 3542 defines several macros for using struct cmsghdr.
* Here, we define those that are not present