aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-04-10 13:34:47 -0700
committerDamjan Marion <dmarion@me.com>2022-04-11 10:07:31 +0000
commit179711d869f53430a50b46ca046694ea1b728f53 (patch)
tree3284d6a137b9a9a4063bb51f61fdf7ae63de9064
parentc520dcb49fa07d30de4944344b66fc325b44f17d (diff)
tls: fix connected notifications with no app wrk
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I805131b4e3d0cb2fab1d3bf76db659c67522c2e8
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.c6
-rw-r--r--src/vnet/tls/tls.c14
2 files changed, 14 insertions, 6 deletions
diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c
index f0c0b0d9c19..1e35f9d8e19 100644
--- a/src/plugins/tlsopenssl/tls_openssl.c
+++ b/src/plugins/tlsopenssl/tls_openssl.c
@@ -351,7 +351,11 @@ openssl_ctx_handshake_rx (tls_ctx_t * ctx, session_t * tls_session)
return -1;
}
}
- tls_notify_app_connected (ctx, SESSION_E_NONE);
+ if (tls_notify_app_connected (ctx, SESSION_E_NONE))
+ {
+ tls_disconnect_transport (ctx);
+ return -1;
+ }
}
else
{
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index 5f336cba0f0..3a781eb72c9 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -210,13 +210,16 @@ tls_notify_app_accept (tls_ctx_t * ctx)
int
tls_notify_app_connected (tls_ctx_t * ctx, session_error_t err)
{
+ u32 parent_app_api_ctx;
session_t *app_session;
app_worker_t *app_wrk;
app_wrk = app_worker_get_if_valid (ctx->parent_app_wrk_index);
if (!app_wrk)
{
- tls_disconnect_transport (ctx);
+ if (ctx->tls_type == TRANSPORT_PROTO_TLS)
+ session_free (session_get (ctx->c_s_index, ctx->c_thread_index));
+ ctx->no_app_session = 1;
return -1;
}
@@ -255,8 +258,11 @@ tls_notify_app_connected (tls_ctx_t * ctx, session_error_t err)
goto failed;
app_session->session_state = SESSION_STATE_READY;
- if (app_worker_connect_notify (app_wrk, app_session,
- SESSION_E_NONE, ctx->parent_app_api_context))
+ parent_app_api_ctx = ctx->parent_app_api_context;
+ ctx->app_session_handle = session_handle (app_session);
+
+ if (app_worker_connect_notify (app_wrk, app_session, SESSION_E_NONE,
+ parent_app_api_ctx))
{
TLS_DBG (1, "failed to notify app");
app_session->session_state = SESSION_STATE_CONNECTING;
@@ -264,8 +270,6 @@ tls_notify_app_connected (tls_ctx_t * ctx, session_error_t err)
return -1;
}
- ctx->app_session_handle = session_handle (app_session);
-
return 0;
failed: