]> git.puffer.fish Git - mirror/frr.git/commitdiff
bfdd: set session down after disabling it
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Fri, 11 Oct 2019 16:12:26 +0000 (13:12 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 14 Oct 2019 17:32:38 +0000 (14:32 -0300)
If a session is no longer able to send/receive packets, it is very
likely it will be down in a few milliseconds so lets speed up the
process and correctly mark it as down.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
bfdd/bfd.c

index 7e57bcbc71cc3ce87691199f3c4527ed4e674a6e..75af2baf626210ae68e0665e1e9bf22f0357da70 100644 (file)
@@ -213,10 +213,13 @@ void bfd_session_disable(struct bfd_session *bs)
 
        /* Disable all timers. */
        bfd_recvtimer_delete(bs);
-       bfd_echo_recvtimer_delete(bs);
        bfd_xmttimer_delete(bs);
-       bfd_echo_xmttimer_delete(bs);
+       ptm_bfd_echo_stop(bs);
        bs->vrf = NULL;
+       bs->ifp = NULL;
+
+       /* Set session down so it doesn't report UP and disabled. */
+       ptm_bfd_sess_dn(bs, BD_PATH_DOWN);
 }
 
 static uint32_t ptm_bfd_gen_ID(void)
@@ -329,7 +332,14 @@ void ptm_bfd_sess_dn(struct bfd_session *bfd, uint8_t diag)
        bfd->demand_mode = 0;
        monotime(&bfd->downtime);
 
-       ptm_bfd_snd(bfd, 0);
+       /*
+        * Only attempt to send if we have a valid socket:
+        * this function might be called by session disablers and in
+        * this case we won't have a valid socket (i.e. interface was
+        * removed or VRF doesn't exist anymore).
+        */
+       if (bfd->sock != -1)
+               ptm_bfd_snd(bfd, 0);
 
        /* Slow down the control packets, the connection is down. */
        bs_set_slow_timers(bfd);