summaryrefslogtreecommitdiffstats
path: root/src/vlib/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/trace.c')
-rw-r--r--src/vlib/trace.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/vlib/trace.c b/src/vlib/trace.c
index 530598d349d..7ee1b63f07e 100644
--- a/src/vlib/trace.c
+++ b/src/vlib/trace.c
@@ -351,6 +351,13 @@ VLIB_CLI_COMMAND (show_trace_cli,static) = {
};
/* *INDENT-ON* */
+int vlib_enable_disable_pkt_trace_filter (int enable) __attribute__ ((weak));
+int
+vlib_enable_disable_pkt_trace_filter (int enable)
+{
+ return 0;
+}
+
static clib_error_t *
cli_add_trace_buffer (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
@@ -361,6 +368,7 @@ cli_add_trace_buffer (vlib_main_t * vm,
vlib_trace_node_t *tn;
u32 node_index, add;
u8 verbose = 0;
+ int filter = 0;
clib_error_t *error = 0;
if (!unformat_user (input, unformat_line_input, line_input))
@@ -376,6 +384,8 @@ cli_add_trace_buffer (vlib_main_t * vm,
;
else if (unformat (line_input, "verbose"))
verbose = 1;
+ else if (unformat (line_input, "filter"))
+ filter = 1;
else
{
error = clib_error_create ("expected NODE COUNT, got `%U'",
@@ -395,6 +405,15 @@ cli_add_trace_buffer (vlib_main_t * vm,
goto done;
}
+ if (filter)
+ {
+ if (vlib_enable_disable_pkt_trace_filter (1 /* enable */ ))
+ {
+ error = clib_error_create ("No packet trace filter configured...");
+ goto done;
+ }
+ }
+
/* *INDENT-OFF* */
foreach_vlib_main ((
{
@@ -421,7 +440,6 @@ VLIB_CLI_COMMAND (add_trace_cli,static) = {
};
/* *INDENT-ON* */
-
/*
* Configure a filter for packet traces.
*
@@ -523,6 +541,7 @@ static clib_error_t *
cli_clear_trace_buffer (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
+ vlib_enable_disable_pkt_trace_filter (0 /* enable */ );
clear_trace_buffer ();
return 0;
}
@@ -541,6 +560,18 @@ vlib_trace_cli_reference (void)
{
}
+int
+vnet_is_packet_traced (vlib_buffer_t * b,
+ u32 classify_table_index, int func)
+__attribute__ ((weak));
+
+int
+vnet_is_packet_traced (vlib_buffer_t * b, u32 classify_table_index, int func)
+{
+ clib_warning ("BUG: STUB called");
+ return 1;
+}
+
/*
* fd.io coding-style-patch-verification: ON
*