]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: FPM should have a way of shutting down
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 18 Nov 2019 19:38:39 +0000 (14:38 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 18 Nov 2019 19:49:46 +0000 (14:49 -0500)
When we shut down zebra, we were not doing anything to shut
down the FPM.  Perform the necessary occult rituals and
stop the threads from running during early shutdown.

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

index 5d88d4eeb47cfe9accf2e46e8c7aa46dde728114..fa48c03c713abb52b198822860f78771a1dfee75 100644 (file)
@@ -498,6 +498,11 @@ static inline void zfpm_write_off(void)
        THREAD_WRITE_OFF(zfpm_g->t_write);
 }
 
+static inline void zfpm_connect_off(void)
+{
+       THREAD_TIMER_OFF(zfpm_g->t_connect);
+}
+
 /*
  * zfpm_conn_up_thread_cb
  *
@@ -731,7 +736,6 @@ static int zfpm_read_cb(struct thread *thread)
        fpm_msg_hdr_t *hdr;
 
        zfpm_g->stats.read_cb_calls++;
-       zfpm_g->t_read = NULL;
 
        /*
         * Check if async connect is now done.
@@ -1157,7 +1161,6 @@ static int zfpm_write_cb(struct thread *thread)
        int num_writes;
 
        zfpm_g->stats.write_cb_calls++;
-       zfpm_g->t_write = NULL;
 
        /*
         * Check if async connect is now done.
@@ -1241,7 +1244,6 @@ static int zfpm_connect_cb(struct thread *t)
        int sock, ret;
        struct sockaddr_in serv;
 
-       zfpm_g->t_connect = NULL;
        assert(zfpm_g->state == ZFPM_STATE_ACTIVE);
 
        sock = socket(AF_INET, SOCK_STREAM, 0);
@@ -2029,11 +2031,24 @@ static int zfpm_init(struct thread_master *master)
        return 0;
 }
 
+static int zfpm_fini(void)
+{
+       zfpm_write_off();
+       zfpm_read_off();
+       zfpm_connect_off();
+
+       zfpm_stop_stats_timer();
+
+       hook_unregister(rib_update, zfpm_trigger_update);
+       return 0;
+}
+
 static int zebra_fpm_module_init(void)
 {
        hook_register(rib_update, zfpm_trigger_update);
        hook_register(zebra_rmac_update, zfpm_trigger_rmac_update);
        hook_register(frr_late_init, zfpm_init);
+       hook_register(frr_early_fini, zfpm_fini);
        return 0;
 }