summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/application_local.c8
-rw-r--r--src/vnet/session/session_cli.c7
-rw-r--r--src/vnet/session/session_types.h3
-rw-r--r--src/vnet/tcp/tcp.c5
-rw-r--r--src/vnet/tcp/tcp_cli.c5
-rw-r--r--src/vnet/tls/tls.c9
-rw-r--r--src/vnet/udp/udp_cli.c5
7 files changed, 26 insertions, 16 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index 814350018bb..beca5dbe689 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -516,9 +516,9 @@ format_ct_listener (u8 * s, va_list * args)
u32 __clib_unused thread_index = va_arg (*args, u32);
u32 __clib_unused verbose = va_arg (*args, u32);
ct_connection_t *ct = ct_connection_get (tc_index);
- s = format (s, "%-50U", format_ct_connection_id, ct);
+ s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_ct_connection_id, ct);
if (verbose)
- s = format (s, "%-15s", "LISTEN");
+ s = format (s, "%-" SESSION_CLI_STATE_LEN "s", "LISTEN");
return s;
}
@@ -530,10 +530,10 @@ format_ct_connection (u8 * s, va_list * args)
if (!ct)
return s;
- s = format (s, "%-50U", format_ct_connection_id, ct);
+ s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_ct_connection_id, ct);
if (verbose)
{
- s = format (s, "%-15s", "ESTABLISHED");
+ s = format (s, "%-" SESSION_CLI_STATE_LEN "s", "ESTABLISHED");
if (verbose > 1)
{
s = format (s, "\n");
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index 9f6d74c031d..ade76ef4e60 100644
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -329,7 +329,8 @@ session_cli_show_all_sessions (vlib_main_t * vm, int verbose)
}
if (verbose == 1)
- vlib_cli_output (vm, "%s%-50s%-15s%-10s%-10s",
+ vlib_cli_output (vm, "%s%-" SESSION_CLI_ID_LEN "s%-"
+ SESSION_CLI_STATE_LEN "s%-10s%-10s",
thread_index ? "\n" : "",
"Connection", "State", "Rx-f", "Tx-f");
@@ -617,7 +618,9 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (do_listeners)
{
sst = session_type_from_proto_and_ip (transport_proto, 1);
- vlib_cli_output (vm, "%-50s%-24s", "Listener", "App");
+ vlib_cli_output (vm, "%-" SESSION_CLI_ID_LEN "s%-24s", "Listener",
+ "App");
+
/* *INDENT-OFF* */
pool_foreach (s, smm->wrk[0].sessions, ({
if (s->session_state != SESSION_STATE_LISTENING
diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h
index 8cea29a8642..950066a958d 100644
--- a/src/vnet/session/session_types.h
+++ b/src/vnet/session/session_types.h
@@ -495,6 +495,9 @@ typedef enum session_error_
#undef _
} session_error_t;
+#define SESSION_CLI_ID_LEN "60"
+#define SESSION_CLI_STATE_LEN "15"
+
/* Maintained for compatibility. Will be deprecated */
#define SESSION_ERROR_SEG_CREATE SESSION_E_SEG_CREATE
#define SESSION_ERROR_NO_SPACE SESSION_E_SEG_NO_SPACE
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index a4599c2fd98..0b3aeba0334 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -841,9 +841,10 @@ format_tcp_listener_session (u8 * s, va_list * args)
u32 __clib_unused thread_index = va_arg (*args, u32);
u32 verbose = va_arg (*args, u32);
tcp_connection_t *tc = tcp_listener_get (tci);
- s = format (s, "%-50U", format_tcp_connection_id, tc);
+ s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_tcp_connection_id, tc);
if (verbose)
- s = format (s, "%-15U", format_tcp_state, tc->state);
+ s = format (s, "%-" SESSION_CLI_STATE_LEN "U", format_tcp_state,
+ tc->state);
return s;
}
diff --git a/src/vnet/tcp/tcp_cli.c b/src/vnet/tcp/tcp_cli.c
index 94ee21f91bc..e2c1396b5fb 100644
--- a/src/vnet/tcp/tcp_cli.c
+++ b/src/vnet/tcp/tcp_cli.c
@@ -258,10 +258,11 @@ format_tcp_connection (u8 * s, va_list * args)
if (!tc)
return s;
- s = format (s, "%-50U", format_tcp_connection_id, tc);
+ s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_tcp_connection_id, tc);
if (verbose)
{
- s = format (s, "%-15U", format_tcp_state, tc->state);
+ s = format (s, "%-" SESSION_CLI_STATE_LEN "U", format_tcp_state,
+ tc->state);
if (verbose > 1)
s = format (s, "\n%U", format_tcp_vars, tc);
}
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index 9caa5d78d8c..516cfd76445 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -816,10 +816,11 @@ format_tls_connection (u8 * s, va_list * args)
if (!ctx)
return s;
- s = format (s, "%-50U", format_tls_ctx, ctx);
+ s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_tls_ctx, ctx);
if (verbose)
{
- s = format (s, "%-15U", format_tls_ctx_state, ctx);
+ s = format (s, "%-" SESSION_CLI_STATE_LEN "U", format_tls_ctx_state,
+ ctx);
if (verbose > 1)
s = format (s, "\n");
}
@@ -834,9 +835,9 @@ format_tls_listener (u8 * s, va_list * args)
u32 verbose = va_arg (*args, u32);
tls_ctx_t *ctx = tls_listener_ctx_get (tc_index);
- s = format (s, "%-50U", format_tls_listener_ctx, ctx);
+ s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_tls_listener_ctx, ctx);
if (verbose)
- s = format (s, "%-15U", format_tls_ctx_state, ctx);
+ s = format (s, "%-" SESSION_CLI_STATE_LEN "U", format_tls_ctx_state, ctx);
return s;
}
diff --git a/src/vnet/udp/udp_cli.c b/src/vnet/udp/udp_cli.c
index 89cea689251..09e3a8a3d7f 100644
--- a/src/vnet/udp/udp_cli.c
+++ b/src/vnet/udp/udp_cli.c
@@ -14,6 +14,7 @@
*/
#include <vnet/udp/udp.h>
+#include <vnet/session/session_types.h>
u8 *
format_udp_connection_id (u8 * s, va_list * args)
@@ -78,10 +79,10 @@ format_udp_connection (u8 * s, va_list * args)
u32 verbose = va_arg (*args, u32);
if (!uc)
return s;
- s = format (s, "%-50U", format_udp_connection_id, uc);
+ s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_udp_connection_id, uc);
if (verbose)
{
- s = format (s, "%-15s",
+ s = format (s, "%-" SESSION_CLI_STATE_LEN "s",
(uc->flags & UDP_CONN_F_LISTEN) ? "LISTEN" : "OPENED", uc);
if (verbose > 1)
s = format (s, "\n%U", format_udp_vars, uc);