vcl: notify vpp if connected inexistent session 55/34455/4
authorFlorin Coras <fcoras@cisco.com>
Thu, 11 Nov 2021 06:44:52 +0000 (22:44 -0800)
committerDave Barach <openvpp@barachs.net>
Thu, 11 Nov 2021 15:59:12 +0000 (15:59 +0000)
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I6939a0cdb02067440dce01cb0771f07099ca841e

src/vcl/vppcom.c

index 9f8edce..207e208 100644 (file)
@@ -508,10 +508,20 @@ vcl_session_connected_handler (vcl_worker_t * wrk,
 
   session_index = mp->context;
   session = vcl_session_get (wrk, session_index);
-  if (!session)
+  if (PREDICT_FALSE (!session))
     {
       VDBG (0, "ERROR: vpp handle 0x%llx has no session index (%u)!",
            mp->handle, session_index);
+      /* Should not happen but if it does, force vpp session cleanup */
+      vcl_session_t tmp_session = {
+       .vpp_handle = mp->handle,
+       .vpp_evt_q = 0,
+      };
+      vcl_segment_attach_session (
+       mp->segment_handle, mp->server_rx_fifo, mp->server_tx_fifo,
+       mp->vpp_event_queue_address, mp->mq_index, 0, session);
+      if (tmp_session.vpp_evt_q)
+       vcl_send_session_disconnect (wrk, &tmp_session);
       return VCL_INVALID_SESSION_INDEX;
     }
   if (mp->retval)