mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 17:40:04 +00:00
bgpd: Cleanup NHT state when underlying VRF goes down
When the underlying VRF is deleted, ensure that state for the next hops that BGP registers with zebra for tracking purposes is properly updated. Otherwise BGP will not re-register the next hop when the VRF is re-created, resulting in the next hop staying unresolved. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Ticket: CM-17456 Reviewed By: CCR-6587 Testing Done: Manual, bgp-min, vrf
This commit is contained in:
parent
c65f709ec6
commit
ee7ca6c059
@ -482,6 +482,33 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
|
||||
evaluate_paths(bnc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cleanup nexthop registration and status information for BGP nexthops
|
||||
* pertaining to this VRF. This is invoked upon VRF deletion.
|
||||
*/
|
||||
void bgp_cleanup_nexthops(struct bgp *bgp)
|
||||
{
|
||||
afi_t afi;
|
||||
struct bgp_node *rn;
|
||||
struct bgp_nexthop_cache *bnc;
|
||||
|
||||
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
||||
if (!bgp->nexthop_cache_table[afi])
|
||||
continue;
|
||||
|
||||
for (rn = bgp_table_top(bgp->nexthop_cache_table[afi]); rn;
|
||||
rn = bgp_route_next(rn)) {
|
||||
if ((bnc = rn->info) == NULL)
|
||||
continue;
|
||||
|
||||
/* Clear relevant flags. */
|
||||
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
|
||||
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
|
||||
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* make_prefix - make a prefix structure from the path (essentially
|
||||
* path's node.
|
||||
|
@ -66,4 +66,10 @@ void bgp_unlink_nexthop_by_peer(struct peer *);
|
||||
*/
|
||||
extern void bgp_delete_connected_nexthop(afi_t afi, struct peer *peer);
|
||||
|
||||
/*
|
||||
* Cleanup nexthop registration and status information for BGP nexthops
|
||||
* pertaining to this VRF. This is invoked upon VRF deletion.
|
||||
*/
|
||||
extern void bgp_cleanup_nexthops(struct bgp *bgp);
|
||||
|
||||
#endif /* _BGP_NHT_H */
|
||||
|
@ -3031,6 +3031,9 @@ void bgp_instance_down(struct bgp *bgp)
|
||||
|
||||
/* Purge network and redistributed routes. */
|
||||
bgp_purge_static_redist_routes(bgp);
|
||||
|
||||
/* Cleanup registered nexthops (flags) */
|
||||
bgp_cleanup_nexthops(bgp);
|
||||
}
|
||||
|
||||
/* Delete BGP instance. */
|
||||
|
Loading…
Reference in New Issue
Block a user