29 memset (data, 0,
sizeof(*data));
53 switch (address_family)
57 static char * start_nodes[] = {
"cop-input" };
58 static char * feature_nodes[] = {
70 static char * start_nodes[] = {
"cop-input" };
71 static char * feature_nodes[] = {
83 static char * start_nodes[] = {
"cop-input" };
84 static char * feature_nodes[] = {
116 data,
sizeof(*data));
121 data,
sizeof(*data));
160 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
180 u32 sw_if_index = ~0;
181 int enable_disable = 1;
195 if (sw_if_index == ~0)
204 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
206 (0,
"Invalid interface, only works on physical ports");
209 case VNET_API_ERROR_UNIMPLEMENTED:
221 .path =
"cop interface",
223 "cop interface <interface-name> [disable]",
237 u32 next_to_add_del = 0;
252 switch(address_family)
255 is_add = (a->
ip4 != 0);
264 return VNET_API_ERROR_NO_SUCH_FIB;
271 is_add = (a->
ip6 != 0);
279 return VNET_API_ERROR_NO_SUCH_FIB;
301 data, sizeof (*data));
306 data, sizeof (*data));
319 u32 sw_if_index = ~0;
332 else if (
unformat (input,
"default"))
337 else if (
unformat (input,
"fib-id %d", &fib_id))
343 if (sw_if_index == ~0)
358 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
360 (0,
"Invalid interface, only works on physical ports");
363 case VNET_API_ERROR_NO_SUCH_FIB:
368 case VNET_API_ERROR_UNIMPLEMENTED:
381 .path =
"cop whitelist",
383 "cop whitelist <interface-name> [ip4][ip6][default][fib-id <NN>][disable]",
void vnet_config_init(vlib_main_t *vm, vnet_config_main_t *cm, char *start_node_names[], int n_start_node_names, char *feature_node_names[], int n_feature_node_names)
cop_config_main_t cop_config_mains[VNET_N_COPS]
int vnet_hw_interface_rx_redirect_to_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
u32 vnet_config_del_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
unformat_function_t unformat_vnet_sw_interface
u32 * node_index_by_feature_index
vnet_main_t * vnet_get_main(void)
#define VLIB_INIT_FUNCTION(x)
u32 * config_index_by_sw_if_index
static clib_error_t * cop_whitelist_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define clib_warning(format, args...)
#define vlib_call_init_function(vm, x)
static clib_error_t * ip6_whitelist_init(vlib_main_t *vm)
static clib_error_t * cop_init(vlib_main_t *vm)
uword * fib_index_by_table_id
vlib_node_registration_t cop_input_node
(constructor) VLIB_REGISTER_NODE (cop_input_node)
int cop_whitelist_enable_disable(cop_whitelist_enable_disable_args_t *a)
uword * fib_index_by_table_id
static clib_error_t * cop_sw_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
int cop_interface_enable_disable(u32 sw_if_index, int enable_disable)
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * cop_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 vnet_config_add_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
always_inline vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static clib_error_t * ip4_whitelist_init(vlib_main_t *vm)
vnet_sw_interface_type_t type
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(cop_sw_interface_add_del)
#define clib_error_return(e, args...)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
vnet_config_main_t config_main