vlib: avoid non-mp-safe cli process node updates 96/35796/4
authorVladislav Grishenko <themiron@yandex-team.ru>
Fri, 9 Jul 2021 23:02:46 +0000 (04:02 +0500)
committerDamjan Marion <dmarion@0xa5.net>
Mon, 6 Mar 2023 17:47:26 +0000 (17:47 +0000)
commitff2fba7264cf077fc83ef2192013b7135e4f83f1
treec6782ce295c4956acbbf3f0896ad9c38aa844e76
parent8181727ee518d46ac2f45b769e273431211257a6
vlib: avoid non-mp-safe cli process node updates

Node renames, clone and node_by_name hash updates should be done
in vlib_node_register() / vlib_node_rename() under barrier, or
else runtime per-node stats can be either inaccurate or lead to UB.

Drop cli process nodes renaming rather than adding barrier
syncronization on reuse, nodes will get "unix-cli-process-ID"
stable names, description and terminal names are preserved and can
be obtained with "show cli-sessions" and "show terminal" commands.
Also fix insufficient name width for "show cli-sessions" with table
formatting, output sample:

    DBGvpp# sh cli-sessions
    PNI   FD    Name                     Flags
    708   14    unix-cli-local:10558     iSLpa
    710   15    unix-cli-127.0.0.1:33252 ISlpA

    DBGvpp# sh terminal
    Terminal name:   unix-cli-127.0.0.1:33252
    Terminal node:   unix-cli-process-1
    Terminal mode:   char-by-char
    Terminal width:  158
    Terminal height: 43
    ANSI capable:    yes
    Interactive:     yes
    History enabled: yes
    History limit:   50
    Pager enabled:   yes
    Pager limit:     100000
    CRLF mode:       CR+LF

Type: improvement
Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru>
Change-Id: I40af4c0a5e5be92d5e3ebcd440fa55390aeb0e8b
src/vlib/unix/cli.c