]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Find an interface that is both connected and setup for pim
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 28 Oct 2016 17:43:13 +0000 (13:43 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:12 +0000 (20:26 -0500)
When we are looking up the incoming interface for the ipmr
call back socket from the kernel, look to see if the src
is connected as well as has a valid pim_ifp to use.

This is to allow vrr configuration in a mlag env.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_iface.c
pimd/pim_iface.h
pimd/pim_mroute.c

index 50490fc9cb4bc9d08e4327ec95d9b6a4b1d84561..4d8850d638e376d8f47e853a7c7e4a1bbf59a1a8 100644 (file)
@@ -26,6 +26,7 @@
 #include "memory.h"
 #include "prefix.h"
 #include "vrf.h"
+#include "linklist.h"
 
 #include "pimd.h"
 #include "pim_iface.h"
@@ -1332,3 +1333,17 @@ pim_if_connected_to_source (struct interface *ifp, struct in_addr src)
 
   return 0;
 }
+
+struct interface *
+pim_if_lookup_address_vrf (struct in_addr src, vrf_id_t vrf_id)
+{
+  struct listnode *ifnode;
+  struct interface *ifp;
+
+  for (ALL_LIST_ELEMENTS_RO (vrf_iflist(vrf_id), ifnode, ifp))
+    {
+      if (pim_if_connected_to_source (ifp, src) && ifp->info)
+       return ifp;
+    }
+  return NULL;
+}
index 87530c60267c460e7e9b7c0cde444f4fc7a6706c..f671a7d54bdd90c08153e2cb4701a4a14d11c0f1 100644 (file)
@@ -128,6 +128,8 @@ void pim_if_addr_del_all(struct interface *ifp);
 void pim_if_addr_del_all_igmp(struct interface *ifp);
 void pim_if_addr_del_all_pim(struct interface *ifp);
 
+struct interface *pim_if_lookup_address_vrf (struct in_addr src, vrf_id_t vrf_id);
+
 int pim_if_add_vif(struct interface *ifp);
 int pim_if_del_vif(struct interface *ifp);
 void pim_if_add_vif_all(void);
index 976fe74f08c9b1c724401526ad35c685a4773287..a4ce4a5f33e4d157284fe525b3ef50ab4bc3b5f6 100644 (file)
@@ -418,30 +418,21 @@ int pim_mroute_msg(int fd, const char *buf, int buf_size)
      * received on. Find the interface that is on the same subnet as the source
      * of the IP packet.
      */
-    ifp = if_lookup_address_vrf((void *) &ip_hdr->ip_src, AF_INET, VRF_DEFAULT);
+    ifp = pim_if_lookup_address_vrf (ip_hdr->ip_src, VRF_DEFAULT);
 
     if (!ifp) {
       if (PIM_DEBUG_MROUTE_DETAIL) {
         pim_inet4_dump("<src?>", ip_hdr->ip_src, ip_src_str, sizeof(ip_src_str));
         pim_inet4_dump("<dst?>", ip_hdr->ip_dst, ip_dst_str, sizeof(ip_dst_str));
 
-        zlog_warn("%s: igmp kernel upcall could not find interface for %s -> %s",
+        zlog_warn("%s: igmp kernel upcall could not find usable interface for %s -> %s",
                 __PRETTY_FUNCTION__,
                 ip_src_str,
                 ip_dst_str);
       }
       return 0;
     }
-
     pim_ifp = ifp->info;
-    if (!pim_ifp)
-      {
-       if (PIM_DEBUG_MROUTE_DETAIL)
-         zlog_debug ("%s: igmp kernel upcall for interface:%s not configured for pim",
-                     __PRETTY_FUNCTION__, ifp->name);
-       return 0;
-      }
-
     ifaddr = pim_find_primary_addr(ifp);
     igmp = pim_igmp_sock_lookup_ifaddr(pim_ifp->igmp_socket_list, ifaddr);