session: fix preallocation of local endpoint table
[vpp.git] / src / vnet / session / session_node.c
index ce460e9..08baa44 100644 (file)
@@ -629,7 +629,10 @@ skip_dequeue:
          /* Can retransmit for closed sessions but can't do anything if
           * session is not ready or closed */
          if (PREDICT_FALSE (s0->session_state < SESSION_STATE_READY))
-           continue;
+           {
+             vec_add1 (smm->pending_event_vector[my_thread_index], *e0);
+             continue;
+           }
          /* Spray packets in per session type frames, since they go to
           * different nodes */
          rv = (smm->session_tx_fns[s0->session_type]) (vm, node, smm, e0, s0,
@@ -705,6 +708,25 @@ VLIB_REGISTER_NODE (session_queue_node) =
 };
 /* *INDENT-ON* */
 
+static clib_error_t *
+session_queue_exit (vlib_main_t * vm)
+{
+  if (vec_len (vlib_mains) < 2)
+    return 0;
+
+  /*
+   * Shut off (especially) worker-thread session nodes.
+   * Otherwise, vpp can crash as the main thread unmaps the
+   * API segment.
+   */
+  vlib_worker_thread_barrier_sync (vm);
+  session_node_enable_disable (0 /* is_enable */ );
+  vlib_worker_thread_barrier_release (vm);
+  return 0;
+}
+
+VLIB_MAIN_LOOP_EXIT_FUNCTION (session_queue_exit);
+
 /*
  * fd.io coding-style-patch-verification: ON
  *