From 7ca5aaac10e95306f74ea4afd52110dd46aa0381 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Tue, 24 Sep 2019 18:10:49 +0200 Subject: vlib: add flag to explicitelly mark nodes which can init per-node packet trace Type: feature Change-Id: I913f08383ee1c24d610c3d2aac07cef402570e2c Signed-off-by: Damjan Marion --- src/vlib/trace.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/vlib/trace.c') diff --git a/src/vlib/trace.c b/src/vlib/trace.c index 70621135c68..530598d349d 100644 --- a/src/vlib/trace.c +++ b/src/vlib/trace.c @@ -357,6 +357,7 @@ cli_add_trace_buffer (vlib_main_t * vm, { unformat_input_t _line_input, *line_input = &_line_input; vlib_trace_main_t *tm; + vlib_node_t *node; vlib_trace_node_t *tn; u32 node_index, add; u8 verbose = 0; @@ -383,6 +384,17 @@ cli_add_trace_buffer (vlib_main_t * vm, } } + node = vlib_get_node (vm, node_index); + + if ((node->flags & VLIB_NODE_FLAG_TRACE_SUPPORTED) == 0) + { + error = clib_error_create ("node '%U' doesn't support per-node " + "tracing. There may be another way to " + "initiate trace on this node.", + format_vlib_node_name, vm, node_index); + goto done; + } + /* *INDENT-OFF* */ foreach_vlib_main (( { -- cgit 1.2.3-korg