]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: On shutdown, ensure ctx's in rib_dplane_q are freed
authorDonald Sharp <sharpd@nvidia.com>
Thu, 16 Nov 2023 17:55:34 +0000 (12:55 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Tue, 21 Nov 2023 17:41:18 +0000 (12:41 -0500)
a) Rename rib_init to zebra_rib_init() to better follow how
things are named

b) on shutdown cycle through the rib_dplane_q and free
up any contexts sitting in it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/main.c
zebra/rib.h
zebra/zebra_rib.c

index aea30daa3b00158a73c28a432b8ab69dd5171155..304f4797fcf49055808846122c49529817d5a97b 100644 (file)
@@ -228,6 +228,7 @@ void zebra_finalize(struct event *dummy)
        /* Final shutdown of ns resources */
        ns_walk_func(zebra_ns_final_shutdown, NULL, NULL);
 
+       zebra_rib_terminate();
        zebra_router_terminate();
 
        ns_terminate();
@@ -410,7 +411,7 @@ int main(int argc, char **argv)
        /* Zebra related initialize. */
        zebra_router_init(asic_offload, notify_on_ack, v6_with_v4_nexthop);
        zserv_init();
-       rib_init();
+       zebra_rib_init();
        zebra_if_init();
        zebra_debug_init();
 
index 665f286f67a773d835d13e1aea03277a1ebc3997..2f9b0ccb7e0db9baf74eaf26ea167c46765b742d 100644 (file)
@@ -414,7 +414,8 @@ extern void rib_update_table(struct route_table *table,
 extern void rib_sweep_route(struct event *t);
 extern void rib_sweep_table(struct route_table *table);
 extern void rib_close_table(struct route_table *table);
-extern void rib_init(void);
+extern void zebra_rib_init(void);
+extern void zebra_rib_terminate(void);
 extern unsigned long rib_score_proto(uint8_t proto, unsigned short instance);
 extern unsigned long rib_score_proto_table(uint8_t proto,
                                           unsigned short instance,
index 45a75ba24b082093a7397cfb55e2b766f115c674..bd82d6caf84389deb90975150c78a84cbaf9477a 100644 (file)
@@ -4926,7 +4926,7 @@ static void check_route_info(void)
 }
 
 /* Routing information base initialize. */
-void rib_init(void)
+void zebra_rib_init(void)
 {
        check_route_info();
 
@@ -4938,6 +4938,20 @@ void rib_init(void)
        zebra_dplane_init(rib_dplane_results);
 }
 
+void zebra_rib_terminate(void)
+{
+       struct zebra_dplane_ctx *ctx;
+
+       EVENT_OFF(t_dplane);
+
+       ctx = dplane_ctx_dequeue(&rib_dplane_q);
+       while (ctx) {
+               dplane_ctx_fini(&ctx);
+
+               ctx = dplane_ctx_dequeue(&rib_dplane_q);
+       }
+}
+
 /*
  * vrf_id_get_next
  *