Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: backpressure - fix to properly remove dest for bgp under deletion #16368

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions bgpd/bgp_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -6333,16 +6333,16 @@ struct bgpevpn *bgp_evpn_new(struct bgp *bgp, vni_t vni,
void bgp_evpn_free(struct bgp *bgp, struct bgpevpn *vpn)
{
struct bgp_dest *dest = NULL;
uint32_t ann_count = zebra_announce_count(&bm->zebra_announce_head);
struct bgp_dest *dest_next = NULL;

while (ann_count) {
dest = zebra_announce_pop(&bm->zebra_announce_head);
ann_count--;
for (dest = zebra_announce_first(&bm->zebra_announce_head); dest;
dest = dest_next) {
dest_next = zebra_announce_next(&bm->zebra_announce_head, dest);
if (dest->za_vpn == vpn) {
bgp_path_info_unlock(dest->za_bgp_pi);
bgp_dest_unlock_node(dest);
} else
zebra_announce_add_tail(&bm->zebra_announce_head, dest);
zebra_announce_del(&bm->zebra_announce_head, dest);
}
}

bgp_evpn_remote_ip_hash_destroy(vpn);
Expand Down
27 changes: 20 additions & 7 deletions bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3936,21 +3936,34 @@ int bgp_delete(struct bgp *bgp)
safi_t safi;
int i;
struct bgp_dest *dest = NULL;
struct bgp_dest *dest_next = NULL;
struct bgp_table *dest_table = NULL;
struct graceful_restart_info *gr_info;
uint32_t ann_count = zebra_announce_count(&bm->zebra_announce_head);
uint32_t cnt_before, cnt_after;

assert(bgp);

while (ann_count) {
dest = zebra_announce_pop(&bm->zebra_announce_head);
ann_count--;
if (dest->za_bgp_pi->peer->bgp == bgp) {
/*
* Iterate the pending dest list and remove all the dest pertaininig to
* the bgp under delete.
*/
cnt_before = zebra_announce_count(&bm->zebra_announce_head);
for (dest = zebra_announce_first(&bm->zebra_announce_head); dest;
dest = dest_next) {
dest_next = zebra_announce_next(&bm->zebra_announce_head, dest);
dest_table = bgp_dest_table(dest);
if (dest_table->bgp == bgp) {
bgp_path_info_unlock(dest->za_bgp_pi);
bgp_dest_unlock_node(dest);
} else
zebra_announce_add_tail(&bm->zebra_announce_head, dest);
zebra_announce_del(&bm->zebra_announce_head, dest);
}
}

cnt_after = zebra_announce_count(&bm->zebra_announce_head);
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("Zebra Announce Fifo cleanup count before %u and after %u during BGP %s deletion",
cnt_before, cnt_after, bgp->name_pretty);

bgp_soft_reconfig_table_task_cancel(bgp, NULL, NULL);

/* make sure we withdraw any exported routes */
Expand Down
Loading