]> git.proxmox.com Git - mirror_frr.git/commitdiff
2005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
authorajs <ajs>
Tue, 4 Jan 2005 16:24:43 +0000 (16:24 +0000)
committerajs <ajs>
Tue, 4 Jan 2005 16:24:43 +0000 (16:24 +0000)
* 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.

ChangeLog
configure.ac
lib/ChangeLog
lib/sockopt.c
lib/zebra.h
ripd/ChangeLog
ripd/ripd.c
ripngd/ChangeLog
ripngd/ripngd.c
zebra/ChangeLog
zebra/rtadv.c

index 959ac857a6943054ba20b37569178faadc31ec30..ab58b585a6fff03463dcc6508eee386b8f57d59c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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).
+
 2005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
        * NEWS: Note improved logging facilities.
index 608672b6cc6c67fd83742dc7f75d84825ff19ef3..95056e7eab39e3e6467179262555d5ccec2fb180 100755 (executable)
@@ -5,7 +5,7 @@
 ##  Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
 ##  Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
 ##
-## $Id: configure.ac,v 1.81 2004/12/29 17:50:22 ajs Exp $
+## $Id: configure.ac,v 1.82 2005/01/04 16:24:43 ajs Exp $
 AC_PREREQ(2.53)
 
 AC_INIT(Quagga, 0.97.4, [http://bugzilla.quagga.net])
@@ -494,6 +494,31 @@ AC_SUBST(RT_METHOD)
 AC_SUBST(KERNEL_METHOD)
 AC_SUBST(OTHER_METHOD)
 
+dnl ------------------------------------
+dnl check for broken CMSG_FIRSTHDR macro
+dnl ------------------------------------
+AC_TRY_RUN([
+#ifdef SUNOS_5
+#define _XPG4_2
+#define __EXTENSIONS__
+#endif
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+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_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)])
+
 dnl ------------------------------
 dnl check kernel route read method
 dnl ------------------------------
index d50b8590740526404eb996209efb7a9b466ddbfa..2fee4611f1a98dd8ca7d9cba2fe714679fa0229b 100644 (file)
@@ -1,3 +1,11 @@
+2005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+       * 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.
+
 2005-01-02 Hasso Tepper <hasso at quagga.net>
 
        * command.c: Revert int -> unsigned int fixes in
index d755746ae2f047fbf4d8000276e1cbd69ef1063e..81db88d918da2f4d96728a86a238a4321b5efe95 100644 (file)
@@ -42,7 +42,7 @@ getsockopt_cmsg_data (struct msghdr *msgh, int level, int type)
   struct cmsghdr *cmsg;
   void *ptr = NULL;
   
-  for (cmsg = CMSG_FIRSTHDR(msgh); 
+  for (cmsg = ZCMSG_FIRSTHDR(msgh); 
        cmsg != NULL;
        cmsg = CMSG_NXTHDR(msgh, cmsg))
     if (cmsg->cmsg_level == level && cmsg->cmsg_type)
index 83da37c5471819a402786241ded227d4f117609d..8c2dcabaeab2a3a8b43188384f02e6e4c4edb119 100644 (file)
@@ -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
index 9d566119b07a59734015b03dbac2d542f17980ef..137228059f728eb94aefd191fabc150862183bf3 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+       * ripd.c: (rip_recvmsg) Use ZCMSG_FIRSTHDR instead of CMSG_FIRSTHDR.
+
 2004-12-15 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
        * ripd.c: (rip_read) Improve 2 error messages to show the source of
index 0407065832bb10de6e243203de34734132c3010e..c5baf8a3b5bcd1071d2a24f38f0231140e27dd85 100644 (file)
@@ -1632,7 +1632,7 @@ rip_recvmsg (int sock, u_char *buf, int size, struct sockaddr_in *from,
   if (ret < 0)
     return ret;
 
-  for (ptr = CMSG_FIRSTHDR(&msg); ptr != NULL; ptr = CMSG_NXTHDR(&msg, ptr))
+  for (ptr = ZCMSG_FIRSTHDR(&msg); ptr != NULL; ptr = CMSG_NXTHDR(&msg, ptr))
     if (ptr->cmsg_level == IPPROTO_IP && ptr->cmsg_type == IP_PKTINFO) 
       {
        struct in_pktinfo *pktinfo;
index 7f85cc474d4fced0425031e11ffeb9a9a60c4ce1..dcd8dedf42c4f909c100fa3bd7136f02f0905a26 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+       * ripngd.c: (ripng_recv_packet) Use ZCMSG_FIRSTHDR instead of
+         CMSG_FIRSTHDR.
+
 2004-12-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
        * ripng_nexthop.c: Replace NEXTHOP_OUT macro with NEXTHOP_OUT_PTR,
index 84ed45eef357f96a142399faf34efa499096c647..34282b8e78046c8f16e15966a8b327d9758226fa 100644 (file)
@@ -263,7 +263,7 @@ ripng_recv_packet (int sock, u_char *buf, int bufsize,
   if (ret < 0)
     return ret;
 
-  for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL;
+  for (cmsgptr = ZCMSG_FIRSTHDR(&msg); cmsgptr != NULL;
        cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) 
     {
       /* I want interface index which this packet comes from. */
index 3ed8c635c80de209b8f7e01b1d4cb04bedc1d8d2..e26204c82290d7f988201eeddb7a4e62c724bfe2 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+       * rtadv.c: (rtadv_recv_packet,rtadv_send_packet) Use ZCMSG_FIRSTHDR
+         instead of CMSG_FIRSTHDR.
+
 2004-12-22 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
        * connected.c: (connected_add_ipv4) Limit warning about /32 addresses
index 65b2f87c8f5fe2bced0165f9fbf70e85bc1bdb27..1238396e28297eee180e1712496177f854eee462 100644 (file)
@@ -121,7 +121,7 @@ rtadv_recv_packet (int sock, u_char *buf, int buflen,
   if (ret < 0)
     return ret;
 
-  for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL;
+  for (cmsgptr = ZCMSG_FIRSTHDR(&msg); cmsgptr != NULL;
        cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) 
     {
       /* I want interface index which this packet comes from. */
@@ -288,7 +288,7 @@ rtadv_send_packet (int sock, struct interface *ifp)
   iov.iov_base = buf;
   iov.iov_len = len;
 
-  cmsgptr = CMSG_FIRSTHDR(&msg);
+  cmsgptr = ZCMSG_FIRSTHDR(&msg);
   cmsgptr->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
   cmsgptr->cmsg_level = IPPROTO_IPV6;
   cmsgptr->cmsg_type = IPV6_PKTINFO;