mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 00:56:19 +00:00
pimd: PIM nexthop tracking changes for tracking nexthop path of BSR.
Signed-off-by: Saravanan K <saravanank@vmware.com>
This commit is contained in:
parent
8a4dfb5d45
commit
4533b847ec
@ -121,6 +121,7 @@ static struct pim_nexthop_cache *pim_nexthop_cache_add(struct pim_instance *pim,
|
||||
*/
|
||||
int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
|
||||
struct pim_upstream *up, struct rp_info *rp,
|
||||
bool bsr_track_needed,
|
||||
struct pim_nexthop_cache *out_pnc)
|
||||
{
|
||||
struct pim_nexthop_cache *pnc = NULL;
|
||||
@ -157,6 +158,9 @@ int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
|
||||
if (up != NULL)
|
||||
hash_get(pnc->upstream_hash, up, hash_alloc_intern);
|
||||
|
||||
if (bsr_track_needed)
|
||||
pnc->bsr_tracking = true;
|
||||
|
||||
if (CHECK_FLAG(pnc->flags, PIM_NEXTHOP_VALID)) {
|
||||
if (out_pnc)
|
||||
memcpy(out_pnc, pnc, sizeof(struct pim_nexthop_cache));
|
||||
@ -167,7 +171,8 @@ int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
|
||||
}
|
||||
|
||||
void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
|
||||
struct pim_upstream *up, struct rp_info *rp)
|
||||
struct pim_upstream *up, struct rp_info *rp,
|
||||
bool del_bsr_tracking)
|
||||
{
|
||||
struct pim_nexthop_cache *pnc = NULL;
|
||||
struct pim_nexthop_cache lookup;
|
||||
@ -208,6 +213,9 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
|
||||
if (up)
|
||||
hash_release(pnc->upstream_hash, up);
|
||||
|
||||
if (del_bsr_tracking)
|
||||
pnc->bsr_tracking = false;
|
||||
|
||||
if (PIM_DEBUG_PIM_NHT) {
|
||||
char buf[PREFIX_STRLEN];
|
||||
prefix2str(addr, buf, sizeof buf);
|
||||
@ -218,7 +226,8 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
|
||||
}
|
||||
|
||||
if (pnc->rp_list->count == 0
|
||||
&& pnc->upstream_hash->count == 0) {
|
||||
&& pnc->upstream_hash->count == 0
|
||||
&& pnc->bsr_tracking == false) {
|
||||
pim_sendmsg_zebra_rnh(pim, zclient, pnc,
|
||||
ZEBRA_NEXTHOP_UNREGISTER);
|
||||
|
||||
|
@ -45,15 +45,23 @@ struct pim_nexthop_cache {
|
||||
|
||||
struct list *rp_list;
|
||||
struct hash *upstream_hash;
|
||||
/* Ideally this has to be list of scope zone. But for now we can just
|
||||
* have as a bool variable to say bsr_tracking.
|
||||
* Later this variable can be changed as a list of scope zones for
|
||||
* tracking same bsr for multiple scope zones.
|
||||
*/
|
||||
bool bsr_tracking;
|
||||
};
|
||||
|
||||
int pim_parse_nexthop_update(int command, struct zclient *zclient,
|
||||
zebra_size_t length, vrf_id_t vrf_id);
|
||||
int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
|
||||
struct pim_upstream *up, struct rp_info *rp,
|
||||
bool bsr_track_needed,
|
||||
struct pim_nexthop_cache *out_pnc);
|
||||
void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
|
||||
struct pim_upstream *up, struct rp_info *rp);
|
||||
struct pim_upstream *up, struct rp_info *rp,
|
||||
bool del_bsr_tracking);
|
||||
struct pim_nexthop_cache *pim_nexthop_cache_find(struct pim_instance *pim,
|
||||
struct pim_rpf *rpf);
|
||||
uint32_t pim_compute_ecmp_hash(struct prefix *src, struct prefix *grp);
|
||||
|
@ -372,7 +372,7 @@ void pim_upstream_update(struct pim_instance *pim, struct pim_upstream *up)
|
||||
zlog_debug("%s: Deregister upstream %s addr %s with Zebra NHT",
|
||||
__PRETTY_FUNCTION__, up->sg_str, buf);
|
||||
}
|
||||
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL);
|
||||
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL, false);
|
||||
}
|
||||
|
||||
/* Update the upstream address */
|
||||
@ -567,7 +567,8 @@ int pim_rp_new(struct pim_instance *pim, const char *rp,
|
||||
pim_rp_refresh_group_to_rp_mapping(pim);
|
||||
|
||||
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_all,
|
||||
NULL);
|
||||
false, NULL);
|
||||
|
||||
if (!pim_ecmp_nexthop_lookup(pim,
|
||||
&rp_all->rp.source_nexthop,
|
||||
&nht_p, &rp_all->group, 1))
|
||||
@ -655,7 +656,7 @@ int pim_rp_new(struct pim_instance *pim, const char *rp,
|
||||
__PRETTY_FUNCTION__, buf, buf1);
|
||||
}
|
||||
|
||||
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, NULL);
|
||||
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false, NULL);
|
||||
if (!pim_ecmp_nexthop_lookup(pim, &rp_info->rp.source_nexthop, &nht_p,
|
||||
&rp_info->group, 1))
|
||||
return PIM_RP_NO_PATH;
|
||||
@ -714,7 +715,7 @@ int pim_rp_del(struct pim_instance *pim, const char *rp,
|
||||
zlog_debug("%s: Deregister RP addr %s with Zebra ",
|
||||
__PRETTY_FUNCTION__, buf);
|
||||
}
|
||||
pim_delete_tracked_nexthop(pim, &nht_p, NULL, rp_info);
|
||||
pim_delete_tracked_nexthop(pim, &nht_p, NULL, rp_info, false);
|
||||
|
||||
if (!str2prefix("224.0.0.0/4", &g_all))
|
||||
return PIM_RP_BAD_ADDRESS;
|
||||
@ -819,7 +820,8 @@ void pim_rp_setup(struct pim_instance *pim)
|
||||
nht_p.prefixlen = IPV4_MAX_BITLEN;
|
||||
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
|
||||
|
||||
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, NULL);
|
||||
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false,
|
||||
NULL);
|
||||
if (!pim_ecmp_nexthop_lookup(pim, &rp_info->rp.source_nexthop,
|
||||
&nht_p, &rp_info->group, 1))
|
||||
if (PIM_DEBUG_PIM_NHT_RP)
|
||||
@ -969,8 +971,8 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, struct in_addr group)
|
||||
"%s: NHT Register RP addr %s grp %s with Zebra",
|
||||
__PRETTY_FUNCTION__, buf, buf1);
|
||||
}
|
||||
|
||||
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, NULL);
|
||||
pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info, false,
|
||||
NULL);
|
||||
pim_rpf_set_refresh_time(pim);
|
||||
(void)pim_ecmp_nexthop_lookup(pim, &rp_info->rp.source_nexthop,
|
||||
&nht_p, &rp_info->group, 1);
|
||||
@ -1180,7 +1182,7 @@ void pim_resolve_rp_nh(struct pim_instance *pim, struct pim_neighbor *nbr)
|
||||
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
|
||||
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
||||
if (!pim_find_or_track_nexthop(pim, &nht_p, NULL, rp_info,
|
||||
&pnc))
|
||||
false, &pnc))
|
||||
continue;
|
||||
|
||||
for (nh_node = pnc.nexthop; nh_node; nh_node = nh_node->next) {
|
||||
|
@ -238,7 +238,7 @@ enum pim_rpf_result pim_rpf_update(struct pim_instance *pim,
|
||||
if ((up->sg.src.s_addr == INADDR_ANY && I_am_RP(pim, up->sg.grp)) ||
|
||||
PIM_UPSTREAM_FLAG_TEST_FHR(up->flags))
|
||||
neigh_needed = FALSE;
|
||||
pim_find_or_track_nexthop(pim, &nht_p, up, NULL, NULL);
|
||||
pim_find_or_track_nexthop(pim, &nht_p, up, NULL, false, NULL);
|
||||
if (!pim_ecmp_nexthop_lookup(pim, &rpf->source_nexthop, &src, &grp,
|
||||
neigh_needed))
|
||||
return PIM_RPF_FAILURE;
|
||||
|
@ -237,7 +237,7 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
|
||||
zlog_debug("%s: Deregister upstream %s addr %s with Zebra NHT",
|
||||
__PRETTY_FUNCTION__, up->sg_str, buf);
|
||||
}
|
||||
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL);
|
||||
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL, false);
|
||||
}
|
||||
|
||||
XFREE(MTYPE_PIM_UPSTREAM, up);
|
||||
|
@ -344,7 +344,7 @@ static void pim_vxlan_orig_mr_up_add(struct pim_vxlan_sg *vxlan_sg)
|
||||
nht_p.prefixlen = IPV4_MAX_BITLEN;
|
||||
nht_p.u.prefix4 = up->upstream_addr;
|
||||
pim_delete_tracked_nexthop(vxlan_sg->pim,
|
||||
&nht_p, up, NULL);
|
||||
&nht_p, up, NULL, false);
|
||||
}
|
||||
pim_upstream_ref(up, flags, __PRETTY_FUNCTION__);
|
||||
vxlan_sg->up = up;
|
||||
|
Loading…
Reference in New Issue
Block a user