summaryrefslogtreecommitdiffstats
path: root/src/vnet/tls/tls.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-10-17 14:53:11 -0700
committerFlorin Coras <florin.coras@gmail.com>2018-10-18 18:47:20 +0000
commitc01d578a625fb136bc33b0eb9c19907769a67989 (patch)
tree557adb6e81fc90a5a5d5c3a9f56f33d80672e8b5 /src/vnet/tls/tls.c
parentc5347d9d42866881fa3f267e76bee828dfc9e1bc (diff)
tls: fix connection failures/interrupts at scale (VPP-1464)
Change-Id: I0bc4062c1fd3202ee201acb36a2bb14fc6ee1543 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tls/tls.c')
-rw-r--r--src/vnet/tls/tls.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index 9a82360610b..f4814a3ce21 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -26,6 +26,18 @@ static tls_engine_vft_t *tls_vfts;
void tls_disconnect (u32 ctx_handle, u32 thread_index);
+static void
+tls_disconnect_transport (tls_ctx_t * ctx)
+{
+ vnet_disconnect_args_t a = {
+ .handle = ctx->tls_session_handle,
+ .app_index = tls_main.app_index,
+ };
+
+ if (vnet_disconnect_session (&a))
+ clib_warning ("disconnect returned");
+}
+
tls_engine_type_t
tls_get_available_engine (void)
{
@@ -91,6 +103,8 @@ tls_listener_ctx_alloc (void)
void
tls_listener_ctx_free (tls_ctx_t * ctx)
{
+ if (CLIB_DEBUG)
+ memset (ctx, 0xfb, sizeof (*ctx));
pool_put (tls_main.listener_ctx_pool, ctx);
}
@@ -226,7 +240,7 @@ tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed)
app_wrk = app_worker_get_if_valid (ctx->parent_app_index);
if (!app_wrk)
{
- tls_disconnect (ctx->tls_ctx_handle, vlib_get_thread_index ());
+ tls_disconnect_transport (ctx);
return -1;
}
@@ -249,16 +263,16 @@ tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed)
ctx->app_session_handle = session_handle (app_session);
ctx->c_s_index = app_session->session_index;
- app_session->session_state = SESSION_STATE_READY;
+ app_session->session_state = SESSION_STATE_CONNECTING;
if (cb_fn (ctx->parent_app_index, ctx->parent_app_api_context,
app_session, 0 /* not failed */ ))
{
TLS_DBG (1, "failed to notify app");
tls_disconnect (ctx->tls_ctx_handle, vlib_get_thread_index ());
- session_free_w_fifos (app_session);
return -1;
}
+ app_session->session_state = SESSION_STATE_READY;
session_lookup_add_connection (&ctx->connection,
session_handle (app_session));
@@ -553,15 +567,7 @@ tls_disconnect (u32 ctx_handle, u32 thread_index)
TLS_DBG (1, "Disconnecting %x", ctx_handle);
ctx = tls_ctx_get (ctx_handle);
-
- vnet_disconnect_args_t a = {
- .handle = ctx->tls_session_handle,
- .app_index = tls_main.app_index,
- };
-
- if (vnet_disconnect_session (&a))
- clib_warning ("disconnect returned");
-
+ tls_disconnect_transport (ctx);
stream_session_delete_notify (&ctx->connection);
tls_ctx_free (ctx);
}