diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 903018b2a2..bee4fca705 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -4810,9 +4810,5 @@ void bgp_route_map_init(void) void bgp_route_map_terminate(void) { /* ToDo: Cleanup all the used memory */ - - route_map_add_hook(NULL); - route_map_delete_hook(NULL); - route_map_event_hook(NULL); route_map_finish(); } diff --git a/lib/routemap.c b/lib/routemap.c index 6c4585365a..4e8682f312 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -2741,6 +2741,15 @@ void route_map_finish(void) vector_free(route_set_vec); route_set_vec = NULL; + /* + * All protocols are setting these to NULL + * by default on shutdown( route_map_finish ) + * Why are we making them do this work? + */ + route_map_master.add_hook = NULL; + route_map_master.delete_hook = NULL; + route_map_master.event_hook = NULL; + /* cleanup route_map */ while (route_map_master.head) { struct route_map *map = route_map_master.head; diff --git a/lib/routemap.h b/lib/routemap.h index 0f7c391f84..a193e32536 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -169,6 +169,12 @@ DECLARE_QOBJ_TYPE(route_map) /* Prototypes. */ extern void route_map_init(void); + +/* + * This should only be called on shutdown + * Additionally this function sets the hooks to NULL + * before any processing is done. + */ extern void route_map_finish(void); /* Add match statement to route map. */ diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index e6bd3faf40..5af88defeb 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1861,9 +1861,6 @@ void ospf6_asbr_redistribute_reset(void) void ospf6_asbr_terminate(void) { /* Cleanup route maps */ - route_map_add_hook(NULL); - route_map_delete_hook(NULL); - route_map_event_hook(NULL); route_map_finish(); } diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index f315421843..2298c2261a 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -561,9 +561,6 @@ void ospf_terminate(void) ospf_finish(ospf); /* Cleanup route maps */ - route_map_add_hook(NULL); - route_map_delete_hook(NULL); - route_map_event_hook(NULL); route_map_finish(); /* reverse prefix_list_init */ diff --git a/pimd/pim_routemap.c b/pimd/pim_routemap.c index b41124376f..4230c127ad 100644 --- a/pimd/pim_routemap.c +++ b/pimd/pim_routemap.c @@ -52,8 +52,5 @@ void pim_route_map_init(void) void pim_route_map_terminate(void) { - route_map_add_hook(NULL); - route_map_delete_hook(NULL); - route_map_event_hook(NULL); route_map_finish(); }