From 28185336ed0c8219ce44454c3bd3f3495e71afd3 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 12 Dec 2016 19:23:29 -0500 Subject: [PATCH] pimd: Fix core when bouncing interfaces When you bounce interfaces and the system is under heavy load there exists situations where zebra may or may not have told us the new ifindex, but we've requested a nexthop lookup, which bypasses normal mechanisms for zebra communication, we may get back a ifindex that we may have not created a ifp for yet. Ticket: CM-14052 Signed-off-by: Donald Sharp Reviewed-by: Don Slice --- pimd/pim_iface.c | 4 ++-- pimd/pim_rpf.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 3c8bbac6ec..0b5c7cc1eb 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -1044,9 +1044,9 @@ int pim_if_find_vifindex_by_ifindex(ifindex_t ifindex) struct interface *ifp; ifp = if_lookup_by_index_vrf (ifindex, VRF_DEFAULT); - pim_ifp = ifp->info; - if (!pim_ifp) + if (!ifp || !ifp->info) return -1; + pim_ifp = ifp->info; return pim_ifp->mroute_vif_index; } diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index 914395e596..9c18c2482a 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -117,7 +117,8 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr, int nei __FILE__, __PRETTY_FUNCTION__, first_ifindex, addr_str); } - return -2; + i++; + continue; } if (!ifp->info) -- 2.39.5