From bc67e9fd206ef3d6234960a61a7f9ab56a938ef2 Mon Sep 17 00:00:00 2001 From: Mohammed Hawari Date: Fri, 8 Dec 2023 11:16:54 +0100 Subject: bpf_trace_filter: allow use whithout classifier Change-Id: I7ac5693ca547fe7249e7b6297bade70a6052b169 Type: improvement Signed-off-by: Mohammed Hawari --- src/plugins/bpf_trace_filter/bpf_trace_filter.c | 4 ++-- src/vlib/trace.c | 7 ------- src/vnet/classify/trace_classify.h | 3 +++ 3 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/bpf_trace_filter/bpf_trace_filter.c b/src/plugins/bpf_trace_filter/bpf_trace_filter.c index ff08d2cdb80..01d5b1e96a7 100644 --- a/src/plugins/bpf_trace_filter/bpf_trace_filter.c +++ b/src/plugins/bpf_trace_filter/bpf_trace_filter.c @@ -64,9 +64,9 @@ bpf_is_packed_traced (vlib_buffer_t *b, u32 classify_table_index, int func) struct pcap_pkthdr phdr = { 0 }; int res; int res1; - res1 = vnet_is_packet_traced (b, classify_table_index, 0); - if (res1 != 1) + if (classify_table_index != ~0 && + (res1 = vnet_is_packet_traced (b, classify_table_index, 0)) != 1) return res1; if (!bfm->prog_set) diff --git a/src/vlib/trace.c b/src/vlib/trace.c index 96da4975bc2..15355572cb9 100644 --- a/src/vlib/trace.c +++ b/src/vlib/trace.c @@ -463,13 +463,6 @@ cli_add_trace_buffer (vlib_main_t * vm, goto done; } - u32 filter_table = classify_get_trace_chain (); - if (filter && filter_table == ~0) - { - error = clib_error_create ("No packet trace filter configured..."); - goto done; - } - trace_update_capture_options (add, node_index, filter, verbose); done: diff --git a/src/vnet/classify/trace_classify.h b/src/vnet/classify/trace_classify.h index fea4ddee7e7..03421210d03 100644 --- a/src/vnet/classify/trace_classify.h +++ b/src/vnet/classify/trace_classify.h @@ -45,6 +45,9 @@ vnet_is_packet_traced_inline (vlib_buffer_t * b, if (func != 0) return -1; + if (classify_table_index == ~0) + return -1; + /* This will happen... */ if (pool_is_free_index (vcm->tables, classify_table_index)) return -1; -- cgit 1.2.3-korg