On Wed, 23 Sep 2015, Donald Sharp wrote:

Here's my proposed diff to fix the centos 6 failure.  It sure looks like
the usage of RFC3678 with it's usage of kernel data structures is the wrong
way to go.  Looking at several versions of linux they all have the struct
ip_mreqn.

diff --git a/lib/sockopt.c b/lib/sockopt.c
index 257271b..076454b 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -222,28 +222,7 @@ setsockopt_ipv4_multicast(int sock,
                       unsigned int mcast_addr,
                       unsigned int ifindex)
{
-#ifdef HAVE_RFC3678
-  struct group_req gr;
-  struct sockaddr_in *si;
-  int ret;
-  memset (&gr, 0, sizeof(gr));
-  si = (struct sockaddr_in *)&gr.gr_group;
-  gr.gr_interface = ifindex;
-  si->sin_family = AF_INET;
-#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
-  si->sin_len = sizeof(struct sockaddr_in);
-#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
-  si->sin_addr.s_addr = mcast_addr;
-  ret = setsockopt(sock, IPPROTO_IP, (optname == IP_ADD_MEMBERSHIP) ?
-    MCAST_JOIN_GROUP : MCAST_LEAVE_GROUP, (void *)&gr, sizeof(gr));
-  if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) && (errno == EADDRINUSE))
-    {
-      setsockopt(sock, IPPROTO_IP, MCAST_LEAVE_GROUP, (void *)&gr,
sizeof(gr));
-      ret = setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void *)&gr,
sizeof(gr));
-    }
-  return ret;
-
-#elif defined(HAVE_STRUCT_IP_MREQN_IMR_IFINDEX) && !defined(__FreeBSD__)
+#if defined(HAVE_STRUCT_IP_MREQN_IMR_IFINDEX) && !defined(__FreeBSD__)
  struct ip_mreqn mreqn;
  int ret;

So FreeBSD supports that API, but we still (presumably) have it use the HAVE_BSD_STRUCT_IP_MREQ_HACK case then?

I wonder if any (F)BSD people know what's best to use there?

regards,
--
Paul Jakma      p...@jakma.org  @pjakma Key ID: 64A2FF6A
Fortune:
C'est magnifique, mais ce n'est pas l'Informatique.
                -- Bosquet [on seeing the IBM 4341]

_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to