diff --git a/zebra/main.c b/zebra/main.c index b66011882497..13b6713547b2 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -230,10 +230,23 @@ void zebra_finalize(struct event *dummy) zebra_ns_notify_close(); /* Final shutdown of ns resources */ - ns_walk_func(zebra_ns_final_shutdown, NULL, NULL); + ns_walk_func(zebra_ns_kernel_shutdown, NULL, NULL); zebra_router_terminate(); +<<<<<<< HEAD +======= + zebra_mpls_terminate(); + + zebra_pw_terminate(); + + zebra_srv6_terminate(); + + label_manager_terminate(); + + ns_walk_func(zebra_ns_final_shutdown, NULL, NULL); + +>>>>>>> 7ae70eb5ef (zebra: fix heap-use-after free on ns shutdown) ns_terminate(); frr_fini(); exit(0); diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index ffdb9df531ef..e90a162126f1 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -180,6 +180,22 @@ int zebra_ns_early_shutdown(struct ns *ns, return NS_WALK_CONTINUE; } +/* During zebra shutdown, do kernel cleanup + * netlink sockets, .. + */ +int zebra_ns_kernel_shutdown(struct ns *ns, void *param_in __attribute__((unused)), + void **param_out __attribute__((unused))) +{ + struct zebra_ns *zns = ns->info; + + if (zns == NULL) + return NS_WALK_CONTINUE; + + kernel_terminate(zns, true); + + return NS_WALK_CONTINUE; +} + /* During zebra shutdown, do final cleanup * after all dataplane work is complete. */ @@ -190,9 +206,7 @@ int zebra_ns_final_shutdown(struct ns *ns, struct zebra_ns *zns = ns->info; if (zns == NULL) - return 0; - - kernel_terminate(zns, true); + return NS_WALK_CONTINUE; return NS_WALK_CONTINUE; } diff --git a/zebra/zebra_ns.h b/zebra/zebra_ns.h index edf261197190..0f9be73fe423 100644 --- a/zebra/zebra_ns.h +++ b/zebra/zebra_ns.h @@ -66,7 +66,12 @@ int zebra_ns_early_shutdown(struct ns *ns, int zebra_ns_final_shutdown(struct ns *ns, void *param_in __attribute__((unused)), void **param_out __attribute__((unused))); +<<<<<<< HEAD int zebra_ns_config_write(struct vty *vty, struct ns *ns); +======= +int zebra_ns_kernel_shutdown(struct ns *ns, void *param_in __attribute__((unused)), + void **param_out __attribute__((unused))); +>>>>>>> 7ae70eb5ef (zebra: fix heap-use-after free on ns shutdown) void zebra_ns_startup_continue(struct zebra_dplane_ctx *ctx);