diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-05-29 17:44:54 -0300 | 
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-05-29 17:55:40 -0300 | 
| commit | f3e1d2241e0e96de95640bd8ecef5ff61843f3a5 (patch) | |
| tree | 8f01dcabe39df0aa7b05a3b18542e18a64828e33 /bfdd | |
| parent | 95a99382cbeb756344c02aef44f862abee53c3b8 (diff) | |
bfdd: don't update peers settings on shutdown
During the shutdown phase don't attempt to apply settings to peers
as it is useless and will crash if the peer hash is gone.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'bfdd')
| -rw-r--r-- | bfdd/bfd.c | 3 | ||||
| -rw-r--r-- | bfdd/bfd.h | 6 | ||||
| -rw-r--r-- | bfdd/bfdd.c | 2 | 
3 files changed, 10 insertions, 1 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c index f51136e980..b8f25710dc 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -115,7 +115,8 @@ struct bfd_profile *bfd_profile_new(const char *name)  void bfd_profile_free(struct bfd_profile *bp)  {  	/* Detach from any session. */ -	bfd_profile_detach(bp); +	if (bglobal.bg_shutdown == false) +		bfd_profile_detach(bp);  	/* Remove from global list. */  	TAILQ_REMOVE(&bplist, bp, entry); diff --git a/bfdd/bfd.h b/bfdd/bfd.h index 5984662a01..492334a670 100644 --- a/bfdd/bfd.h +++ b/bfdd/bfd.h @@ -429,6 +429,12 @@ struct bfd_global {  	struct zebra_privs_t bfdd_privs; +	/** +	 * Daemon is exit()ing? Use this to avoid actions that expect a +	 * running system or to avoid unnecessary operations when quitting. +	 */ +	bool bg_shutdown; +  	/* Debug options. */  	/* Show all peer state changes events. */  	bool debug_peer_event; diff --git a/bfdd/bfdd.c b/bfdd/bfdd.c index 39d51eb649..9131417f17 100644 --- a/bfdd/bfdd.c +++ b/bfdd/bfdd.c @@ -63,6 +63,8 @@ static void sigusr1_handler(void)  static void sigterm_handler(void)  { +	bglobal.bg_shutdown = true; +  	/* Signalize shutdown. */  	frr_early_fini();  | 
