Does anyone have quagga setup with ripd and/or ospfd that's in a
position to test this update?

Background: OpenBSD multicast code wants the interface IP address passed
when joining/leaving groups.

Old quagga code passed this up e.g. from ripd/ospfd but this was changed
c.2012 and now only uses ifindex-based APIs (either RFC3678 MCAST_JOIN_GROUP
etc, struct ip_mreqn on some OS, or a hack allowed in some OS of passing
the ifindex in as the source address).

The current port version reverts to the old quagga code for this (and
has done so since 2013 - https://marc.info/?t=135706131200001&r=1&w=2),
but it's becoming harder to maintain as upstream diverges (quagga 1.2 is
a bit different; the frrouter fork is different again).

So this takes a different and less intrusive approach to handling the
changes needed - borrowing some code used for SunOS in another function
in the file, given an ifindex from the calling function, it does a
lookup for the interface address, and uses that instead. This avoids
scattering the changes through 4 files, and reduces the main patch
scope (the current one is guaranteed to conflict when anything is
changed in the relevant functions upstream).

Any tests/comments welcome...



Index: Makefile
===================================================================
RCS file: /cvs/ports/net/quagga/Makefile,v
retrieving revision 1.53
diff -u -p -r1.53 Makefile
--- Makefile    31 Oct 2017 09:37:18 -0000      1.53
+++ Makefile    31 Oct 2017 11:42:44 -0000
@@ -2,13 +2,13 @@
 
 COMMENT=       multi-threaded routing daemon
 
-DISTNAME=      quagga-1.0.20161017
+DISTNAME=      quagga-1.2.2
 CATEGORIES=    net
 MASTER_SITES=  http://download.savannah.gnu.org/releases/quagga/
 
-SHARED_LIBS=   ospf            0.1 \
-               ospfapiclient   0.0 \
-               zebra           1.0
+.for i in ospf ospfapiclient zebra fpm_pb quagga_pb
+SHARED_LIBS+=  $i 1.0
+.endfor
 
 HOMEPAGE=      http://www.quagga.net/
 
@@ -37,10 +37,10 @@ CONFIGURE_ARGS+= --disable-pie
 CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
                LDFLAGS="-L${LOCALBASE}/lib" \
                LIBS=-lcurses
-
 MAKE_FLAGS=    MAKEINFO="makeinfo --no-split"
 FAKE_FLAGS=    exampledir='${PREFIX}/share/examples/quagga' \
                ${MAKE_FLAGS}
+LIBTOOL_FLAGS= --tag=disable-static
 
 FLAVORS=       snmp
 FLAVOR?=
Index: distinfo
===================================================================
RCS file: /cvs/ports/net/quagga/distinfo,v
retrieving revision 1.21
diff -u -p -r1.21 distinfo
--- distinfo    31 Oct 2017 09:37:18 -0000      1.21
+++ distinfo    31 Oct 2017 11:42:44 -0000
@@ -1,2 +1,2 @@
-SHA256 (quagga-1.0.20161017.tar.gz) = 
jyZyTdt0GfORL4DOjxNokZAongAizwmSHQpAP9dxSRg=
-SIZE (quagga-1.0.20161017.tar.gz) = 2758494
+SHA256 (quagga-1.2.2.tar.gz) = Ui4i8r7uZOPwws3j0BVfO4ED9Pb8ir75LLQLw6TMKTE=
+SIZE (quagga-1.2.2.tar.gz) = 2986142
Index: patches/patch-bgpd_bgp_aspath_c
===================================================================
RCS file: patches/patch-bgpd_bgp_aspath_c
diff -N patches/patch-bgpd_bgp_aspath_c
--- patches/patch-bgpd_bgp_aspath_c     31 Oct 2017 09:37:18 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
-$OpenBSD: patch-bgpd_bgp_aspath_c,v 1.3 2017/10/31 09:37:18 sthen Exp $
-
-From 7a42b78be9a4108d98833069a88e6fddb9285008 Mon Sep 17 00:00:00 2001
-From: Andreas Jaggi <a...@open.ch>
-Date: Mon, 2 Oct 2017 19:38:43 +0530
-Subject: bgpd: Fix AS_PATH size calculation for long paths
-
-If you have an AS_PATH with more entries than
-what can be written into a single AS_SEGMENT_MAX
-it needs to be broken up.  The code that noticed
-that the AS_PATH needs to be broken up was not
-correctly calculating the size of the resulting
-message.  This patch addresses this issue.
-
-Index: bgpd/bgp_aspath.c
---- bgpd/bgp_aspath.c.orig
-+++ bgpd/bgp_aspath.c
-@@ -904,7 +904,7 @@ aspath_put (struct stream *s, struct aspath *as, int u
-               assegment_header_put (s, seg->type, AS_SEGMENT_MAX);
-               assegment_data_put (s, seg->as, AS_SEGMENT_MAX, use32bit);
-               written += AS_SEGMENT_MAX;
--              bytes += ASSEGMENT_SIZE (written, use32bit);
-+              bytes += ASSEGMENT_SIZE (AS_SEGMENT_MAX, use32bit);
-             }
-           
-           /* write the final segment, probably is also the first */
Index: patches/patch-configure_ac
===================================================================
RCS file: /cvs/ports/net/quagga/patches/patch-configure_ac,v
retrieving revision 1.5
diff -u -p -r1.5 patch-configure_ac
--- patches/patch-configure_ac  31 Mar 2016 22:42:00 -0000      1.5
+++ patches/patch-configure_ac  31 Oct 2017 11:42:44 -0000
@@ -3,9 +3,10 @@ $OpenBSD: patch-configure_ac,v 1.5 2016/
 We have never supported passing an ifindex in struct
 ip_mreq.imr_interface.
 
---- configure.ac.orig  Thu Mar 31 23:33:14 2016
-+++ configure.ac       Thu Mar 31 23:33:45 2016
-@@ -951,7 +951,7 @@ AC_CHECK_HEADERS([linux/mroute.h], [], [],
+Index: configure.ac
+--- configure.ac.orig
++++ configure.ac
+@@ -1053,7 +1053,7 @@ AC_CHECK_HEADERS([linux/mroute.h], [], [],
  AC_MSG_CHECKING([for BSD struct ip_mreq hack])
  AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
  #include <sys/param.h>
Index: patches/patch-lib_sockopt_c
===================================================================
RCS file: /cvs/ports/net/quagga/patches/patch-lib_sockopt_c,v
retrieving revision 1.3
diff -u -p -r1.3 patch-lib_sockopt_c
--- patches/patch-lib_sockopt_c 31 Oct 2017 11:02:50 -0000      1.3
+++ patches/patch-lib_sockopt_c 31 Oct 2017 11:42:44 -0000
@@ -1,195 +1,71 @@
-$OpenBSD: patch-lib_sockopt_c,v 1.3 2017/10/31 11:02:50 sthen Exp $
-
-Revert 69bf3a39; does not work on at least (Open/Net)BSD.
-This can be put back if we get RFC3678 support.
+$OpenBSD$
 
 Index: lib/sockopt.c
 --- lib/sockopt.c.orig
 +++ lib/sockopt.c
-@@ -197,7 +197,7 @@ setsockopt_ipv6_tclass(int sock, int tclass)
+@@ -21,7 +21,7 @@
+ 
+ #include <zebra.h>
+ 
+-#ifdef SUNOS_5
++#if defined(SUNOS_5) || defined(__OpenBSD__)
+ #include <ifaddrs.h>
+ #endif
+ 
+@@ -281,17 +281,45 @@ setsockopt_ipv4_multicast(int sock,
+   /* #elif  defined(BOGON_NIX) && EXAMPLE_VERSION_CODE > -100000 */
+   /* Add your favourite OS here! */
  
- /*
-  * Process multicast socket options for IPv4 in an OS-dependent manner.
-- * Supported options are IP_{ADD,DROP}_MEMBERSHIP.
-+ * Supported options are IP_MULTICAST_IF and IP_{ADD,DROP}_MEMBERSHIP.
-  *
-  * Many operating systems have a limit on the number of groups that
-  * can be joined per socket (where each group and local address
-@@ -217,132 +217,65 @@ setsockopt_ipv6_tclass(int sock, int tclass)
-  * allow leaves, or implicitly leave all groups joined to down interfaces.
-  */
- int
--setsockopt_ipv4_multicast(int sock,
-+setsockopt_multicast_ipv4(int sock, 
-                       int optname, 
-+                      struct in_addr if_addr /* required */,
-                       unsigned int mcast_addr,
--                      ifindex_t ifindex)
-+                      ifindex_t ifindex /* optional: if non-zero, may be
-+                                                used instead of if_addr */)
- {
--#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__)
--  struct ip_mreqn mreqn;
--  int ret;
--  
--  assert(optname == IP_ADD_MEMBERSHIP || optname == IP_DROP_MEMBERSHIP);
--  memset (&mreqn, 0, sizeof(mreqn));
--
--  mreqn.imr_multiaddr.s_addr = mcast_addr;
--  mreqn.imr_ifindex = ifindex;
--  
--  ret = setsockopt(sock, IPPROTO_IP, optname,
--                   (void *)&mreqn, sizeof(mreqn));
--  if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) && (errno == EADDRINUSE))
--    {
--      /* see above: handle possible problem when interface comes back up */
--      char buf[1][INET_ADDRSTRLEN];
--      zlog_info("setsockopt_ipv4_multicast attempting to drop and "
--                "re-add (fd %d, mcast %s, ifindex %u)",
--                sock,
--                inet_ntop(AF_INET, &mreqn.imr_multiaddr,
--                          buf[0], sizeof(buf[0])), ifindex);
--      setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP,
--                 (void *)&mreqn, sizeof(mreqn));
--      ret = setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
--                       (void *)&mreqn, sizeof(mreqn));
--    }
--  return ret;
--
--  /* Example defines for another OS, boilerplate off other code in this
--     function, AND handle optname as per other sections for consistency !! */
--  /* #elif  defined(BOGON_NIX) && EXAMPLE_VERSION_CODE > -100000 */
--  /* Add your favourite OS here! */
--
 -#elif defined(HAVE_BSD_STRUCT_IP_MREQ_HACK) /* #if OS_TYPE */ 
++#elif defined(__OpenBSD__) || defined(HAVE_BSD_STRUCT_IP_MREQ_HACK) /* #if 
OS_TYPE */ 
    /* standard BSD API */
  
    struct in_addr m;
    struct ip_mreq mreq;
    int ret;
++#if defined(HAVE_BSD_STRUCT_IP_MREQ_HACK)
++  assert(optname == IP_ADD_MEMBERSHIP || optname == IP_DROP_MEMBERSHIP);
++  m.s_addr = htonl(ifindex);
++#else
++  char ifname[IF_NAMESIZE];
++  struct ifaddrs *ifa, *ifap;
  
--  assert(optname == IP_ADD_MEMBERSHIP || optname == IP_DROP_MEMBERSHIP);
-+#ifdef HAVE_BSD_STRUCT_IP_MREQ_HACK
-+  if (ifindex)
-+    m.s_addr = htonl(ifindex);
-+  else
-+#endif
-+    m = if_addr;
+   assert(optname == IP_ADD_MEMBERSHIP || optname == IP_DROP_MEMBERSHIP);
  
 -  m.s_addr = htonl(ifindex);
--
--  memset (&mreq, 0, sizeof(mreq));
--  mreq.imr_multiaddr.s_addr = mcast_addr;
--  mreq.imr_interface = m;
--  
--  ret = setsockopt (sock, IPPROTO_IP, optname, (void *)&mreq, sizeof(mreq));
--  if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) && (errno == EADDRINUSE))
-+  switch (optname)
-     {
--      /* see above: handle possible problem when interface comes back up */
--      char buf[1][INET_ADDRSTRLEN];
--      zlog_info("setsockopt_ipv4_multicast attempting to drop and "
--                "re-add (fd %d, mcast %s, ifindex %u)",
--                sock,
--                inet_ntop(AF_INET, &mreq.imr_multiaddr,
--                          buf[0], sizeof(buf[0])), ifindex);
--      setsockopt (sock, IPPROTO_IP, IP_DROP_MEMBERSHIP,
--                  (void *)&mreq, sizeof(mreq));
--      ret = setsockopt (sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
--                        (void *)&mreq, sizeof(mreq));
--    }
--  return ret;
-+    case IP_MULTICAST_IF:
-+      return setsockopt (sock, IPPROTO_IP, optname, (void *)&m, sizeof(m)); 
-+      break;
++  if (if_indextoname(ifindex, ifname) == NULL)
++    return -1;
  
--#else
--  #error "Unsupported multicast API"
--#endif /* #if OS_TYPE */
--
-+    case IP_ADD_MEMBERSHIP:
-+    case IP_DROP_MEMBERSHIP:
-+      memset (&mreq, 0, sizeof(mreq));
-+      mreq.imr_multiaddr.s_addr = mcast_addr;
-+      mreq.imr_interface = m;
-+      
-+      ret = setsockopt (sock, IPPROTO_IP, optname, (void *)&mreq, 
sizeof(mreq));
-+      if ((ret < 0) && (optname == IP_ADD_MEMBERSHIP) && (errno == 
EADDRINUSE))
-+        {
-+        /* see above: handle possible problem when interface comes back up */
-+        char buf[2][INET_ADDRSTRLEN];
-+        zlog_info("setsockopt_multicast_ipv4 attempting to drop and "
-+                  "re-add (fd %d, ifaddr %s, mcast %s, ifindex %u)",
-+                  sock,
-+                  inet_ntop(AF_INET, &if_addr, buf[0], sizeof(buf[0])),
-+                  inet_ntop(AF_INET, &mreq.imr_multiaddr,
-+                            buf[1], sizeof(buf[1])), ifindex);
-+        setsockopt (sock, IPPROTO_IP, IP_DROP_MEMBERSHIP,
-+                    (void *)&mreq, sizeof(mreq));
-+        ret = setsockopt (sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
-+                          (void *)&mreq, sizeof(mreq));
-+        }
-+      return ret;
-+      break;
-+      
-+    default:
-+      /* Can out and give an understandable error */
-+      errno = EINVAL;
-+      return -1;
++  if (getifaddrs(&ifa) != 0)
++    return -1;
++
++  for (ifap = ifa; ifap != NULL; ifap = ifap->ifa_next)
++    {
++      struct sockaddr_in *sa;
++
++      if (strcmp(ifap->ifa_name, ifname) != 0)
++        continue;
++      if (ifap->ifa_addr->sa_family != AF_INET)
++        continue;
++      sa = (struct sockaddr_in*)ifap->ifa_addr;
++      memcpy(&m, &sa->sin_addr, sizeof(m));
 +      break;
 +    }
- }
- 
--/*
-- * Set IP_MULTICAST_IF socket option in an OS-dependent manner.
-- */
--int
--setsockopt_ipv4_multicast_if(int sock, ifindex_t ifindex)
--{
--
--#ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX
--  struct ip_mreqn mreqn;
--  memset (&mreqn, 0, sizeof(mreqn));
--
--  mreqn.imr_ifindex = ifindex;
--  return setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, (void *)&mreqn, 
sizeof(mreqn));
--
--  /* Example defines for another OS, boilerplate off other code in this
--     function */
--  /* #elif  defined(BOGON_NIX) && EXAMPLE_VERSION_CODE > -100000 */
--  /* Add your favourite OS here! */
--#elif defined(HAVE_BSD_STRUCT_IP_MREQ_HACK)
--  struct in_addr m;
--
--  m.s_addr = htonl(ifindex);
--
--  return setsockopt (sock, IPPROTO_IP, IP_MULTICAST_IF, (void *)&m, 
sizeof(m));
--#else
--  #error "Unsupported multicast API"
--#endif
--}
--  
- static int
- setsockopt_ipv4_ifindex (int sock, ifindex_t val)
- {
++
++  freeifaddrs(ifa);
++  if (!ifap) /* This means we did not find an IP */
++    return -1;
++#endif
++
+   memset (&mreq, 0, sizeof(mreq));
+   mreq.imr_multiaddr.s_addr = mcast_addr;
+   mreq.imr_interface = m;
+@@ -343,7 +371,7 @@ setsockopt_ipv4_multicast_if(int sock, ifindex_t ifind
+   m.s_addr = htonl(ifindex);
+ 
+   return setsockopt (sock, IPPROTO_IP, IP_MULTICAST_IF, (void *)&m, 
sizeof(m));
+-#elif defined(SUNOS_5)
++#elif defined(SUNOS_5) || defined(__OpenBSD__)
+   char ifname[IF_NAMESIZE];
+   struct ifaddrs *ifa, *ifap;
+   struct in_addr ifaddr;
Index: patches/patch-lib_sockopt_h
===================================================================
RCS file: patches/patch-lib_sockopt_h
diff -N patches/patch-lib_sockopt_h
--- patches/patch-lib_sockopt_h 22 Mar 2016 12:57:54 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
-$OpenBSD: patch-lib_sockopt_h,v 1.2 2016/03/22 12:57:54 jca Exp $
-
-Revert 69bf3a39; does not work on at least (Open/Net)BSD.
-This can be put back if we get RFC3678 support.
-
---- lib/sockopt.h.orig Wed Mar 16 00:17:17 2016
-+++ lib/sockopt.h      Mon Mar 21 02:12:14 2016
-@@ -85,8 +85,12 @@ extern int setsockopt_ipv6_tclass (int, int);
- 
- extern int setsockopt_ipv4_multicast_if(int sock, ifindex_t ifindex);
- extern int setsockopt_ipv4_multicast(int sock, int optname,
-+                                     struct in_addr if_addr
-+                                       /* required: interface to join on */,
-                                      unsigned int mcast_addr,
--                                   ifindex_t ifindex);
-+                                   ifindex_t ifindex
-+                                       /* optional: if non-zero, may be used
-+                                              instead of if_addr */);
- extern int setsockopt_ipv4_tos(int sock, int tos);
- 
- /* Ask for, and get, ifindex, by whatever method is supported. */
Index: patches/patch-ospfd_ospf_network_c
===================================================================
RCS file: patches/patch-ospfd_ospf_network_c
diff -N patches/patch-ospfd_ospf_network_c
--- patches/patch-ospfd_ospf_network_c  22 Mar 2016 12:57:54 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,61 +0,0 @@
-$OpenBSD: patch-ospfd_ospf_network_c,v 1.2 2016/03/22 12:57:54 jca Exp $
-
-Revert 69bf3a39; does not work on at least (Open/Net)BSD.
-This can be put back if we get RFC3678 support.
-
---- ospfd/ospf_network.c.orig  Wed Mar 16 00:17:17 2016
-+++ ospfd/ospf_network.c       Mon Mar 21 01:24:12 2016
-@@ -52,8 +52,8 @@ ospf_if_add_allspfrouters (struct ospf *top, struct pr
- {
-   int ret;
-   
--  ret = setsockopt_ipv4_multicast (top->fd, IP_ADD_MEMBERSHIP,
--                                   htonl (OSPF_ALLSPFROUTERS),
-+  ret = setsockopt_multicast_ipv4 (top->fd, IP_ADD_MEMBERSHIP,
-+                                   p->u.prefix4, htonl (OSPF_ALLSPFROUTERS),
-                                    ifindex);
-   if (ret < 0)
-     zlog_warn ("can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, "
-@@ -73,8 +73,8 @@ ospf_if_drop_allspfrouters (struct ospf *top, struct p
- {
-   int ret;
- 
--  ret = setsockopt_ipv4_multicast (top->fd, IP_DROP_MEMBERSHIP,
--                                   htonl (OSPF_ALLSPFROUTERS),
-+  ret = setsockopt_multicast_ipv4 (top->fd, IP_DROP_MEMBERSHIP,
-+                                   p->u.prefix4, htonl (OSPF_ALLSPFROUTERS),
-                                    ifindex);
-   if (ret < 0)
-     zlog_warn ("can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, "
-@@ -93,8 +93,8 @@ ospf_if_add_alldrouters (struct ospf *top, struct pref
- {
-   int ret;
- 
--  ret = setsockopt_ipv4_multicast (top->fd, IP_ADD_MEMBERSHIP,
--                                   htonl (OSPF_ALLDROUTERS),
-+  ret = setsockopt_multicast_ipv4 (top->fd, IP_ADD_MEMBERSHIP,
-+                                   p->u.prefix4, htonl (OSPF_ALLDROUTERS),
-                                    ifindex);
-   if (ret < 0)
-     zlog_warn ("can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, "
-@@ -113,8 +113,8 @@ ospf_if_drop_alldrouters (struct ospf *top, struct pre
- {
-   int ret;
- 
--  ret = setsockopt_ipv4_multicast (top->fd, IP_DROP_MEMBERSHIP,
--                                   htonl (OSPF_ALLDROUTERS),
-+  ret = setsockopt_multicast_ipv4 (top->fd, IP_DROP_MEMBERSHIP,
-+                                   p->u.prefix4, htonl (OSPF_ALLDROUTERS),
-                                    ifindex);
-   if (ret < 0)
-     zlog_warn ("can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, "
-@@ -149,7 +149,8 @@ ospf_if_ipmulticast (struct ospf *top, struct prefix *
-     zlog_warn ("can't setsockopt IP_MULTICAST_TTL(1) for fd %d: %s",
-              top->fd, safe_strerror (errno));
- 
--  ret = setsockopt_ipv4_multicast_if (top->fd, ifindex);
-+  ret = setsockopt_multicast_ipv4 (top->fd, IP_MULTICAST_IF,
-+                                   p->u.prefix4, 0, ifindex);
-   if (ret < 0)
-     zlog_warn("can't setsockopt IP_MULTICAST_IF(fd %d, addr %s, "
-             "ifindex %u): %s",
Index: patches/patch-ripd_rip_interface_c
===================================================================
RCS file: patches/patch-ripd_rip_interface_c
diff -N patches/patch-ripd_rip_interface_c
--- patches/patch-ripd_rip_interface_c  4 Jan 2013 00:24:10 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,51 +0,0 @@
-$OpenBSD: patch-ripd_rip_interface_c,v 1.1 2013/01/04 00:24:10 sthen Exp $
-
-Revert 69bf3a39; does not work on at least (Open/Net)BSD.
-This can be put back if we get RFC3678 support.
-
---- ripd/rip_interface.c.orig  Tue Apr 17 14:56:26 2012
-+++ ripd/rip_interface.c       Thu Jan  3 00:24:26 2013
-@@ -78,8 +78,9 @@ ipv4_multicast_join (int sock, 
- {
-   int ret;
- 
--  ret = setsockopt_ipv4_multicast (sock,
-+  ret = setsockopt_multicast_ipv4 (sock, 
-                                  IP_ADD_MEMBERSHIP, 
-+                                 ifa, 
-                                  group.s_addr, 
-                                  ifindex); 
- 
-@@ -99,8 +100,9 @@ ipv4_multicast_leave (int sock, 
- {
-   int ret;
- 
--  ret = setsockopt_ipv4_multicast (sock,
-+  ret = setsockopt_multicast_ipv4 (sock, 
-                                  IP_DROP_MEMBERSHIP, 
-+                                 ifa, 
-                                  group.s_addr, 
-                                  ifindex);
- 
-@@ -136,13 +138,18 @@ rip_interface_new (void)
- void
- rip_interface_multicast_set (int sock, struct connected *connected)
- {
-+  struct in_addr addr;
-+  
-   assert (connected != NULL);
-   
--  if (setsockopt_ipv4_multicast_if (sock, connected->ifp->ifindex) < 0)
-+  addr = CONNECTED_ID(connected)->u.prefix4;
-+
-+  if (setsockopt_multicast_ipv4 (sock, IP_MULTICAST_IF, addr, 0, 
-+                                 connected->ifp->ifindex) < 0) 
-     {
-       zlog_warn ("Can't setsockopt IP_MULTICAST_IF on fd %d to "
--               "ifindex %d for interface %s",
--               sock, connected->ifp->ifindex,
-+               "source address %s for interface %s",
-+               sock, inet_ntoa(addr),
-                connected->ifp->name);
-     }
-   
Index: patches/patch-zebra_kernel_socket_c
===================================================================
RCS file: /cvs/ports/net/quagga/patches/patch-zebra_kernel_socket_c,v
retrieving revision 1.12
diff -u -p -r1.12 patch-zebra_kernel_socket_c
--- patches/patch-zebra_kernel_socket_c 22 Mar 2016 12:57:54 -0000      1.12
+++ patches/patch-zebra_kernel_socket_c 31 Oct 2017 11:42:44 -0000
@@ -1,6 +1,7 @@
 $OpenBSD: patch-zebra_kernel_socket_c,v 1.12 2016/03/22 12:57:54 jca Exp $
---- zebra/kernel_socket.c.orig Wed Mar 16 00:17:17 2016
-+++ zebra/kernel_socket.c      Mon Mar 21 01:19:29 2016
+Index: zebra/kernel_socket.c
+--- zebra/kernel_socket.c.orig
++++ zebra/kernel_socket.c
 @@ -202,7 +202,7 @@ const struct message rtm_type_str[] =
    {RTM_REDIRECT, "RTM_REDIRECT"},
    {RTM_MISS,     "RTM_MISS"},
@@ -10,17 +11,7 @@ $OpenBSD: patch-zebra_kernel_socket_c,v 
    {RTM_OLDADD,   "RTM_OLDADD"},
  #endif /* RTM_OLDADD */
  #ifdef RTM_OLDDEL
-@@ -242,7 +242,9 @@ static const struct message rtm_flag_str[] =
- #ifdef RTF_CLONING
-   {RTF_CLONING,   "CLONING"},
- #endif /* RTF_CLONING */
-+#ifdef RTF_XRESOLVE
-   {RTF_XRESOLVE,  "XRESOLVE"},
-+#endif /* RTF_XRESOLVE */
- #ifdef RTF_LLINFO
-   {RTF_LLINFO,    "LLINFO"},
- #endif /* RTF_LLINFO */
-@@ -834,9 +836,7 @@ rtm_read_mesg (struct rt_msghdr *rtm,
+@@ -836,9 +836,7 @@ rtm_read_mesg (struct rt_msghdr *rtm,
  
    /* rt_msghdr version check. */
    if (rtm->rtm_version != RTM_VERSION) 
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/quagga/pkg/PLIST,v
retrieving revision 1.20
diff -u -p -r1.20 PLIST
--- pkg/PLIST   22 Mar 2016 12:57:54 -0000      1.20
+++ pkg/PLIST   31 Oct 2017 11:42:44 -0000
@@ -13,6 +13,7 @@ include/quagga/quagga/buffer.h
 include/quagga/quagga/checksum.h
 include/quagga/quagga/command.h
 include/quagga/quagga/distribute.h
+include/quagga/quagga/event_counter.h
 include/quagga/quagga/fifo.h
 include/quagga/quagga/filter.h
 include/quagga/quagga/getopt.h
@@ -28,6 +29,7 @@ include/quagga/quagga/md5.h
 include/quagga/quagga/memory.h
 include/quagga/quagga/memtypes.h
 include/quagga/quagga/network.h
+include/quagga/quagga/nexthop.h
 include/quagga/quagga/ospfapi/
 include/quagga/quagga/ospfapi/ospf_apiclient.h
 include/quagga/quagga/ospfd/
@@ -63,13 +65,14 @@ include/quagga/quagga/zassert.h
 include/quagga/quagga/zclient.h
 include/quagga/quagga/zebra.h
 @info info/quagga.info
-lib/libospf.a
+lib/libfpm_pb.la
+@lib lib/libfpm_pb.so.${LIBfpm_pb_VERSION}
 lib/libospf.la
 @lib lib/libospf.so.${LIBospf_VERSION}
-lib/libospfapiclient.a
 lib/libospfapiclient.la
 @lib lib/libospfapiclient.so.${LIBospfapiclient_VERSION}
-lib/libzebra.a
+lib/libquagga_pb.la
+@lib lib/libquagga_pb.so.${LIBquagga_pb_VERSION}
 lib/libzebra.la
 @lib lib/libzebra.so.${LIBzebra_VERSION}
 @man man/man1/vtysh.1

Reply via email to