]> git.proxmox.com Git - mirror_frr.git/blobdiff - bfdd/event.c
vrrpd: search all vr's for mvl_ifp to null
[mirror_frr.git] / bfdd / event.c
index 63f64077ebd40da8ff35fc5f695e2c5f412a96e9..5ba54c2b0b2a1422a4b7eadc5e9d9d5bc4b4fc1d 100644 (file)
@@ -39,8 +39,12 @@ void bfd_recvtimer_update(struct bfd_session *bs)
 {
        struct timeval tv = {.tv_sec = 0, .tv_usec = bs->detect_TO};
 
+       /* Remove previous schedule if any. */
+       bfd_recvtimer_delete(bs);
+
        /* Don't add event if peer is deactivated. */
-       if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN))
+       if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN) ||
+           bs->sock == -1)
                return;
 
        tv_normalize(&tv);
@@ -48,9 +52,6 @@ void bfd_recvtimer_update(struct bfd_session *bs)
        log_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec, tv.tv_usec);
 #endif /* BFD_EVENT_DEBUG */
 
-       /* Remove previous schedule if any. */
-       bfd_recvtimer_delete(bs);
-
        thread_add_timer_tv(master, bfd_recvtimer_cb, bs, &tv,
                            &bs->recvtimer_ev);
 }
@@ -59,8 +60,12 @@ void bfd_echo_recvtimer_update(struct bfd_session *bs)
 {
        struct timeval tv = {.tv_sec = 0, .tv_usec = bs->echo_detect_TO};
 
+       /* Remove previous schedule if any. */
+       bfd_echo_recvtimer_delete(bs);
+
        /* Don't add event if peer is deactivated. */
-       if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN))
+       if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN) ||
+           bs->sock == -1)
                return;
 
        tv_normalize(&tv);
@@ -68,9 +73,6 @@ void bfd_echo_recvtimer_update(struct bfd_session *bs)
        log_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec, tv.tv_usec);
 #endif /* BFD_EVENT_DEBUG */
 
-       /* Remove previous schedule if any. */
-       bfd_echo_recvtimer_delete(bs);
-
        thread_add_timer_tv(master, bfd_echo_recvtimer_cb, bs, &tv,
                            &bs->echo_recvtimer_ev);
 }
@@ -79,8 +81,12 @@ void bfd_xmttimer_update(struct bfd_session *bs, uint64_t jitter)
 {
        struct timeval tv = {.tv_sec = 0, .tv_usec = jitter};
 
+       /* Remove previous schedule if any. */
+       bfd_xmttimer_delete(bs);
+
        /* Don't add event if peer is deactivated. */
-       if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN))
+       if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN) ||
+           bs->sock == -1)
                return;
 
        tv_normalize(&tv);
@@ -88,9 +94,6 @@ void bfd_xmttimer_update(struct bfd_session *bs, uint64_t jitter)
        log_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec, tv.tv_usec);
 #endif /* BFD_EVENT_DEBUG */
 
-       /* Remove previous schedule if any. */
-       bfd_xmttimer_delete(bs);
-
        thread_add_timer_tv(master, bfd_xmt_cb, bs, &tv, &bs->xmttimer_ev);
 }
 
@@ -98,8 +101,12 @@ void bfd_echo_xmttimer_update(struct bfd_session *bs, uint64_t jitter)
 {
        struct timeval tv = {.tv_sec = 0, .tv_usec = jitter};
 
+       /* Remove previous schedule if any. */
+       bfd_echo_xmttimer_delete(bs);
+
        /* Don't add event if peer is deactivated. */
-       if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN))
+       if (BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN) ||
+           bs->sock == -1)
                return;
 
        tv_normalize(&tv);
@@ -107,9 +114,6 @@ void bfd_echo_xmttimer_update(struct bfd_session *bs, uint64_t jitter)
        log_debug("%s: sec = %ld, usec = %ld", __func__, tv.tv_sec, tv.tv_usec);
 #endif /* BFD_EVENT_DEBUG */
 
-       /* Remove previous schedule if any. */
-       bfd_echo_xmttimer_delete(bs);
-
        thread_add_timer_tv(master, bfd_echo_xmt_cb, bs, &tv,
                            &bs->echo_xmttimer_ev);
 }