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
committerMarco Varlese <marco.varlese@suse.de>2018-10-19 06:58:46 +0000
commit9a1e6eafd68b372e7aec53f75ac8f1881de72150 (patch)
tree6df01ec56c54ea500bbff4e33d9ecd996ae7bfe2 /src/vnet/tls/tls.c
parent703ee73dfbbec8c34ff7106170f5de05d9eae689 (diff)
tls: fix connection failures/interrupts at scale (VPP-1464)
Change-Id: I0bc4062c1fd3202ee201acb36a2bb14fc6ee1543 Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit c01d578a625fb136bc33b0eb9c19907769a67989)
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);
}