]> git.puffer.fish Git - mirror/frr.git/commitdiff
bfdd: don't update peers settings on shutdown
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Fri, 29 May 2020 20:44:54 +0000 (17:44 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Fri, 29 May 2020 20:55:40 +0000 (17:55 -0300)
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>
bfdd/bfd.c
bfdd/bfd.h
bfdd/bfdd.c

index f51136e98053f8325ddfba9fd68a6cd599db095f..b8f25710dc8f4357a94b439499896241a0c8e061 100644 (file)
@@ -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);
index 5984662a01b5c3c2be5e1a8e124ccf9be12b6bb3..492334a670cf9a232dbdc84d0066c129dd30f1f6 100644 (file)
@@ -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;
index 39d51eb6492f4c6dda0c78b7ae8c89cf6517ad8d..9131417f179c35582814213043c65c51e7d721a2 100644 (file)
@@ -63,6 +63,8 @@ static void sigusr1_handler(void)
 
 static void sigterm_handler(void)
 {
+       bglobal.bg_shutdown = true;
+
        /* Signalize shutdown. */
        frr_early_fini();