summaryrefslogtreecommitdiff
path: root/pimd/pim_zlookup.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-04-16 20:26:00 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2020-04-16 20:28:15 -0400
commit85948e7bfa055e4553fa59338cdb2a53e000722d (patch)
tree6b4c568c931e5e38ae85760198d300dd5553bbac /pimd/pim_zlookup.c
parent50cf5243c182575582d438cf2435ef17b6f9ffde (diff)
pimd: if_lookup_by_index can fail handle it appropriately
It is possible that a if_lookup_by_index can return NULL ensure that we handle this appropriately. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_zlookup.c')
-rw-r--r--pimd/pim_zlookup.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c
index 84fac4f951..49c221f8ed 100644
--- a/pimd/pim_zlookup.c
+++ b/pimd/pim_zlookup.c
@@ -285,17 +285,17 @@ static int zclient_read_nexthop(struct pim_instance *pim,
* If we are sending v6 secondary assume we receive v6
* secondary
*/
- if (pim->send_v6_secondary)
- nbr = pim_neighbor_find_by_secondary(
- if_lookup_by_index(
- nexthop_tab[num_ifindex]
- .ifindex,
- nexthop_vrf_id),
- &p);
+ struct interface *ifp = if_lookup_by_index(
+ nexthop_tab[num_ifindex].ifindex,
+ nexthop_vrf_id);
+
+ if (!ifp)
+ nbr = NULL;
+ else if (pim->send_v6_secondary)
+ nbr = pim_neighbor_find_by_secondary(ifp, &p);
else
- nbr = pim_neighbor_find_if(if_lookup_by_index(
- nexthop_tab[num_ifindex].ifindex,
- nexthop_vrf_id));
+ nbr = pim_neighbor_find_if(ifp);
+
if (nbr) {
nexthop_tab[num_ifindex].nexthop_addr.family =
AF_INET;