From: Donald Sharp Date: Fri, 28 Oct 2016 17:43:13 +0000 (-0400) Subject: pimd: Find an interface that is both connected and setup for pim X-Git-Tag: frr-3.0-branchpoint~64^2~10^2~156 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=9f0edbc93c4f8145c667e3845d9c01c6c2aed910;p=mirror%2Ffrr.git pimd: Find an interface that is both connected and setup for pim 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 --- diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 50490fc9cb..4d8850d638 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -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; +} diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h index 87530c6026..f671a7d54b 100644 --- a/pimd/pim_iface.h +++ b/pimd/pim_iface.h @@ -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); diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 976fe74f08..a4ce4a5f33 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -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("", ip_hdr->ip_src, ip_src_str, sizeof(ip_src_str)); pim_inet4_dump("", 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);