aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--src/plugins/quic/quic.c52
-rwxr-xr-xsrc/vnet/session/session_cli.c3
-rw-r--r--src/vnet/udp/udp.c6
3 files changed, 28 insertions, 33 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;
}
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index d839532eea3..ca4b8c12f8d 100755
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -68,7 +68,8 @@ format_session (u8 * s, va_list * args)
if (verbose == 1)
{
u8 post_accept = ss->session_state >= SESSION_STATE_ACCEPTING;
- u8 hasf = post_accept | session_tx_is_dgram (ss);
+ u8 hasf = post_accept
+ || session_transport_service_type (ss) == TRANSPORT_SERVICE_CL;
u32 rxf, txf;
rxf = hasf ? svm_fifo_max_dequeue (ss->rx_fifo) : 0;
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 1a4431b1b57..7dd0d2a10ff 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -216,7 +216,7 @@ format_udp_connection (u8 * s, va_list * args)
if (verbose)
{
if (verbose == 1)
- s = format (s, "%-15s\n", "-");
+ s = format (s, "%-15s", "-");
else
s = format (s, "\n");
}
@@ -249,9 +249,9 @@ format_udp_listener_session (u8 * s, va_list * args)
{
u32 tci = va_arg (*args, u32);
u32 __clib_unused thread_index = va_arg (*args, u32);
- u32 __clib_unused verbose = va_arg (*args, u32);
+ u32 verbose = va_arg (*args, u32);
udp_connection_t *uc = udp_listener_get (tci);
- return format (s, "%U", format_udp_connection, uc);
+ return format (s, "%U", format_udp_connection, uc, verbose);
}
u16