summaryrefslogtreecommitdiffstats
path: root/src/vnet/tls/tls.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-09-14 14:46:39 -0700
committerDamjan Marion <dmarion@me.com>2018-09-15 08:10:27 +0000
commitb5e94e3c8582a00b920d7b22dd839b94e7ded595 (patch)
treebd6a125fc534ac42d1a325b9d1f4b73e11396efe /src/vnet/tls/tls.c
parentdf7f8e8cffcc43531f7daeda44d436b60e538141 (diff)
tls: use application interface apis
This also exposes app to tls sessions. As a result "sh session verbose" will show for each tls session both the application's session (app to tls) and the tls session (tls to tcp). Change-Id: I1e65c63362ce58f314e762d7db78b44479e1e3a5 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tls/tls.c')
-rw-r--r--src/vnet/tls/tls.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index a34d0db6c88..d5dbf2e16d1 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -177,6 +177,8 @@ tls_notify_app_accept (tls_ctx_t * ctx)
}
ctx->c_s_index = app_session->session_index;
ctx->app_session_handle = session_handle (app_session);
+ session_lookup_add_connection (&ctx->connection,
+ session_handle (app_session));
return app->cb_fns.session_accept_callback (app_session);
}
@@ -217,6 +219,9 @@ tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed)
tls_disconnect (ctx->tls_ctx_handle, vlib_get_thread_index ());
}
+ session_lookup_add_connection (&ctx->connection,
+ session_handle (app_session));
+
return 0;
failed:
@@ -499,23 +504,21 @@ tls_connect (transport_endpoint_t * tep)
void
tls_disconnect (u32 ctx_handle, u32 thread_index)
{
- stream_session_t *tls_session, *app_session;
tls_ctx_t *ctx;
TLS_DBG (1, "Disconnecting %x", ctx_handle);
ctx = tls_ctx_get (ctx_handle);
- tls_session = session_get_from_handle (ctx->tls_session_handle);
- stream_session_disconnect (tls_session);
- app_session = session_get_from_handle_if_valid (ctx->app_session_handle);
- if (app_session)
- {
- segment_manager_dealloc_fifos (app_session->svm_segment_index,
- app_session->server_rx_fifo,
- app_session->server_tx_fifo);
- session_free (app_session);
- }
+ 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");
+
+ stream_session_delete_notify (&ctx->connection);
tls_ctx_free (ctx);
}
@@ -575,13 +578,18 @@ tls_start_listen (u32 app_listener_index, transport_endpoint_t * tep)
u32
tls_stop_listen (u32 lctx_index)
{
- tls_main_t *tm = &tls_main;
- tls_ctx_t *lctx;
tls_engine_type_t engine_type;
+ tls_ctx_t *lctx;
lctx = tls_listener_ctx_get (lctx_index);
- /* TODO use unbind */
- application_stop_listen (tm->app_index, 0, lctx->tls_session_handle);
+ vnet_unbind_args_t a = {
+ .handle = lctx->tls_session_handle,
+ .app_index = tls_main.app_index,
+ .wrk_map_index = 0 /* default wrk */
+ };
+ if (vnet_unbind (&a))
+ clib_warning ("unbind returned");
+
engine_type = lctx->tls_ctx_engine;
tls_vfts[engine_type].ctx_stop_listen (lctx);