api: fix trace_plugin_msg_ids segv in trace dump
With 'api-trace { on }' in startup.conf, running 'api trace dump' in
vppctl was causing VPP to seg fault. vl_msg_print_trace() was calling
m->endian_handler() without checking whether its null.
Checking if its non-null prevents a crash, but the trace dump prints
the message IDs for trace_plugin_msg_ids in network byte order. There is
an auto-generated endian function for that message. Set it on the call
to vl_msg_api_config() for trace_plugin_msg_ids so the IDs will be
printed in host byte order in trace dump output.
Type: fix
Fixes: fe45f8f5
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Change-Id: I0ab463985e9a983155feba13ac4eb99ab883ace6
This commit is contained in:

committed by
Dave Barach

parent
bc4dc16a5c
commit
5b32d3a13b
@ -726,6 +726,7 @@ rpc_api_hookup (vlib_main_t *vm)
|
|||||||
.id = VL_API_##N, \
|
.id = VL_API_##N, \
|
||||||
.name = #n, \
|
.name = #n, \
|
||||||
.handler = vl_api_##n##_t_handler, \
|
.handler = vl_api_##n##_t_handler, \
|
||||||
|
.endian = vl_api_##n##_t_endian, \
|
||||||
.format_fn = vl_api_##n##_t_format, \
|
.format_fn = vl_api_##n##_t_format, \
|
||||||
.size = sizeof (vl_api_##n##_t), \
|
.size = sizeof (vl_api_##n##_t), \
|
||||||
.traced = 1, \
|
.traced = 1, \
|
||||||
|
@ -683,7 +683,7 @@ vl_msg_print_trace (u8 *msg, void *ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clib_arch_is_little_endian)
|
if (clib_arch_is_little_endian && (m->endian_handler != NULL))
|
||||||
{
|
{
|
||||||
u32 msg_length = vec_len (msg);
|
u32 msg_length = vec_len (msg);
|
||||||
vec_validate (tmpbuf, msg_length - 1);
|
vec_validate (tmpbuf, msg_length - 1);
|
||||||
|
Reference in New Issue
Block a user