From c9cd7fbc3f4e0c7722897db71220ae997de1975f Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 1 Apr 2019 12:31:28 -0400 Subject: [PATCH] pimd: Limit lookup of neighbor since we know we have one When a new pim neighbor comes up, we need to go through and mark nexthops that we have received from zebra for reachability tracking so we can refigure stuff. If we pass in the new neighbor we can limit the search to those nexthops out the interface that the new neighbor has come up. Signed-off-by: Donald Sharp --- pimd/pim_neighbor.c | 2 +- pimd/pim_rp.c | 7 +++---- pimd/pim_rp.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c index 436f2dec27..a63b09fc1f 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -540,7 +540,7 @@ pim_neighbor_add(struct interface *ifp, struct in_addr source_addr, Upon PIM neighbor UP, iterate all RPs and update nexthop cache with this neighbor. */ - pim_resolve_rp_nh(pim_ifp->pim); + pim_resolve_rp_nh(pim_ifp->pim, neigh); pim_rp_setup(pim_ifp->pim); diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index b7db7d0418..4e285720a2 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -1206,14 +1206,13 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj) } } -void pim_resolve_rp_nh(struct pim_instance *pim) +void pim_resolve_rp_nh(struct pim_instance *pim, struct pim_neighbor *nbr) { struct listnode *node = NULL; struct rp_info *rp_info = NULL; struct nexthop *nh_node = NULL; struct prefix nht_p; struct pim_nexthop_cache pnc; - struct pim_neighbor *nbr = NULL; for (ALL_LIST_ELEMENTS_RO(pim->rp_list, node, rp_info)) { if (rp_info->rp.rpf_addr.u.prefix4.s_addr == INADDR_NONE) @@ -1233,8 +1232,8 @@ void pim_resolve_rp_nh(struct pim_instance *pim) struct interface *ifp1 = if_lookup_by_index( nh_node->ifindex, pim->vrf_id); - nbr = pim_neighbor_find_if(ifp1); - if (!nbr) + + if (nbr->interface != ifp1) continue; nh_node->gate.ipv4 = nbr->source_addr; diff --git a/pimd/pim_rp.h b/pimd/pim_rp.h index e0f8e16be0..402ec30aba 100644 --- a/pimd/pim_rp.h +++ b/pimd/pim_rp.h @@ -68,7 +68,7 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, struct in_addr group); void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj); -void pim_resolve_rp_nh(struct pim_instance *pim); +void pim_resolve_rp_nh(struct pim_instance *pim, struct pim_neighbor *nbr); int pim_rp_list_cmp(void *v1, void *v2); struct rp_info *pim_rp_find_match_group(struct pim_instance *pim, const struct prefix *group); -- 2.39.5