vcl: validate seg handle on migrate only if needed 25/31225/2
authorFlorin Coras <fcoras@cisco.com>
Wed, 10 Feb 2021 23:26:37 +0000 (15:26 -0800)
committerFlorin Coras <florin.coras@gmail.com>
Wed, 10 Feb 2021 23:22:22 +0000 (23:22 +0000)
Type: fix

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

src/vcl/vppcom.c
src/vnet/session/session_api.c

index bc83b55..80f0ad7 100644 (file)
@@ -636,12 +636,17 @@ vcl_session_migrated_handler (vcl_worker_t * wrk, void *data)
       return;
     }
 
-  fs_index = vcl_segment_table_lookup (mp->segment_handle);
-  if (fs_index == VCL_INVALID_SEGMENT_INDEX)
+  /* Only validate if a value is provided */
+  if (mp->segment_handle != SESSION_INVALID_HANDLE)
     {
-      VDBG (0, "segment for session %u is not mounted!", s->session_index);
-      s->session_state = VCL_STATE_DETACHED;
-      return;
+      fs_index = vcl_segment_table_lookup (mp->segment_handle);
+      if (fs_index == VCL_INVALID_SEGMENT_INDEX)
+       {
+         VDBG (0, "segment %lx for session %u is not mounted!",
+               mp->segment_handle, s->session_index);
+         s->session_state = VCL_STATE_DETACHED;
+         return;
+       }
     }
 
   s->vpp_handle = mp->new_handle;
index 0116a7e..e5021d4 100644 (file)
@@ -454,7 +454,7 @@ mq_send_session_migrate_cb (session_t * s, session_handle_t new_sh)
   mp->new_handle = new_sh;
   mp->vpp_thread_index = thread_index;
   mp->vpp_evt_q = fifo_segment_msg_q_offset (eq_seg, thread_index);
-  mp->segment_handle = session_segment_handle (s);
+  mp->segment_handle = SESSION_INVALID_HANDLE;
   svm_msg_q_add_and_unlock (app_mq, msg);
 }