diff --git a/zebra/main.c b/zebra/main.c index aea30daa3b..304f4797fc 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -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(); diff --git a/zebra/rib.h b/zebra/rib.h index 665f286f67..2f9b0ccb7e 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -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, diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 45a75ba24b..bd82d6caf8 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -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 *