2 * Copyright (c) 2023 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
15 #include <vlib/vlib.h>
16 #include <tracenode/tracenode.h>
18 tracenode_main_t tracenode_main;
21 tracenode_feature_enable_disable (u32 sw_if_index, bool is_pcap, bool enable)
23 tracenode_main_t *tnm = &tracenode_main;
24 char *node_name = is_pcap ? "pcap-filtering" : "trace-filtering";
27 if (pool_is_free_index (tnm->vnet_main->interface_main.sw_interfaces,
29 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
31 if (clib_bitmap_get (tnm->feature_enabled_by_sw_if, sw_if_index) == enable)
34 if ((rv = vnet_feature_enable_disable ("ip4-unicast", node_name, sw_if_index,
38 if ((rv = vnet_feature_enable_disable ("ip6-unicast", node_name, sw_if_index,
42 tnm->feature_enabled_by_sw_if =
43 clib_bitmap_set (tnm->feature_enabled_by_sw_if, sw_if_index, enable);
49 tracenode_init (vlib_main_t *vm)
51 tracenode_main_t *tnm = &tracenode_main;
52 clib_error_t *error = 0;
54 memset (tnm, 0, sizeof (*tnm));
56 tnm->vnet_main = vnet_get_main ();
58 error = tracenode_plugin_api_hookup (vm);
63 VLIB_INIT_FUNCTION (tracenode_init);
66 * fd.io coding-style-patch-verification: ON
69 * eval: (c-set-style "gnu")