summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/handoff_trace.c1
-rw-r--r--src/vlib/node.h1
-rw-r--r--src/vlib/trace.c12
3 files changed, 14 insertions, 0 deletions
diff --git a/src/vlib/handoff_trace.c b/src/vlib/handoff_trace.c
index 7a6743885da..fcb514bd837 100644
--- a/src/vlib/handoff_trace.c
+++ b/src/vlib/handoff_trace.c
@@ -79,6 +79,7 @@ typedef enum
VLIB_REGISTER_NODE (handoff_trace_node, static) =
{
.name = "handoff_trace",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.function = handoff_trace_node_fn,
.vector_size = sizeof (u32),
.format_trace = format_handoff_trace,
diff --git a/src/vlib/node.h b/src/vlib/node.h
index 2db31c68d7f..9f324f79fa4 100644
--- a/src/vlib/node.h
+++ b/src/vlib/node.h
@@ -303,6 +303,7 @@ typedef struct vlib_node_t
#define VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE (1 << 6)
#define VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE (1 << 7)
+#define VLIB_NODE_FLAG_TRACE_SUPPORTED (1 << 8)
/* State for input nodes. */
u8 state;
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 ((
{