diff options
author | Florin Coras <fcoras@cisco.com> | 2019-03-06 14:44:42 -0800 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-03-11 09:15:01 +0000 |
commit | bf7ce2cd3c4e5561f7cc70a49e6da4fab557b873 (patch) | |
tree | 1deaf9721bca8ad54b16d49c141879cddb12d056 /src/vnet/tls | |
parent | 9f1a5432b3e6fa57bfe0788ca0ebb84075253bf7 (diff) |
tls: fixes and improvements
- disconnect sessions through session layer apis instead of directly
notifying the app worker.
- improve cli
- increase fifo sizes for tls app
Change-Id: I8a7d2865b3b00724e2a9da29fa4a906ea867da9b
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tls')
-rw-r--r-- | src/vnet/tls/tls.c | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c index c64a6d18561..714ebfe4c13 100644 --- a/src/vnet/tls/tls.c +++ b/src/vnet/tls/tls.c @@ -180,10 +180,10 @@ tls_ctx_half_open_index (tls_ctx_t * ctx) void tls_notify_app_enqueue (tls_ctx_t * ctx, session_t * app_session) { - app_worker_t *app; - app = app_worker_get_if_valid (app_session->app_wrk_index); - if (PREDICT_TRUE (app != 0)) - tls_add_app_q_evt (app, app_session); + app_worker_t *app_wrk; + app_wrk = app_worker_get_if_valid (app_session->app_wrk_index); + if (PREDICT_TRUE (app_wrk != 0)) + tls_add_app_q_evt (app_wrk, app_session); } int @@ -362,10 +362,10 @@ tls_del_segment_callback (u32 client_index, u64 segment_handle) void tls_session_disconnect_callback (session_t * tls_session) { - session_t *app_session; tls_ctx_t *ctx; - app_worker_t *app_wrk; - application_t *app; + + TLS_DBG (1, "TCP disconnecting handle %x session %u", tls_session->opaque, + tls_session->session_index); ctx = tls_ctx_get (tls_session->opaque); if (!tls_ctx_handshake_is_over (ctx)) @@ -374,10 +374,7 @@ tls_session_disconnect_callback (session_t * tls_session) return; } ctx->is_passive_close = 1; - app_wrk = app_worker_get (ctx->parent_app_wrk_index); - app = application_get (app_wrk->app_index); - app_session = session_get_from_handle (ctx->app_session_handle); - app->cb_fns.session_disconnect_callback (app_session); + session_transport_closing_notify (&ctx->connection); } int @@ -654,8 +651,11 @@ tls_custom_tx_callback (void *session) { session_t *app_session = (session_t *) session; tls_ctx_t *ctx; - if (PREDICT_FALSE (app_session->session_state == SESSION_STATE_CLOSED)) + + if (PREDICT_FALSE (app_session->session_state + >= SESSION_STATE_TRANSPORT_CLOSED)) return 0; + ctx = tls_ctx_get (app_session->connection_index); tls_ctx_write (ctx, app_session); return 0; @@ -664,16 +664,16 @@ tls_custom_tx_callback (void *session) u8 * format_tls_ctx (u8 * s, va_list * args) { + u32 tcp_si, tcp_ti, ctx_index, ctx_engine, app_si, app_ti; tls_ctx_t *ctx = va_arg (*args, tls_ctx_t *); - u32 thread_index = va_arg (*args, u32); - u32 child_si, child_ti; - session_parse_handle (ctx->tls_session_handle, &child_si, &child_ti); - if (thread_index != child_ti) - clib_warning ("app and tls sessions are on different threads!"); + session_parse_handle (ctx->tls_session_handle, &tcp_si, &tcp_ti); + tls_ctx_parse_handle (ctx->tls_ctx_handle, &ctx_index, &ctx_engine); + session_parse_handle (ctx->app_session_handle, &app_si, &app_ti); + s = format (s, "[%d:%d][TLS] app_wrk %u index %u engine %u tcp %d:%d", + app_ti, app_si, ctx->parent_app_wrk_index, ctx_index, + ctx_engine, tcp_ti, tcp_si); - s = format (s, "[#%d][TLS] app %u child %u", child_ti, - ctx->parent_app_wrk_index, child_si); return s; } @@ -689,7 +689,7 @@ format_tls_connection (u8 * s, va_list * args) if (!ctx) return s; - s = format (s, "%-50U", format_tls_ctx, ctx, thread_index); + s = format (s, "%-50U", format_tls_ctx, ctx); if (verbose) { session_t *ts; @@ -707,12 +707,17 @@ format_tls_listener (u8 * s, va_list * args) u32 tc_index = va_arg (*args, u32); u32 __clib_unused verbose = va_arg (*args, u32); tls_ctx_t *ctx = tls_listener_ctx_get (tc_index); - u32 listener_index, thread_index; + session_t *tls_listener; + app_listener_t *al; + u32 app_si, app_ti; - listen_session_parse_handle (ctx->tls_session_handle, &listener_index, - &thread_index); - return format (s, "[TLS] listener app %u child %u", - ctx->parent_app_wrk_index, listener_index); + al = app_listener_get_w_handle (ctx->tls_session_handle); + tls_listener = app_listener_get_session (al); + session_parse_handle (ctx->app_session_handle, &app_si, &app_ti); + s = format (s, "[%d:%d][TLS] app_wrk %u engine %u tcp %d:%d", + app_ti, app_si, ctx->parent_app_wrk_index, ctx->tls_ctx_engine, + tls_listener->thread_index, tls_listener->session_index); + return s; } u8 * @@ -755,9 +760,9 @@ tls_init (vlib_main_t * vm) vlib_thread_main_t *vtm = vlib_get_thread_main (); vnet_app_attach_args_t _a, *a = &_a; u64 options[APP_OPTIONS_N_OPTIONS]; - u32 segment_size = 512 << 20; + u32 segment_size = 2048 << 20; tls_main_t *tm = &tls_main; - u32 fifo_size = 64 << 10; + u32 fifo_size = 128 << 10; u32 num_threads; num_threads = 1 /* main thread */ + vtm->n_threads; |