summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-09-10 14:12:06 +0200
committerDamjan Marion <dmarion@me.com>2020-09-11 08:41:06 +0000
commit268e3b647733807dbecf402fcebedceff4c85544 (patch)
tree07b289bb5797a70a789fac9e33e5eafa3d4333b0
parent2fe25370ba0deed78c1240fa6788c5b5f14d6f97 (diff)
vlib: fix call to vlib_get_node_by_name
Type: fix Change-Id: I1b4f52e186165b04db5bd5f11058dc77b647bc94 Signed-off-by: Benoît Ganne <bganne@cisco.com>
-rw-r--r--src/vlib/node.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vlib/node.c b/src/vlib/node.c
index 119b4718090..169c67b0888 100644
--- a/src/vlib/node.c
+++ b/src/vlib/node.c
@@ -347,7 +347,10 @@ register_node (vlib_main_t * vm, vlib_node_registration_t * r)
/* Node names must be unique. */
{
- vlib_node_t *o = vlib_get_node_by_name (vm, n->name);
+ /* vlib_get_node_by_name() expects NULL-terminated strings */
+ u8 *name = format (0, "%v%c", n->name, 0);
+ vlib_node_t *o = vlib_get_node_by_name (vm, name);
+ vec_free (name);
if (o)
clib_error ("more than one node named `%v'", n->name);
}