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 <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2019-04-01 12:31:28 -04:00
parent 377e4f99bb
commit c9cd7fbc3f
3 changed files with 5 additions and 6 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);