bfd: reset peer discriminator on timeout
[vpp.git] / src / vnet / bfd / bfd_main.c
index ea58413..ef6ada8 100644 (file)
@@ -908,7 +908,6 @@ bfd_send_echo (vlib_main_t * vm, vlib_node_runtime_t * rt,
        }
       vlib_buffer_t *b = vlib_get_buffer (vm, bi);
       ASSERT (b->current_data == 0);
-      clib_memset (vnet_buffer (b), 0, sizeof (*vnet_buffer (b)));
       VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
       bfd_echo_pkt_t *pkt = vlib_buffer_get_current (b);
       clib_memset (pkt, 0, sizeof (*pkt));
@@ -982,7 +981,6 @@ bfd_send_periodic (vlib_main_t * vm, vlib_node_runtime_t * rt,
        }
       vlib_buffer_t *b = vlib_get_buffer (vm, bi);
       ASSERT (b->current_data == 0);
-      clib_memset (vnet_buffer (b), 0, sizeof (*vnet_buffer (b)));
       VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
       bfd_init_control_frame (bm, bs, b);
       switch (bs->poll_state)
@@ -1056,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);
       /*