diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2019-05-22 19:12:09 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-05-23 04:17:40 +0000 |
commit | a9f194af9a7943922d8986584885b03d4538e12e (patch) | |
tree | a78b3d05d6e147503585f947f4626b34bb75d707 | |
parent | 3df5682e845ee71d3671a06c153f04b1b382a6fd (diff) |
fix show session verbose crash with quic transport
Type: fix
Change-Id: I8199c233f6968ac147fb1867a4f10ef04d67642f
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
-rw-r--r-- | src/plugins/quic/quic.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c index dbbc8c46fa4..ca48a905d0e 100644 --- a/src/plugins/quic/quic.c +++ b/src/plugins/quic/quic.c @@ -1374,9 +1374,48 @@ quic_listener_get (u32 listener_index) } static u8 * +format_quic_ctx (u8 * s, va_list * args) +{ + quic_ctx_t *ctx = va_arg (*args, quic_ctx_t *); + u32 verbose = va_arg (*args, u32); + + if (!ctx) + return s; + s = format (s, "[#%d][%s] ", ctx->c_thread_index, "Q"); + + if (ctx->is_listener) + { + s = format (s, "%s Listener: ", ctx->c_quic_ctx_id.is_stream ? + "Stream" : "QSession"); + if (verbose) + s = format (s, "app %d wrk %d", ctx->c_quic_ctx_id.parent_app_id, + ctx->c_quic_ctx_id.parent_app_wrk_id); + } + else + { + if (ctx->c_is_ip4) + s = format (s, "%U:%d->%U:%d", format_ip4_address, &ctx->c_lcl_ip4, + clib_net_to_host_u16 (ctx->c_lcl_port), + format_ip4_address, &ctx->c_rmt_ip4, + clib_net_to_host_u16 (ctx->c_rmt_port)); + else + s = format (s, "%U:%d->%U:%d", format_ip6_address, &ctx->c_lcl_ip6, + clib_net_to_host_u16 (ctx->c_lcl_port), + format_ip6_address, &ctx->c_rmt_ip6, + clib_net_to_host_u16 (ctx->c_rmt_port)); + } + return s; +} + +static u8 * format_quic_connection (u8 * s, va_list * args) { - s = format (s, "[QUIC] connection"); /* TODO */ + u32 qc_index = va_arg (*args, u32); + u32 thread_index = va_arg (*args, u32); + u32 verbose = va_arg (*args, u32); + quic_ctx_t *ctx = quic_ctx_get (qc_index, thread_index); + if (ctx) + s = format (s, "%-50U", format_quic_ctx, ctx, verbose); return s; } @@ -1393,7 +1432,14 @@ format_quic_half_open (u8 * s, va_list * args) static u8 * format_quic_listener (u8 * s, va_list * args) { - s = format (s, "[QUIC] listener"); /* TODO */ + u32 tci = va_arg (*args, u32); + u32 verbose = va_arg (*args, u32); + quic_ctx_t *ctx = quic_ctx_get (tci, vlib_get_thread_index ()); + if (ctx) + { + ASSERT (ctx->is_listener); + s = format (s, "%-50U", format_quic_ctx, ctx, verbose); + } return s; } |