]> git.puffer.fish Git - mirror/frr.git/commitdiff
2005-05-07 Yar Tikhiy <yar@comp.chem.msu.su>
authorpaul <paul>
Sat, 7 May 2005 02:22:51 +0000 (02:22 +0000)
committerpaul <paul>
Sat, 7 May 2005 02:22:51 +0000 (02:22 +0000)
* configure.ac: Check for OSes which support passing ifindex in
  struct ip_mreq.
* lib/sockopt.c: Add support for BSD style ifindex in ip_mreq.
* ospfd/ospf_network.c: Log ifindex on multicast membership leave/join
  events.

ChangeLog
configure.ac
lib/ChangeLog
lib/sockopt.c
ospfd/ChangeLog
ospfd/ospf_network.c

index ff557e0ea50743abca7eee78ad35359a0b4cdb88..635ea5b46b601e511e8e9676c9e3ddc64b8fa516 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-05-07 Yar Tikhiy <yar@comp.chem.msu.su>
+
+       * configure.ac: Check for OSes which support passing ifindex in
+         struct ip_mreq.
+
 2005-04-29 Paul Jakma <paul.jakma@sun.com>
 
        * NEWS: Added some more 0.99 news.
index e3582e7479db6e5f906cdda16bbdfe373c2b1ca2..b959603b073f405138521b9ddcc90584e66f74a8 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.105 2005/04/29 03:20:54 paul Exp $
+## $Id: configure.ac,v 1.106 2005/05/07 02:22:51 paul Exp $
 AC_PREREQ(2.53)
 
 AC_INIT(Quagga, 0.99.1, [http://bugzilla.quagga.net])
@@ -321,7 +321,7 @@ AC_HEADER_STDC
 AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
                  sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
                  sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
-                 libutil.h limits.h])
+                 sys/param.h libutil.h limits.h])
 
 AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
                 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
@@ -371,9 +371,6 @@ case "$host" in
       AC_CHECK_LIB(nsl, gethostbyname)
       AC_CHECK_LIB(socket, socket)
   ;;
-  *-freebsd3.2)
-      AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
-  ;;
   *-openbsd*)
       opsys=openbsd
       AC_DEFINE(OPEN_BSD,,OpenBSD)
@@ -648,6 +645,27 @@ fi
 AC_SUBST(IF_METHOD)
 AC_SUBST(IOCTL_METHOD)
 
+dnl ---------------------------------------------------------------
+dnl figure out how to specify an interface in multicast sockets API
+dnl ---------------------------------------------------------------
+AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex],,,[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif])
+
+AC_MSG_CHECKING([for BSD struct ip_mreq hack])
+AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif],[#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500022 || (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) || (defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 106010000)
+  return (0);
+#else
+  #error No support for BSD struct ip_mreq hack detected
+#endif],[AC_MSG_RESULT(yes)
+AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
+AC_MSG_RESULT(no))
+
 dnl -----------------------
 dnl check proc file system.
 dnl -----------------------
index f5145321fc4d4674741d7ca3fc2e174fbf2ef823..18ac2214df4bbe5bb6b4aabe8c8c1f7ec0b963ba 100644 (file)
@@ -1,3 +1,7 @@
+2005-05-07 Yar Tikhiy <yar@comp.chem.msu.su>
+
+       * sockopt.c: Add support for BSD style ifindex in ip_mreq.
+
 2005-05-06 Paul Jakma <paul@dishone.st>
 
        * (general) extern and static'ification of functions in code and
index 81db88d918da2f4d96728a86a238a4321b5efe95..655ecdc06ed7273245bd0f5e8090eff8f47a86e2 100644 (file)
@@ -171,8 +171,7 @@ setsockopt_multicast_ipv4(int sock,
                        unsigned int ifindex)
 {
 
-  /* Linux 2.2.0 and up */
-#if defined(GNU_LINUX) && LINUX_VERSION_CODE > 131584
+#ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX
   /* This is better because it uses ifindex directly */
   struct ip_mreqn mreqn;
   
@@ -212,11 +211,16 @@ setsockopt_multicast_ipv4(int sock,
   struct in_addr m;
   struct ip_mreq mreq;
 
+#ifdef HAVE_BSD_STRUCT_IP_MREQ_HACK
+  if (ifindex)
+    m.s_addr = htonl(ifindex);
+  else
+#endif
+    m = if_addr;
+
   switch (optname)
     {
     case IP_MULTICAST_IF:
-      m = if_addr;
-      
       return setsockopt (sock, IPPROTO_IP, optname, (void *)&m, sizeof(m)); 
       break;
 
@@ -224,7 +228,7 @@ setsockopt_multicast_ipv4(int sock,
     case IP_DROP_MEMBERSHIP:
       memset (&mreq, 0, sizeof(mreq));
       mreq.imr_multiaddr.s_addr = mcast_addr;
-      mreq.imr_interface = if_addr;
+      mreq.imr_interface = m;
       
       return setsockopt (sock, 
                         IPPROTO_IP, 
index d8ec676fcf48aefc986d1da4348cfc6847ab8c85..209027e7d923d2870bd02d6f59501945b59b37f0 100644 (file)
@@ -1,3 +1,8 @@
+2005-05-07 Yar Tikhiy <yar@comp.chem.msu.su>
+
+       * ospf_network.c: Log ifindex on multicast membership leave/join
+         events.
+
 2005-05-06 Paul Jakma <paul.jakma@sun.com>
 
         * (general) extern and static qualifiers added. 
index c2c8b133e19c0fc6741436e28748866af109e571..e8c983712953d8077cd7db387787b9aa4248e7a3 100644 (file)
@@ -60,8 +60,8 @@ ospf_if_add_allspfrouters (struct ospf *top, struct prefix *p,
               "on # of multicast group memberships has been exceeded?",
                top->fd, inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno));
   else
-    zlog_info ("interface %s join AllSPFRouters Multicast group.",
-              inet_ntoa (p->u.prefix4));
+    zlog_info ("interface %s [%u] join AllSPFRouters Multicast group.",
+              inet_ntoa (p->u.prefix4), ifindex);
 
   return ret;
 }
@@ -80,8 +80,8 @@ ospf_if_drop_allspfrouters (struct ospf *top, struct prefix *p,
               "ifindex %u, AllSPFRouters): %s",
                top->fd, inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno));
   else
-    zlog_info ("interface %s leave AllSPFRouters Multicast group.",
-              inet_ntoa (p->u.prefix4));
+    zlog_info ("interface %s [%u] leave AllSPFRouters Multicast group.",
+              inet_ntoa (p->u.prefix4), ifindex);
 
   return ret;
 }
@@ -102,8 +102,8 @@ ospf_if_add_alldrouters (struct ospf *top, struct prefix *p, unsigned int
               "on # of multicast group memberships has been exceeded?",
                top->fd, inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno));
   else
-    zlog_info ("interface %s join AllDRouters Multicast group.",
-              inet_ntoa (p->u.prefix4));
+    zlog_info ("interface %s [%u] join AllDRouters Multicast group.",
+              inet_ntoa (p->u.prefix4), ifindex);
 
   return ret;
 }
@@ -122,8 +122,8 @@ ospf_if_drop_alldrouters (struct ospf *top, struct prefix *p, unsigned int
               "ifindex %u, AllDRouters): %s",
                top->fd, inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno));
   else
-    zlog_info ("interface %s leave AllDRouters Multicast group.",
-              inet_ntoa (p->u.prefix4));
+    zlog_info ("interface %s [%u] leave AllDRouters Multicast group.",
+              inet_ntoa (p->u.prefix4), ifindex);
 
   return ret;
 }