Shut down session queue input nodes on exit 02/9602/1
authorDave Barach <dave@barachs.net>
Tue, 28 Nov 2017 15:11:42 +0000 (10:11 -0500)
committerDave Barach <dave@barachs.net>
Tue, 28 Nov 2017 15:12:25 +0000 (10:12 -0500)
Shut off (especially) worker-thread session queue input nodes.
Otherwise, vpp can crash when the main thread unmaps the API segment.

Change-Id: Idf855e7570e0066cc921ae34bc53afabaa9e1dba
Signed-off-by: Dave Barach <dave@barachs.net>
src/vnet/session/session.h
src/vnet/session/session_node.c

index cf1bc9d..2a0b0cc 100644 (file)
@@ -538,6 +538,8 @@ do {                                                                        \
       return clib_error_return(0, "session layer is not enabled");     \
 } while (0)
 
+void session_node_enable_disable (u8 is_en);
+
 #endif /* __included_session_h__ */
 
 /*
index ce460e9..f647360 100644 (file)
@@ -705,6 +705,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
  *