From 64a4062d8abe90a9e00e14a8327da0c17591eef7 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 22 Oct 2025 00:32:34 -0400 Subject: [PATCH] http tls: fix half-open formatting Type: fix Change-Id: I362a7070a6f5a89358bf01d6e9ab05df18c9ec6e Signed-off-by: Florin Coras --- src/plugins/http/http.c | 33 ++++++++++++++++++++++----------- src/vnet/session/session_types.h | 2 +- src/vnet/tls/tls.c | 11 ++++++++--- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c index 0ef19a51358..5e6672cd7dc 100644 --- a/src/plugins/http/http.c +++ b/src/plugins/http/http.c @@ -219,6 +219,7 @@ http_ho_conn_alloc (void) pool_get_aligned_safe (hm->ho_conn_pool, hc, CLIB_CACHE_LINE_BYTES); clib_memset (hc, 0, sizeof (*hc)); hc->hc_hc_index = hc - hm->ho_conn_pool; + hc->c_thread_index = transport_cl_thread (); hc->hc_pa_session_handle = SESSION_INVALID_HANDLE; hc->hc_tc_session_handle = SESSION_INVALID_HANDLE; hc->timeout = HTTP_CONN_TIMEOUT; @@ -1376,6 +1377,19 @@ format_http_transport_listener (u8 *s, va_list *args) return s; } +static u8 * +format_http_ho_conn_id (u8 *s, va_list *args) +{ + http_conn_t *ho_hc = va_arg (*args, http_conn_t *); + + s = format (s, "[%d:%d][H] half-open app_wrk %u ts %d:%d", + ho_hc->c_thread_index, ho_hc->c_s_index, ho_hc->hc_pa_wrk_index, + session_thread_from_handle (ho_hc->hc_tc_session_handle), + session_index_from_handle (ho_hc->hc_tc_session_handle)); + + return s; +} + static u8 * format_http_transport_half_open (u8 *s, va_list *args) { @@ -1383,20 +1397,17 @@ format_http_transport_half_open (u8 *s, va_list *args) u32 __clib_unused thread_index = va_arg (*args, u32); u32 __clib_unused verbose = va_arg (*args, u32); http_conn_t *ho_hc; - session_t *tcp_ho; ho_hc = http_ho_conn_get (ho_index); - tcp_ho = session_get_from_handle_if_valid (ho_hc->hc_tc_session_handle); - if (tcp_ho) - s = - format (s, "[%d:%d][H] half-open app_wrk %u ts %d:%d", - ho_hc->c_thread_index, ho_hc->c_s_index, ho_hc->hc_pa_wrk_index, - tcp_ho->thread_index, tcp_ho->session_index); - else - s = - format (s, "[%d:%d][H] half-open app_wrk %u (postponed cleanup)", - ho_hc->c_thread_index, ho_hc->c_s_index, ho_hc->hc_pa_wrk_index); + s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_http_ho_conn_id, ho_hc); + + if (verbose) + s = format (s, "%-" SESSION_CLI_STATE_LEN "s", + (ho_hc->hc_tc_session_handle == SESSION_INVALID_HANDLE) ? + (ho_hc->flags & HTTP_CONN_F_HO_DONE) ? "CLOSED" : + "CLOSED-PNDG" : + "CONNECTING"); return s; } diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h index a75e21caf7d..147c00ab542 100644 --- a/src/vnet/session/session_types.h +++ b/src/vnet/session/session_types.h @@ -34,7 +34,7 @@ typedef union session_handle_tu_ struct { u32 session_index; - clib_thread_index_t thread_index; + u32 thread_index; }; } __attribute__ ((__transparent_union__)) session_handle_tu_t; diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c index 745c96c15b0..8c5d8174d3f 100644 --- a/src/vnet/tls/tls.c +++ b/src/vnet/tls/tls.c @@ -1049,16 +1049,21 @@ format_tls_half_open (u8 * s, va_list * args) u32 ho_index = va_arg (*args, u32); u32 __clib_unused thread_index = va_arg (*args, u32); u32 __clib_unused verbose = va_arg (*args, u32); - session_t *tcp_ho; tls_ctx_t *ho_ctx; ho_ctx = tls_ctx_half_open_get (ho_index); - tcp_ho = session_get_from_handle (ho_ctx->tls_session_handle); s = format (s, "[%d:%d][%s] half-open app_wrk %u engine %u ts %d:%d", ho_ctx->c_thread_index, ho_ctx->c_s_index, "TLS", ho_ctx->parent_app_wrk_index, ho_ctx->tls_ctx_engine, - tcp_ho->thread_index, tcp_ho->session_index); + session_thread_from_handle (ho_ctx->tls_session_handle), + session_index_from_handle (ho_ctx->tls_session_handle)); + if (verbose) + s = format ( + s, "%-" SESSION_CLI_STATE_LEN "s", + (ho_ctx->tls_session_handle == SESSION_INVALID_HANDLE) ? + ((ho_ctx->flags & TLS_CONN_F_HO_DONE) ? "CLOSED" : "CLOSED-PNDG") : + "CONNECTING"); return s; } -- 2.16.6