summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-12-17 20:09:29 +0100
committerDonald Sharp <sharpd@nvidia.com>2022-12-17 20:09:29 +0100
commit0e61463a8e43becac9b74c5895993df70b53de4d (patch)
treeaa9cbf844597a728a0fb566e3670d19bdcdf7fbb /zebra
parentMerge pull request #10576 from louis-6wind/fix-l3vpn-igmetric (diff)
downloadfrr-0e61463a8e43becac9b74c5895993df70b53de4d.tar.xz
frr-0e61463a8e43becac9b74c5895993df70b53de4d.zip
zebra: Ensure memory is not freed that dplane depends on in shutdown
Zebra has a shutdown setup where it asks the dplane to shutdown but can still be processing data. This is especially true if something the dplane is listening on receives data that will be processed by the main dplane thread from netlink. When zebra_finalize is called it is possible that a bit of data comes in before the zebra_dplane_shutdown() function is called and the memory freed in ns_walk_func() causes the main dplane event to crash when it cannot find the ns data anymore. Reverse the order, stop the zebra dplane pthread and then free the memory associated with the namespaces. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/zebra/main.c b/zebra/main.c
index 3de97943f..e38f9a85e 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -221,12 +221,12 @@ void zebra_finalize(struct thread *dummy)
{
zlog_info("Zebra final shutdown");
- /* Final shutdown of ns resources */
- ns_walk_func(zebra_ns_final_shutdown, NULL, NULL);
-
/* Stop dplane thread and finish any cleanup */
zebra_dplane_shutdown();
+ /* Final shutdown of ns resources */
+ ns_walk_func(zebra_ns_final_shutdown, NULL, NULL);
+
zebra_router_terminate();
ns_terminate();