mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-18 19:30:04 +00:00
pimd: Handling delete nexthop track for PIM upstream address
When RP gets deleted, find all the (*, G) upstream whose group belongs to the deleted RP, release the upstream from pnc->upstream_hash in the function pim_delete_tracked_nexthop(). Signed-off-by: Sarita Patra <saritap@vmware.com>
This commit is contained in:
parent
8cfd72682e
commit
246445a372
@ -171,6 +171,8 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
|
|||||||
struct pim_nexthop_cache *pnc = NULL;
|
struct pim_nexthop_cache *pnc = NULL;
|
||||||
struct pim_nexthop_cache lookup;
|
struct pim_nexthop_cache lookup;
|
||||||
struct zclient *zclient = NULL;
|
struct zclient *zclient = NULL;
|
||||||
|
struct listnode *upnode = NULL;
|
||||||
|
struct pim_upstream *upstream = NULL;
|
||||||
|
|
||||||
zclient = pim_zebra_zclient_get();
|
zclient = pim_zebra_zclient_get();
|
||||||
|
|
||||||
@ -178,8 +180,30 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
|
|||||||
lookup.rpf.rpf_addr = *addr;
|
lookup.rpf.rpf_addr = *addr;
|
||||||
pnc = hash_lookup(pim->rpf_hash, &lookup);
|
pnc = hash_lookup(pim->rpf_hash, &lookup);
|
||||||
if (pnc) {
|
if (pnc) {
|
||||||
if (rp)
|
if (rp) {
|
||||||
|
/* Release the (*, G)upstream from pnc->upstream_hash,
|
||||||
|
* whose Group belongs to the RP getting deleted
|
||||||
|
*/
|
||||||
|
for (ALL_LIST_ELEMENTS_RO(pim->upstream_list, upnode,
|
||||||
|
upstream)) {
|
||||||
|
struct prefix grp;
|
||||||
|
struct rp_info *trp_info;
|
||||||
|
|
||||||
|
if (upstream->sg.src.s_addr != INADDR_ANY)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
grp.family = AF_INET;
|
||||||
|
grp.prefixlen = IPV4_MAX_BITLEN;
|
||||||
|
grp.u.prefix4 = upstream->sg.grp;
|
||||||
|
|
||||||
|
trp_info = pim_rp_find_match_group(pim, &grp);
|
||||||
|
if (trp_info == rp)
|
||||||
|
hash_release(pnc->upstream_hash,
|
||||||
|
upstream);
|
||||||
|
}
|
||||||
listnode_delete(pnc->rp_list, rp);
|
listnode_delete(pnc->rp_list, rp);
|
||||||
|
}
|
||||||
|
|
||||||
if (up)
|
if (up)
|
||||||
hash_release(pnc->upstream_hash, up);
|
hash_release(pnc->upstream_hash, up);
|
||||||
|
|
||||||
|
@ -219,6 +219,13 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
|
|||||||
pim_msdp_up_del(pim, &up->sg);
|
pim_msdp_up_del(pim, &up->sg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When RP gets deleted, pim_rp_del() deregister addr with Zebra NHT
|
||||||
|
* and assign up->upstream_addr as INADDR_ANY.
|
||||||
|
* So before de-registering the upstream address, check if is not equal
|
||||||
|
* to INADDR_ANY. This is done in order to avoid de-registering for
|
||||||
|
* 255.255.255.255 which is maintained for some reason..
|
||||||
|
*/
|
||||||
|
if (up->upstream_addr.s_addr != INADDR_ANY) {
|
||||||
/* Deregister addr with Zebra NHT */
|
/* Deregister addr with Zebra NHT */
|
||||||
nht_p.family = AF_INET;
|
nht_p.family = AF_INET;
|
||||||
nht_p.prefixlen = IPV4_MAX_BITLEN;
|
nht_p.prefixlen = IPV4_MAX_BITLEN;
|
||||||
@ -230,6 +237,7 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
|
|||||||
__PRETTY_FUNCTION__, up->sg_str, buf);
|
__PRETTY_FUNCTION__, up->sg_str, buf);
|
||||||
}
|
}
|
||||||
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL);
|
pim_delete_tracked_nexthop(pim, &nht_p, up, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
XFREE(MTYPE_PIM_UPSTREAM, up);
|
XFREE(MTYPE_PIM_UPSTREAM, up);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user