diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-10-28 19:43:13 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-12-22 02:26:12 +0100 |
commit | 9f0edbc93c4f8145c667e3845d9c01c6c2aed910 (patch) | |
tree | 8853fb592b3ddb90a0575bc50ecd7f76f36c7dac /pimd | |
parent | pimd: Start (S,G,rpt) coding (diff) | |
download | frr-9f0edbc93c4f8145c667e3845d9c01c6c2aed910.tar.xz frr-9f0edbc93c4f8145c667e3845d9c01c6c2aed910.zip |
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 <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/pim_iface.c | 15 | ||||
-rw-r--r-- | pimd/pim_iface.h | 2 | ||||
-rw-r--r-- | pimd/pim_mroute.c | 13 |
3 files changed, 19 insertions, 11 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 50490fc9c..4d8850d63 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 87530c602..f671a7d54 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 976fe74f0..a4ce4a5f3 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("<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); |