]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: static routes are leaked on shutdown
authorDonald Sharp <sharpd@nvidia.com>
Wed, 21 Dec 2022 17:11:56 +0000 (12:11 -0500)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 27 Dec 2022 20:07:54 +0000 (20:07 +0000)
Shutdown of bgp results in both the bgp_path_info,
bgp_dest and bgp_table's not being freed because
the bgp_path_info remains locked.

Effectively static routes are scheduled for deletion but bgp_process
skips the work because the work queue sees that the bgp router
is marked for deletion.  Effectively not doing any work and leaving
data on the floor.

Modify the code when attempting to put into the work queue to
notice and not do so but just unlock the path info.

This is effectively the same as what goes on for normal peering
as that it checks for shutdown and just calls bgp_path_info_free
too.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit f9d6087c51fbeafc76f3c7f1b72681cbab7f3651)

bgpd/bgp_route.c

index 7104ee3d1df9c3fd388497da1b65a8444891a606..35223f5569cc733be5905ede8342406fa40c8e09 100644 (file)
@@ -8707,7 +8707,11 @@ void bgp_redistribute_withdraw(struct bgp *bgp, afi_t afi, int type,
                        bgp_aggregate_decrement(bgp, bgp_dest_get_prefix(dest),
                                                pi, afi, SAFI_UNICAST);
                        bgp_path_info_delete(dest, pi);
-                       bgp_process(bgp, dest, afi, SAFI_UNICAST);
+                       if (!CHECK_FLAG(bgp->flags,
+                                       BGP_FLAG_DELETE_IN_PROGRESS))
+                               bgp_process(bgp, dest, afi, SAFI_UNICAST);
+                       else
+                               bgp_path_info_reap(dest, pi);
                }
        }
 }