aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2020-01-17 10:01:52 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-01-29 12:32:38 +0000
commit95993c64a375887120466d750c750a27861fca96 (patch)
treecbe42637945d591e6882a4c49f4cb5231a269c78
parenta06f68556e506a6ff7f31a617a036614c84f71c0 (diff)
bfd: reset peer discriminator on timeout
More RFC compliance. Ticket: VPP-1816 BFD: peer discriminator not reset on timeout Type: fix Change-Id: I68063c18097d282b3527e3fb485c1d0d1fd1b0c8 Signed-off-by: Klement Sekera <ksekera@cisco.com>
-rw-r--r--src/vnet/bfd/bfd_main.c13
-rw-r--r--test/test_bfd.py11
2 files changed, 24 insertions, 0 deletions
diff --git a/src/vnet/bfd/bfd_main.c b/src/vnet/bfd/bfd_main.c
index 0cc7d72c600..ef6ada8823f 100644
--- a/src/vnet/bfd/bfd_main.c
+++ b/src/vnet/bfd/bfd_main.c
@@ -1054,6 +1054,19 @@ bfd_check_rx_timeout (bfd_main_t * bm, bfd_session_t * bs, u64 now,
now + bm->wheel_inaccuracy)
{
BFD_DBG ("Rx timeout, session goes down");
+ /*
+ * RFC 5880 6.8.1. State Variables
+
+ * bfd.RemoteDiscr
+
+ * The remote discriminator for this BFD session. This is the
+ * discriminator chosen by the remote system, and is totally opaque
+ * to the local system. This MUST be initialized to zero. If a
+ * period of a Detection Time passes without the receipt of a valid,
+ * authenticated BFD packet from the remote system, this variable
+ * MUST be set to zero.
+ */
+ bs->remote_discr = 0;
bfd_set_diag (bs, BFD_DIAG_CODE_det_time_exp);
bfd_set_state (bm, bs, BFD_STATE_down, handling_wakeup);
/*
diff --git a/test/test_bfd.py b/test/test_bfd.py
index 9a37eb8fed7..2443a046802 100644
--- a/test/test_bfd.py
+++ b/test/test_bfd.py
@@ -831,6 +831,16 @@ class BFD4TestCase(VppTestCase):
e = self.vapi.wait_for_event(1, "bfd_udp_session_details")
verify_event(self, e, expected_state=BFDState.down)
+ def test_peer_discr_reset_sess_down(self):
+ """ peer discriminator reset after session goes down """
+ bfd_session_up(self)
+ detection_time = self.test_session.detect_mult *\
+ self.vpp_session.required_min_rx / USEC_IN_SEC
+ self.sleep(detection_time, "waiting for BFD session time-out")
+ self.test_session.my_discriminator = 0
+ wait_for_bfd_packet(self,
+ pcap_time_min=time.time() - self.vpp_clock_offset)
+
@unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_large_required_min_rx(self):
""" large remote required min rx interval """
@@ -2129,6 +2139,7 @@ class BFDSHA1TestCase(VppTestCase):
self.test_session.vpp_seq_number = None
# now throw away any pending packets
self.pg0.enable_capture()
+ self.test_session.my_discriminator = 0
bfd_session_up(self)