Skip to content

Commit 920bf45

Browse files
bgpd: backpressure - Fix to avoid CPU hog
In case when bgp_evpn_free or bgp_delete is called and the announce_list has few items where vpn/bgp does not match, we add the item back to the list. Because of this the list count is always > 0 thereby hogging CPU or infinite loop. Ticket: #3905624 Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
1 parent e41b4a7 commit 920bf45

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

bgpd/bgp_evpn.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6317,9 +6317,11 @@ struct bgpevpn *bgp_evpn_new(struct bgp *bgp, vni_t vni,
63176317
void bgp_evpn_free(struct bgp *bgp, struct bgpevpn *vpn)
63186318
{
63196319
struct bgp_dest *dest = NULL;
6320+
uint32_t ann_count = zebra_announce_count(&bm->zebra_announce_head);
63206321

6321-
while (zebra_announce_count(&bm->zebra_announce_head)) {
6322+
while (ann_count) {
63226323
dest = zebra_announce_pop(&bm->zebra_announce_head);
6324+
ann_count--;
63236325
if (dest->za_vpn == vpn) {
63246326
bgp_path_info_unlock(dest->za_bgp_pi);
63256327
bgp_dest_unlock_node(dest);

bgpd/bgpd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3908,11 +3908,13 @@ int bgp_delete(struct bgp *bgp)
39083908
int i;
39093909
struct bgp_dest *dest = NULL;
39103910
struct graceful_restart_info *gr_info;
3911+
uint32_t ann_count = zebra_announce_count(&bm->zebra_announce_head);
39113912

39123913
assert(bgp);
39133914

3914-
while (zebra_announce_count(&bm->zebra_announce_head)) {
3915+
while (ann_count) {
39153916
dest = zebra_announce_pop(&bm->zebra_announce_head);
3917+
ann_count--;
39163918
if (dest->za_bgp_pi->peer->bgp == bgp) {
39173919
bgp_path_info_unlock(dest->za_bgp_pi);
39183920
bgp_dest_unlock_node(dest);

0 commit comments

Comments
 (0)