From 0d0f516c76eef90d2f9e0e5c4d1472b78b24991c Mon Sep 17 00:00:00 2001 From: anlan_cs Date: Sat, 24 Sep 2022 19:00:14 -0400 Subject: zebra: fix fpm crash Fix issue#11996. When removing VRF ( all routes of this VRF), zebra mistakenly forgot to check whether its routes are in update queue of FPM. So FPM module will crash during its dealing with these routes, which are already freed. Add a new HOOK `rib_shutdown()`, `zebra_rtable_node_cleanup()` will use it to remove these routes from update queue of FPM module before freeing them. Signed-off-by: anlan_cs --- zebra/zebra_rib.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'zebra/zebra_rib.c') diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index bd7e8bbbd0..fceaaaa9f0 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -76,6 +76,8 @@ static struct dplane_ctx_q rib_dplane_q; DEFINE_HOOK(rib_update, (struct route_node * rn, const char *reason), (rn, reason)); +DEFINE_HOOK(rib_shutdown, (struct route_node * rn), (rn)); + /* Meta Q's specific names */ enum meta_queue_indexes { @@ -944,6 +946,9 @@ void zebra_rtable_node_cleanup(struct route_table *table, if (node->info) { rib_dest_t *dest = node->info; + /* Remove from update queue of FPM module */ + hook_call(rib_shutdown, node); + rnh_list_fini(&dest->nht); XFREE(MTYPE_RIB_DEST, node->info); } -- cgit v1.2.3