aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/unix
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2021-08-20 19:14:16 -0700
committerDave Wallace <dwallacelf@gmail.com>2021-08-27 14:57:44 +0000
commit17a67218587d40541ff522c6a86f354720481fbb (patch)
tree6af63fed9c4d3a91eba878ed8ce384c924694da7 /src/vlib/unix
parentba46778f55e51503fa47588faddea75efca9b655 (diff)
vlib: vpp banner is outputted to non-interactive vppctl session
Running a batch file which contains many vppctl commands, occasionally, VPP may spit out the banner for some of the commands. This happens when VPP erroneously views the vppctl session as interactive. A simple way to recreate the problem is to run a batch script as followed while [ 1 ] do vppctl create loopback interface vppctl delete loopback interface intfc loop0 done We have two processes which may display the banner, unix_cli_new_session_process and unix_cli_process. Normally, unix_cli_process parses the input tokens and displays the banner after it negotiates the terminal type with the vppctl app. unix_cli_new_session_process only displays the banner just in case the client fails to negotiate terminal type. It runs on a timer and expires in 1 second to display the banner if by then the terminal type is still not yet negotiated. The problem is when the session is killed or exitted, VPP does not remove the element that was enqueued for cli_new_session_process. The index for the connection (cf) is recycled. The timer for the queue element continues to run. When the timer expires for the queue element, it finds the wrong new session due to index recycling. If the new session has not had negotiated the terminal type, the banner is printed erroneously to the new session from cli_new_session_process. The fix is to clean up the queue element to stop cli_new_session_process from processing the wrong connection when the session is killed. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ife2f1b1c95661e442f0fc6b73505e330e6641fc1
Diffstat (limited to 'src/vlib/unix')
-rw-r--r--src/vlib/unix/cli.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 44ec11fdb35..c7f0bccf286 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -2687,6 +2687,17 @@ unix_cli_kill (unix_cli_main_t * cm, uword cli_file_index)
if (pool_is_free_index (cm->cli_file_pool, cli_file_index))
return;
+ vec_foreach_index (i, cm->new_sessions)
+ {
+ unix_cli_new_session_t *ns = vec_elt_at_index (cm->new_sessions, i);
+
+ if (ns->cf_index == cli_file_index)
+ {
+ vec_del1 (cm->new_sessions, i);
+ break;
+ }
+ }
+
cf = pool_elt_at_index (cm->cli_file_pool, cli_file_index);
uf = pool_elt_at_index (fm->file_pool, cf->clib_file_index);