aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/quic
diff options
context:
space:
mode:
authorAloys Augustin <aloaugus@cisco.com>2019-07-12 17:11:04 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-07-12 17:55:31 +0000
commit95dd1fe279111f9accdeeecc0accff016f7e15fc (patch)
tree3b1e0442a15e78cd4b4a48388dcd769e9748d4d4 /src/plugins/quic
parentbec771b879c2eae31ecef61891405c1570aae2b1 (diff)
quic: fix show session verbose
Proprely display quic connections in show session verbose, and add a small fix for UDPC listeners and UDP sessions formatting. Change-Id: I33f83e77bf357347623d87ad23c483aba60a9bb2 Signed-off-by: Aloys Augustin <aloaugus@cisco.com> Type: feature
Diffstat (limited to 'src/plugins/quic')
-rw-r--r--src/plugins/quic/quic.c52
1 files changed, 23 insertions, 29 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 8e29e74e965..b46cdb3f018 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1632,32 +1632,30 @@ format_quic_ctx (u8 * s, va_list * args)
{
quic_ctx_t *ctx = va_arg (*args, quic_ctx_t *);
u32 verbose = va_arg (*args, u32);
+ u8 *str = 0;
if (!ctx)
return s;
- s = format (s, "[#%d][Q] ", ctx->c_thread_index);
+ str = format (str, "[#%d][Q] ", ctx->c_thread_index);
- if (!quic_ctx_is_listener (ctx))
- {
- s = format (s, "%s Session: ", quic_ctx_is_stream (ctx) ?
- "Stream" : "Quic");
- if (verbose)
- s = format (s, "app %d wrk %d", ctx->parent_app_id,
- ctx->parent_app_wrk_id);
- }
+ if (quic_ctx_is_listener (ctx))
+ str = format (str, "Listener, UDP %ld", ctx->udp_session_handle);
+ else if (quic_ctx_is_stream (ctx))
+ str = format (str, "Stream %ld conn %d",
+ ctx->c_quic_ctx_id.stream->stream_id,
+ ctx->c_quic_ctx_id.quic_connection_ctx_id);
+ else /* connection */
+ str = format (str, "Conn %d UDP %d", ctx->c_c_index,
+ ctx->udp_session_handle);
+
+ str = format (str, " app %d wrk %d", ctx->parent_app_id,
+ ctx->parent_app_wrk_id);
+
+ if (verbose == 1)
+ s = format (s, "%-50s%-15d", str, ctx->c_quic_ctx_id.conn_state);
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));
- }
+ s = format (s, "%s\n", str);
+ vec_free (str);
return s;
}
@@ -1668,8 +1666,7 @@ format_quic_connection (u8 * s, va_list * args)
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);
+ s = format (s, "%U", format_quic_ctx, ctx, verbose);
return s;
}
@@ -1679,7 +1676,8 @@ format_quic_half_open (u8 * s, va_list * args)
u32 qc_index = va_arg (*args, u32);
u32 thread_index = va_arg (*args, u32);
quic_ctx_t *ctx = quic_ctx_get (qc_index, thread_index);
- s = format (s, "[QUIC] half-open app %u", ctx->parent_app_id);
+ s =
+ format (s, "[#%d][Q] half-open app %u", thread_index, ctx->parent_app_id);
return s;
}
@@ -1691,11 +1689,7 @@ format_quic_listener (u8 * s, va_list * args)
u32 thread_index = va_arg (*args, u32);
u32 verbose = va_arg (*args, u32);
quic_ctx_t *ctx = quic_ctx_get (tci, thread_index);
- if (ctx)
- {
- ASSERT (quic_ctx_is_listener (ctx));
- s = format (s, "%-50U", format_quic_ctx, ctx, verbose);
- }
+ s = format (s, "%U", format_quic_ctx, ctx, verbose);
return s;
}