Buffer name inconsistently used a cstring/vec (VPP-901)
Spotted in the output of CLI command "show buffers", the name field
sometimes had trailing garbage, the hall sign of a string not being
terminated. In this case it was being inconsistently used as a cstring
or a vec.
- CLI printf needs %v to print the vec srring
- vlib_buffer_create_free_list_helper tried to use
clib_mem_is_heap_object() to detect a vec object, wheras it should
use clib_mem_is_vec()
Change-Id: Ib8b242a0c5a18924b8af7e8e1432784eebcf572c
Signed-off-by: Chris Luke <chrisy@flirble.org>
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index be3b41e..e50064a 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -383,7 +383,7 @@
f->index = f - bm->buffer_free_list_pool;
f->n_data_bytes = vlib_buffer_round_size (n_data_bytes);
f->min_n_buffers_each_physmem_alloc = VLIB_FRAME_SIZE;
- f->name = clib_mem_is_heap_object (name) ? name : format (0, "%s", name);
+ f->name = clib_mem_is_vec (name) ? name : format (0, "%s", name);
/* Setup free buffer template. */
f->buffer_init_template.free_list_index = f->index;
@@ -774,7 +774,7 @@
{
vlib_buffer_main_t *bm = vm->buffer_main;
va_list va;
- __attribute__ ((unused)) u8 *name;
+ u8 *name;
vlib_buffer_free_list_t *fl;
va_start (va, fmt);
@@ -962,7 +962,7 @@
bytes_alloc = size * f->n_alloc;
bytes_free = size * n_free;
- s = format (s, "%7d%30s%12d%12d%=12U%=12U%=12d%=12d", threadnum,
+ s = format (s, "%7d%30v%12d%12d%=12U%=12U%=12d%=12d", threadnum,
f->name, f->index, f->n_data_bytes,
format_memory_size, bytes_alloc,
format_memory_size, bytes_free, f->n_alloc, n_free);