From aa479bb91d0c75b603e6c8828e6fffa0c70c5a0c Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Tue, 9 Mar 2021 16:34:57 -0500 Subject: misc: remove cop API support (part 1) API marked for deprecation last year due to non-inclusive language. Last supported release: 21.01. See the "adl" plugin. Type: improvement Signed-off-by: Dave Barach Change-Id: I931e58ced9cc8403ca5b23fd6b07e50d0ff7306b --- src/plugins/adl/adl_api.c | 9 --- src/vat/api_format.c | 99 ------------------------ src/vnet/CMakeLists.txt | 10 --- src/vnet/cop/cop.api | 44 +---------- src/vnet/cop/cop_api.c | 193 ---------------------------------------------- src/vnet/vnet_all_api_h.h | 1 - src/vpp/api/custom_dump.c | 35 --------- 7 files changed, 1 insertion(+), 390 deletions(-) delete mode 100644 src/vnet/cop/cop_api.c (limited to 'src') diff --git a/src/plugins/adl/adl_api.c b/src/plugins/adl/adl_api.c index 37c96400b70..dba3b0cc17d 100644 --- a/src/plugins/adl/adl_api.c +++ b/src/plugins/adl/adl_api.c @@ -108,20 +108,11 @@ static clib_error_t * adl_api_init (vlib_main_t * vm) { adl_main_t *am = &adl_main; - void register_vl_api_cop_interface_enable_disable_callback (void *); - void register_vl_api_cop_whitelist_enable_disable_callback (void *); - am->vlib_main = vm; /* Ask for a correctly-sized block of API message decode slots */ am->msg_id_base = setup_message_id_table (); - /* Set up transitional API callbacks */ - register_vl_api_cop_interface_enable_disable_callback - (vl_api_cop_interface_enable_disable_callback); - register_vl_api_cop_whitelist_enable_disable_callback - (vl_api_cop_whitelist_enable_disable_callback); - return 0; } diff --git a/src/vat/api_format.c b/src/vat/api_format.c index a59544a09c5..a1c5e8ef5d8 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -3294,8 +3294,6 @@ _(delete_loopback_reply) \ _(bd_ip_mac_add_del_reply) \ _(bd_ip_mac_flush_reply) \ _(want_interface_events_reply) \ -_(cop_interface_enable_disable_reply) \ -_(cop_whitelist_enable_disable_reply) \ _(sw_interface_clear_stats_reply) \ _(ioam_enable_reply) \ _(ioam_disable_reply) \ @@ -3479,8 +3477,6 @@ _(BD_IP_MAC_FLUSH_REPLY, bd_ip_mac_flush_reply) \ _(BD_IP_MAC_DETAILS, bd_ip_mac_details) \ _(WANT_INTERFACE_EVENTS_REPLY, want_interface_events_reply) \ _(GET_FIRST_MSG_ID_REPLY, get_first_msg_id_reply) \ -_(COP_INTERFACE_ENABLE_DISABLE_REPLY, cop_interface_enable_disable_reply) \ -_(COP_WHITELIST_ENABLE_DISABLE_REPLY, cop_whitelist_enable_disable_reply) \ _(GET_NODE_GRAPH_REPLY, get_node_graph_reply) \ _(SW_INTERFACE_CLEAR_STATS_REPLY, sw_interface_clear_stats_reply) \ _(IOAM_ENABLE_REPLY, ioam_enable_reply) \ @@ -11320,98 +11316,6 @@ api_get_first_msg_id (vat_main_t * vam) return ret; } -static int -api_cop_interface_enable_disable (vat_main_t * vam) -{ - unformat_input_t *line_input = vam->input; - vl_api_cop_interface_enable_disable_t *mp; - u32 sw_if_index = ~0; - u8 enable_disable = 1; - int ret; - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) - { - if (unformat (line_input, "disable")) - enable_disable = 0; - if (unformat (line_input, "enable")) - enable_disable = 1; - else if (unformat (line_input, "%U", api_unformat_sw_if_index, - vam, &sw_if_index)) - ; - else if (unformat (line_input, "sw_if_index %d", &sw_if_index)) - ; - else - break; - } - - if (sw_if_index == ~0) - { - errmsg ("missing interface name or sw_if_index"); - return -99; - } - - /* Construct the API message */ - M (COP_INTERFACE_ENABLE_DISABLE, mp); - mp->sw_if_index = ntohl (sw_if_index); - mp->enable_disable = enable_disable; - - /* send it... */ - S (mp); - /* Wait for the reply */ - W (ret); - return ret; -} - -static int -api_cop_whitelist_enable_disable (vat_main_t * vam) -{ - unformat_input_t *line_input = vam->input; - vl_api_cop_whitelist_enable_disable_t *mp; - u32 sw_if_index = ~0; - u8 ip4 = 0, ip6 = 0, default_cop = 0; - u32 fib_id = 0; - int ret; - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) - { - if (unformat (line_input, "ip4")) - ip4 = 1; - else if (unformat (line_input, "ip6")) - ip6 = 1; - else if (unformat (line_input, "default")) - default_cop = 1; - else if (unformat (line_input, "%U", api_unformat_sw_if_index, - vam, &sw_if_index)) - ; - else if (unformat (line_input, "sw_if_index %d", &sw_if_index)) - ; - else if (unformat (line_input, "fib-id %d", &fib_id)) - ; - else - break; - } - - if (sw_if_index == ~0) - { - errmsg ("missing interface name or sw_if_index"); - return -99; - } - - /* Construct the API message */ - M (COP_WHITELIST_ENABLE_DISABLE, mp); - mp->sw_if_index = ntohl (sw_if_index); - mp->fib_id = ntohl (fib_id); - mp->ip4 = ip4; - mp->ip6 = ip6; - mp->default_cop = default_cop; - - /* send it... */ - S (mp); - /* Wait for the reply */ - W (ret); - return ret; -} - static int api_get_node_graph (vat_main_t * vam) { @@ -15022,9 +14926,6 @@ _(bd_ip_mac_flush, "bd_id ") \ _(bd_ip_mac_dump, "[bd_id] ") \ _(want_interface_events, "enable|disable") \ _(get_first_msg_id, "client ") \ -_(cop_interface_enable_disable, " | sw_if_index [disable]") \ -_(cop_whitelist_enable_disable, " | sw_if_index \n" \ - "fib-id [ip4][ip6][default]") \ _(get_node_graph, " ") \ _(sw_interface_clear_stats," | sw_if_index ") \ _(ioam_enable, "[trace] [pow] [ppc ]") \ diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt index 38aeda5be93..eecb18c937b 100644 --- a/src/vnet/CMakeLists.txt +++ b/src/vnet/CMakeLists.txt @@ -110,16 +110,6 @@ list(APPEND VNET_API_FILES policer/policer_types.api ) -############################################################################## -# Binary API compatibility until vpp 20.12, see the ADL plugin... -############################################################################## - -list(APPEND VNET_SOURCES - cop/cop_api.c -) - -list(APPEND VNET_API_FILES cop/cop.api) - ############################################################################## # Layer 2 protocols go here ############################################################################## diff --git a/src/vnet/cop/cop.api b/src/vnet/cop/cop.api index f0916cb5844..bc213c2eb7b 100644 --- a/src/vnet/cop/cop.api +++ b/src/vnet/cop/cop.api @@ -13,49 +13,7 @@ * limitations under the License. */ -option version = "1.0.1"; - -import "vnet/interface_types.api"; - - /** \brief cop: enable/disable junk filtration features on an interface - @param client_index - opaque cookie to identify the sender - @param context - sender context, to match reply w/ request - @param sw_if_inded - desired interface - @param enable_disable - 1 => enable, 0 => disable -*/ - -autoreply define cop_interface_enable_disable -{ - option deprecated; - u32 client_index; - u32 context; - vl_api_interface_index_t sw_if_index; - bool enable_disable; -}; - -/** \brief cop: enable/disable whitelist filtration features on an interface - Note: the supplied fib_id must match in order to remove the feature! - - @param client_index - opaque cookie to identify the sender - @param context - sender context, to match reply w/ request - @param sw_if_index - interface handle, physical interfaces only - @param fib_id - fib identifier for the whitelist / blacklist fib - @param ip4 - 1 => enable ip4 filtration, 0=> disable ip4 filtration - @param ip6 - 1 => enable ip6 filtration, 0=> disable ip6 filtration - @param default_cop - 1 => enable non-ip4, non-ip6 filtration 0=> disable it -*/ - -autoreply define cop_whitelist_enable_disable -{ - option deprecated; - u32 client_index; - u32 context; - vl_api_interface_index_t sw_if_index; - u32 fib_id; - bool ip4; - bool ip6; - bool default_cop; -}; +option version = "0.0.1"; /* * Local Variables: diff --git a/src/vnet/cop/cop_api.c b/src/vnet/cop/cop_api.c deleted file mode 100644 index 6ebcebcbf86..00000000000 --- a/src/vnet/cop/cop_api.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - *------------------------------------------------------------------ - * cop_api.c - cop api - * - * Copyright (c) 2016,2020 Cisco and/or its affiliates. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------ - */ - -#include -#include - -#include -#include - -#include - -#define vl_typedefs /* define message structures */ -#include -#undef vl_typedefs - -#define vl_endianfun /* define message structures */ -#include -#undef vl_endianfun - -/* instantiate all the print functions we know about */ -#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) -#define vl_printfun -#include -#undef vl_printfun - -#include - -#define foreach_vpe_api_msg \ -_(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \ -_(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) - -typedef struct -{ - u32 sw_if_index; - u8 ip4; - u8 ip6; - u8 default_cop; - u32 fib_id; -} cop_whitelist_enable_disable_args_t; - -/* - * This API will be deprecated in vpp 20.12. - * - * Continue to support it for the moment if the "adl" plugin - * is loaded... - */ -static int default_interface_enable_disable_callback - (u32 sw_if_index, int enable_disable) -{ - return VNET_API_ERROR_UNIMPLEMENTED; -} - -static int (*interface_enable_disable_callback) (u32, int) = - default_interface_enable_disable_callback; - -void -register_vl_api_cop_interface_enable_disable_callback (void *cb) -{ - interface_enable_disable_callback = cb; -} - -static void vl_api_cop_interface_enable_disable_t_handler - (vl_api_cop_interface_enable_disable_t * mp) -{ - vl_api_cop_interface_enable_disable_reply_t *rmp; - int rv; - u32 sw_if_index = ntohl (mp->sw_if_index); - int enable_disable; - - VALIDATE_SW_IF_INDEX (mp); - - enable_disable = (int) mp->enable_disable; - - rv = (*interface_enable_disable_callback) (sw_if_index, enable_disable); - - BAD_SW_IF_INDEX_LABEL; - - REPLY_MACRO (VL_API_COP_INTERFACE_ENABLE_DISABLE_REPLY); -} - -/* - * This API will be deprecated in vpp 20.12. - * - * Continue to support it for the moment if the "adl" plugin - * is loaded... - */ - -static int default_whitelist_enable_disable_callback - (cop_whitelist_enable_disable_args_t * a) -{ - return VNET_API_ERROR_UNIMPLEMENTED; -} - -static int (*whitelist_enable_disable_callback) - (cop_whitelist_enable_disable_args_t * a) = - default_whitelist_enable_disable_callback; - -void -register_vl_api_cop_whitelist_enable_disable_callback (void *cb) -{ - whitelist_enable_disable_callback = cb; -} - -static void vl_api_cop_whitelist_enable_disable_t_handler - (vl_api_cop_whitelist_enable_disable_t * mp) -{ - vl_api_cop_whitelist_enable_disable_reply_t *rmp; - cop_whitelist_enable_disable_args_t _a, *a = &_a; - u32 sw_if_index = ntohl (mp->sw_if_index); - int rv; - - VALIDATE_SW_IF_INDEX (mp); - - a->sw_if_index = sw_if_index; - a->ip4 = mp->ip4; - a->ip6 = mp->ip6; - a->default_cop = mp->default_cop; - a->fib_id = ntohl (mp->fib_id); - - rv = (*whitelist_enable_disable_callback) (a); - - BAD_SW_IF_INDEX_LABEL; - - REPLY_MACRO (VL_API_COP_WHITELIST_ENABLE_DISABLE_REPLY); -} - -/* - * cop_api_hookup - * Add vpe's API message handlers to the table. - * vlib has already mapped shared memory and - * added the client registration handlers. - * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process() - */ -#define vl_msg_name_crc_list -#include -#undef vl_msg_name_crc_list - -static void -setup_message_id_table (api_main_t * am) -{ -#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); - foreach_vl_msg_name_crc_cop; -#undef _ -} - -static clib_error_t * -cop_api_hookup (vlib_main_t * vm) -{ - api_main_t *am = vlibapi_get_main (); - -#define _(N,n) \ - vl_msg_api_set_handlers(VL_API_##N, #n, \ - vl_api_##n##_t_handler, \ - vl_noop_handler, \ - vl_api_##n##_t_endian, \ - vl_api_##n##_t_print, \ - sizeof(vl_api_##n##_t), 1); - foreach_vpe_api_msg; -#undef _ - - /* - * Set up the (msg_name, crc, message-id) table - */ - setup_message_id_table (am); - - return 0; -} - -VLIB_API_INIT_FUNCTION (cop_api_hookup); - -/* - * fd.io coding-style-patch-verification: ON - * - * Local Variables: - * eval: (c-set-style "gnu") - * End: - */ diff --git a/src/vnet/vnet_all_api_h.h b/src/vnet/vnet_all_api_h.h index 2a5b6bd557e..364bbecabcc 100644 --- a/src/vnet/vnet_all_api_h.h +++ b/src/vnet/vnet_all_api_h.h @@ -51,7 +51,6 @@ #include #include #include -#include #include #include #include diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c index 372cfa70457..339e7a3f69d 100644 --- a/src/vpp/api/custom_dump.c +++ b/src/vpp/api/custom_dump.c @@ -1955,39 +1955,6 @@ vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle) FINISH; } -static void *vl_api_cop_interface_enable_disable_t_print - (vl_api_cop_interface_enable_disable_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: cop_interface_enable_disable "); - s = format (s, "sw_if_index %d ", (mp->sw_if_index)); - if (mp->enable_disable) - s = format (s, "enable "); - else - s = format (s, "disable "); - - FINISH; -} - -static void *vl_api_cop_whitelist_enable_disable_t_print - (vl_api_cop_whitelist_enable_disable_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: cop_whitelist_enable_disable "); - s = format (s, "sw_if_index %d ", (mp->sw_if_index)); - s = format (s, "fib-id %d ", (mp->fib_id)); - if (mp->ip4) - s = format (s, "ip4 "); - if (mp->ip6) - s = format (s, "ip6 "); - if (mp->default_cop) - s = format (s, "default "); - - FINISH; -} - static void *vl_api_af_packet_create_t_print (vl_api_af_packet_create_t * mp, void *handle) { @@ -3070,8 +3037,6 @@ _(IP_DUMP, ip_dump) \ _(DELETE_LOOPBACK, delete_loopback) \ _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \ _(BD_IP_MAC_FLUSH, bd_ip_mac_flush) \ -_(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \ -_(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \ _(AF_PACKET_CREATE, af_packet_create) \ _(AF_PACKET_DELETE, af_packet_delete) \ _(AF_PACKET_DUMP, af_packet_dump) \ -- cgit 1.2.3-korg