summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2019-11-19 16:30:43 +0100
committerGitHub <noreply@github.com>2019-11-19 16:30:43 +0100
commit9546c1b5108c0e914955924d5b3e746fb225d1de (patch)
tree6747640679dd1cc678724771eadf592d035ac381
parentMerge pull request #5364 from lkrishnamoor/prefix_route_bugfix (diff)
parentzebra: FPM should have a way of shutting down (diff)
downloadfrr-9546c1b5108c0e914955924d5b3e746fb225d1de.tar.xz
frr-9546c1b5108c0e914955924d5b3e746fb225d1de.zip
Merge pull request #5361 from donaldsharp/fpm_crash
zebra: FPM should have a way of shutting down
-rw-r--r--zebra/zebra_fpm.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 5d88d4eeb..fa48c03c7 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -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;
}