summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiaoming Jiang <jiangxiaoming@outlook.com>2021-06-23 09:07:57 +0000
committerFlorin Coras <florin.coras@gmail.com>2021-06-24 18:11:13 +0000
commit806709fc7c3209f8afaf31b3fc388b127c99fba5 (patch)
tree537d2410ba5d87326f4e61b1fe60fb206b5d27f8
parent959613b5d7fbb8fadcd96853585268ffc33b3593 (diff)
session: fix session formated str output truncated in cli
Type: fix Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com> Change-Id: I2c2b739a5aa246bbf53d6663efd403c3aee9dddd
-rw-r--r--src/vnet/session/application_worker.c15
-rw-r--r--src/vnet/session/segment_manager.c13
2 files changed, 16 insertions, 12 deletions
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 0b2f1459d9a..be8a9e86bd5 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -723,10 +723,12 @@ format_app_worker_listener (u8 * s, va_list * args)
if (!app_wrk)
{
if (verbose)
- s = format (s, "%-40s%-25s%-10s%-15s%-15s%-10s", "Connection", "App",
- "Wrk", "API Client", "ListenerID", "SegManager");
+ s = format (s, "%-" SESSION_CLI_ID_LEN "s%-25s%-10s%-15s%-15s%-10s",
+ "Connection", "App", "Wrk", "API Client", "ListenerID",
+ "SegManager");
else
- s = format (s, "%-40s%-25s%-10s", "Connection", "App", "Wrk");
+ s = format (s, "%-" SESSION_CLI_ID_LEN "s%-25s%-10s", "Connection",
+ "App", "Wrk");
return s;
}
@@ -739,12 +741,13 @@ format_app_worker_listener (u8 * s, va_list * args)
{
u8 *buf;
buf = format (0, "%u(%u)", app_wrk->wrk_map_index, app_wrk->wrk_index);
- s = format (s, "%-40v%-25v%-10v%-15u%-15u%-10u", str, app_name,
- buf, app_wrk->api_client_index, handle, sm_index);
+ s = format (s, "%-" SESSION_CLI_ID_LEN "v%-25v%-10v%-15u%-15u%-10u", str,
+ app_name, buf, app_wrk->api_client_index, handle, sm_index);
vec_free (buf);
}
else
- s = format (s, "%-40v%-25v%=10u", str, app_name, app_wrk->wrk_map_index);
+ s = format (s, "%-" SESSION_CLI_ID_LEN "v%-25v%=10u", str, app_name,
+ app_wrk->wrk_map_index);
vec_free (str);
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index f711270a89a..c7a06d8b636 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -1072,10 +1072,11 @@ segment_manager_format_sessions (segment_manager_t * sm, int verbose)
if (!sm)
{
if (verbose)
- vlib_cli_output (vm, "%-40s%-20s%-15s%-10s", "Connection", "App",
- "API Client", "SegManager");
+ vlib_cli_output (vm, "%-" SESSION_CLI_ID_LEN "s%-20s%-15s%-10s",
+ "Connection", "App", "API Client", "SegManager");
else
- vlib_cli_output (vm, "%-40s%-20s", "Connection", "App");
+ vlib_cli_output (vm, "%-" SESSION_CLI_ID_LEN "s%-20s", "Connection",
+ "App");
return;
}
@@ -1101,11 +1102,11 @@ segment_manager_format_sessions (segment_manager_t * sm, int verbose)
str = format (0, "%U", format_session, session, verbose);
if (verbose)
- s = format (s, "%-40v%-20v%-15u%-10u", str, app_name,
- app_wrk->api_client_index,
+ s = format (s, "%-" SESSION_CLI_ID_LEN "v%-20v%-15u%-10u", str,
+ app_name, app_wrk->api_client_index,
app_wrk->connects_seg_manager);
else
- s = format (s, "%-40v%-20v", str, app_name);
+ s = format (s, "%-" SESSION_CLI_ID_LEN "v%-20v", str, app_name);
vlib_cli_output (vm, "%v", s);
vec_reset_length (s);