summaryrefslogtreecommitdiff
path: root/zebra/zebra_routemap.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-10-09 11:41:21 -0400
committerDonald Sharp <sharpd@nvidia.com>2021-01-15 19:34:33 -0500
commit4dfcfabfa99a613a8fe5d4d69f6e8550f2d9dbf6 (patch)
treed76e13e9c93e1dbd818260c2f904c9f9da97983c /zebra/zebra_routemap.c
parentcfcd844c0b6fa01bbacf94bd2a18af7bb9e3ea54 (diff)
zebra: Push timer out if another route-map change comes in for zebra
If we are running with a delayed timer to handle route-map changes in zebra, if another route-map change is made to the cli, push out the timer instead of not modifying the timer. This will allow a large set of route-maps to be possibly be read in by the system and we don't have a state where new route-map changes are being read in and having the timer pop in the middle of it. Additionally convert to use THREAD_OFF, preventing a possible use after free as well as aligning the thread api usage with what we consider correct. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra/zebra_routemap.c')
-rw-r--r--zebra/zebra_routemap.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 42d27b369b..f4b0fa2d23 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -1620,8 +1620,6 @@ static void zebra_route_map_process_update_cb(char *rmap_name)
static int zebra_route_map_update_timer(struct thread *thread)
{
- zebra_t_rmap_update = NULL;
-
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("Event driven route-map update triggered");
@@ -1646,8 +1644,8 @@ static void zebra_route_map_set_delay_timer(uint32_t value)
if (!value && zebra_t_rmap_update) {
/* Event driven route map updates is being disabled */
/* But there's a pending timer. Fire it off now */
- thread_cancel(&zebra_t_rmap_update);
- zebra_route_map_update_timer(zebra_t_rmap_update);
+ THREAD_OFF(zebra_t_rmap_update);
+ zebra_route_map_update_timer(NULL);
}
}
@@ -1656,7 +1654,7 @@ void zebra_routemap_finish(void)
/* Set zebra_rmap_update_timer to 0 so that it wont schedule again */
zebra_rmap_update_timer = 0;
/* Thread off if any scheduled already */
- thread_cancel(&zebra_t_rmap_update);
+ THREAD_OFF(zebra_t_rmap_update);
route_map_finish();
}
@@ -1772,8 +1770,8 @@ route_map_result_t zebra_nht_route_map_check(afi_t afi, int client_proto,
static void zebra_route_map_mark_update(const char *rmap_name)
{
/* rmap_update_timer of 0 means don't do route updates */
- if (zebra_rmap_update_timer && !zebra_t_rmap_update) {
- zebra_t_rmap_update = NULL;
+ if (zebra_rmap_update_timer) {
+ THREAD_OFF(zebra_t_rmap_update);
thread_add_timer(zrouter.master, zebra_route_map_update_timer,
NULL, zebra_rmap_update_timer,
&zebra_t_rmap_update);