aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2021-06-11 12:57:23 -0400
committerDave Barach <openvpp@barachs.net>2021-06-13 17:43:18 +0000
commit6b6f413b5c216b72585c12a60de82065a94204ec (patch)
tree50bb6d4a17a36b6d2580576b0b8e3bdc255f558f /src
parent6510663c7a07d68415b7be4618f2a8959870c58b (diff)
vlib: fix dangling reference in node_by_name hash
When recycling a debug CLI process node, unix_cli_file_add() needs to delete and recreate the related node_by_name hash table entry. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I635da4918509d5b22eae37627c2d9b3608380ca6 (cherry picked from commit 52c33d60bc63626d400067e38ab0af312fdb8594)
Diffstat (limited to 'src')
-rw-r--r--src/vlib/unix/cli.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 6c98867253f..44ec11fdb35 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -2863,6 +2863,7 @@ unix_cli_file_add (unix_cli_main_t * cm, char *name, int fd)
{
unix_main_t *um = &unix_main;
clib_file_main_t *fm = &file_main;
+ vlib_node_main_t *nm = &vlib_get_main ()->node_main;
unix_cli_file_t *cf;
clib_file_t template = { 0 };
vlib_main_t *vm = um->vlib_main;
@@ -2896,10 +2897,12 @@ unix_cli_file_add (unix_cli_main_t * cm, char *name, int fd)
old_name = n->name;
n->name = (u8 *) name;
}
+ ASSERT (old_name);
+ hash_unset (nm->node_by_name, old_name);
+ hash_set (nm->node_by_name, name, n->index);
vec_free (old_name);
vlib_node_set_state (vm, n->index, VLIB_NODE_STATE_POLLING);
-
_vec_len (cm->unused_cli_process_node_indices) = l - 1;
}
else