From 3f40755749b07e5a936ad6d15622e371e7e5c25e Mon Sep 17 00:00:00 2001 From: Maxime Peim Date: Mon, 3 Jul 2023 17:45:51 +0200 Subject: classify: add bpf support to pcap classifier Type: feature Change-Id: I28fb38e49c89f4c4d4cc58c1a5c0aa8502678472 Signed-off-by: Maxime Peim --- src/vnet/interface_api.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/vnet/interface_api.c') diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c index 5b48fea02eb..01f2fd0c8b2 100644 --- a/src/vnet/interface_api.c +++ b/src/vnet/interface_api.c @@ -1603,6 +1603,33 @@ static void REPLY_MACRO (VL_API_SW_INTERFACE_ADDRESS_REPLACE_END_REPLY); } +static void +vl_api_pcap_set_filter_function_t_handler ( + vl_api_pcap_set_filter_function_t *mp) +{ + vnet_main_t *vnm = vnet_get_main (); + vnet_pcap_t *pp = &vnm->pcap; + vl_api_pcap_set_filter_function_reply_t *rmp; + unformat_input_t input = { 0 }; + vlib_is_packet_traced_fn_t *f; + char *filter_name; + int rv = 0; + filter_name = vl_api_from_api_to_new_c_string (&mp->filter_function_name); + unformat_init_cstring (&input, filter_name); + if (unformat (&input, "%U", unformat_vlib_trace_filter_function, &f) == 0) + { + rv = -1; + goto done; + } + + pp->current_filter_function = f; + +done: + unformat_free (&input); + vec_free (filter_name); + REPLY_MACRO (VL_API_PCAP_SET_FILTER_FUNCTION_REPLY); +} + static void vl_api_pcap_trace_on_t_handler (vl_api_pcap_trace_on_t *mp) { -- cgit 1.2.3-korg