]> git.puffer.fish Git - mirror/frr.git/commitdiff
bfdd: fix detection timeout update 10189/head
authorIgor Ryzhov <iryzhov@nfware.com>
Wed, 24 Nov 2021 12:01:41 +0000 (15:01 +0300)
committermergify-bot <noreply@mergify.com>
Tue, 7 Dec 2021 11:39:47 +0000 (11:39 +0000)
Per RFC 5880 section 6.8.12, the use of a Poll Sequence is not necessary
when the Detect Multiplier is changed. Currently, we update the Detection
Timeout only when a Poll Sequence is terminated, therefore we ignore the
Detect Multiplier change if it's not accompanied with RX/TX timer change.
To fix the problem, we should update the Detection Timeout on every
received packet.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 074f76812bb1961a5d8a4e7b01d7f70f5da1978b)

bfdd/bfd.c
bfdd/bfd_packet.c

index c66fccb853ad3d23a255aec3a468cd13577c7794..96a9b3672aa90ade9ae2249e9cb272953480cfda 100644 (file)
@@ -1256,27 +1256,6 @@ void bs_final_handler(struct bfd_session *bs)
        /* Apply new transmission timer immediately. */
        ptm_bfd_start_xmt_timer(bs, false);
 
-       /*
-        * Detection timeout calculation:
-        * The minimum detection timeout is the remote detection
-        * multipler (number of packets to be missed) times the agreed
-        * transmission interval.
-        *
-        * RFC 5880, Section 6.8.4.
-        *
-        * TODO: support sending/counting more packets inside detection
-        * timeout.
-        */
-       if (bs->timers.required_min_rx > bs->remote_timers.desired_min_tx)
-               bs->detect_TO = bs->remote_detect_mult
-                               * bs->timers.required_min_rx;
-       else
-               bs->detect_TO = bs->remote_detect_mult
-                               * bs->remote_timers.desired_min_tx;
-
-       /* Apply new receive timer immediately. */
-       bfd_recvtimer_update(bs);
-
        /* Notify watchers about changed timers. */
        control_notify_config(BCM_NOTIFY_CONFIG_UPDATE, bs);
 }
index 3d6ca6ddd34863ba2c69fd79ce56efba5be672d6..b9efea21d97f0d4544375718a1c2ed9f2fe94ede 100644 (file)
@@ -693,11 +693,26 @@ int bfd_recv_cb(struct thread *t)
 
                /* Handle poll finalization. */
                bs_final_handler(bfd);
-       } else {
-               /* Received a packet, lets update the receive timer. */
-               bfd_recvtimer_update(bfd);
        }
 
+       /*
+        * Detection timeout calculation:
+        * The minimum detection timeout is the remote detection
+        * multipler (number of packets to be missed) times the agreed
+        * transmission interval.
+        *
+        * RFC 5880, Section 6.8.4.
+        */
+       if (bfd->cur_timers.required_min_rx > bfd->remote_timers.desired_min_tx)
+               bfd->detect_TO = bfd->remote_detect_mult
+                                * bfd->cur_timers.required_min_rx;
+       else
+               bfd->detect_TO = bfd->remote_detect_mult
+                                * bfd->remote_timers.desired_min_tx;
+
+       /* Apply new receive timer immediately. */
+       bfd_recvtimer_update(bfd);
+
        /* Handle echo timers changes. */
        bs_echo_timer_handler(bfd);