]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Properly handle zfpm_g->t_conn_down in zebra_fpm.c
authorDonald Sharp <sharpd@nvidia.com>
Thu, 18 May 2023 19:59:43 +0000 (15:59 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 19 May 2023 14:02:19 +0000 (10:02 -0400)
The t_conn_down pointer was being set to NULL when it already
was.  The t_conn_down pointer was being dropped( and leaving
a thread possibly running in the background ) which could
cause problems on shutdown.  And finally when shutting down
the t_conn_down event was not being stopped at all.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/zebra_fpm.c

index e379a5868c6d9b1873596c175d0321250201f52c..4c2947cfd3a60855bf79352221dc8baeb06a7481 100644 (file)
@@ -497,6 +497,11 @@ static inline void zfpm_connect_off(void)
        EVENT_OFF(zfpm_g->t_connect);
 }
 
+static inline void zfpm_conn_down_off(void)
+{
+       EVENT_OFF(zfpm_g->t_conn_down);
+}
+
 /*
  * zfpm_conn_up_thread_cb
  *
@@ -635,8 +640,6 @@ static void zfpm_conn_down_thread_cb(struct event *thread)
        while ((mac = TAILQ_FIRST(&zfpm_g->mac_q)) != NULL)
                zfpm_mac_info_del(mac);
 
-       zfpm_g->t_conn_down = NULL;
-
        iter = &zfpm_g->t_conn_down_state.iter;
 
        while ((rnode = zfpm_rnodes_iter_next(iter))) {
@@ -667,7 +670,6 @@ static void zfpm_conn_down_thread_cb(struct event *thread)
 
                zfpm_g->stats.t_conn_down_yields++;
                zfpm_rnodes_iter_pause(iter);
-               zfpm_g->t_conn_down = NULL;
                event_add_timer_msec(zfpm_g->master, zfpm_conn_down_thread_cb,
                                     NULL, 0, &zfpm_g->t_conn_down);
                return;
@@ -712,7 +714,7 @@ static void zfpm_connection_down(const char *detail)
         */
        assert(!zfpm_g->t_conn_down);
        zfpm_rnodes_iter_init(&zfpm_g->t_conn_down_state.iter);
-       zfpm_g->t_conn_down = NULL;
+       zfpm_conn_down_off();
        event_add_timer_msec(zfpm_g->master, zfpm_conn_down_thread_cb, NULL, 0,
                             &zfpm_g->t_conn_down);
        zfpm_g->stats.t_conn_down_starts++;
@@ -2042,6 +2044,7 @@ static int zfpm_fini(void)
        zfpm_write_off();
        zfpm_read_off();
        zfpm_connect_off();
+       zfpm_conn_down_off();
 
        zfpm_stop_stats_timer();