diff options
author | Florin Coras <fcoras@cisco.com> | 2023-10-17 11:59:49 -0700 |
---|---|---|
committer | Dave Barach <vpp@barachs.net> | 2024-09-26 20:44:34 +0000 |
commit | d0e8bd75f6371d09f31f48ffaf5843dce86ca8e6 (patch) | |
tree | 60afbb7769d3c4abce413d5055387ef031c975d5 /src/vnet | |
parent | 2193fd06492ee0f9a8c9b89fe665ecbc4d50cefe (diff) |
tls: cleanup engine hs cb and improve ctx formatting
Handshake completion is now tracked via a ctx flag so we no longer need
ctx_handshake_is_over.
Also, as we no longer prealloc application sessions, improve ctx state
formatting.
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: If48588ecde13e56fb99d1a46238bda53ed4eae1b
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/tls/tls.c | 24 | ||||
-rw-r--r-- | src/vnet/tls/tls.h | 5 | ||||
-rw-r--r-- | src/vnet/tls/tls_inlines.h | 6 |
3 files changed, 15 insertions, 20 deletions
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c index 9ca3a91af29..8754b67ca31 100644 --- a/src/vnet/tls/tls.c +++ b/src/vnet/tls/tls.c @@ -310,7 +310,7 @@ send_reply: void tls_notify_app_io_error (tls_ctx_t *ctx) { - ASSERT (tls_ctx_handshake_is_over (ctx)); + ASSERT (ctx->flags & TLS_CONN_F_HS_DONE); session_transport_reset_notify (&ctx->connection); session_transport_closed_notify (&ctx->connection); @@ -926,24 +926,26 @@ static u8 * format_tls_ctx_state (u8 * s, va_list * args) { tls_ctx_t *ctx; - session_t *ts; + session_t *as; ctx = va_arg (*args, tls_ctx_t *); - ts = session_get (ctx->c_s_index, ctx->c_thread_index); - if (ts->session_state == SESSION_STATE_LISTENING) + as = session_get (ctx->c_s_index, ctx->c_thread_index); + if (as->session_state == SESSION_STATE_LISTENING) s = format (s, "%s", "LISTEN"); else { - if (ts->session_state >= SESSION_STATE_TRANSPORT_CLOSED) + if (as->session_state == SESSION_STATE_READY) + s = format (s, "%s", "ESTABLISHED"); + else if (as->session_state == SESSION_STATE_ACCEPTING) + s = format (s, "%s", "ACCEPTING"); + else if (as->session_state == SESSION_STATE_CONNECTING) + s = format (s, "%s", "CONNECTING"); + else if (as->session_state >= SESSION_STATE_TRANSPORT_CLOSED) s = format (s, "%s", "CLOSED"); - else if (ts->session_state == SESSION_STATE_APP_CLOSED) - s = format (s, "%s", "APP-CLOSED"); - else if (ts->session_state >= SESSION_STATE_TRANSPORT_CLOSING) + else if (as->session_state >= SESSION_STATE_TRANSPORT_CLOSING) s = format (s, "%s", "CLOSING"); - else if (tls_ctx_handshake_is_over (ctx)) - s = format (s, "%s", "ESTABLISHED"); else - s = format (s, "%s", "HANDSHAKE"); + s = format (s, "UNHANDLED %u", as->session_state); } return s; diff --git a/src/vnet/tls/tls.h b/src/vnet/tls/tls.h index 30bcce005fb..e56c4c079ac 100644 --- a/src/vnet/tls/tls.h +++ b/src/vnet/tls/tls.h @@ -142,9 +142,8 @@ typedef struct tls_engine_vft_ int (*ctx_init_client) (tls_ctx_t * ctx); int (*ctx_init_server) (tls_ctx_t * ctx); int (*ctx_read) (tls_ctx_t * ctx, session_t * tls_session); - int (*ctx_write) (tls_ctx_t * ctx, session_t * app_session, - transport_send_params_t * sp); - u8 (*ctx_handshake_is_over) (tls_ctx_t * ctx); + int (*ctx_write) (tls_ctx_t *ctx, session_t *app_session, + transport_send_params_t *sp); int (*ctx_start_listen) (tls_ctx_t * ctx); int (*ctx_stop_listen) (tls_ctx_t * ctx); int (*ctx_transport_close) (tls_ctx_t * ctx); diff --git a/src/vnet/tls/tls_inlines.h b/src/vnet/tls/tls_inlines.h index 18002730a30..3e3f59fcf51 100644 --- a/src/vnet/tls/tls_inlines.h +++ b/src/vnet/tls/tls_inlines.h @@ -114,12 +114,6 @@ tls_ctx_app_close (tls_ctx_t *ctx) return tls_vfts[ctx->tls_ctx_engine].ctx_app_close (ctx); } -static inline u8 -tls_ctx_handshake_is_over (tls_ctx_t *ctx) -{ - return tls_vfts[ctx->tls_ctx_engine].ctx_handshake_is_over (ctx); -} - static inline int tls_reinit_ca_chain (crypto_engine_type_t tls_engine_id) { |