24 .arc_name =
"ip4-punt",
30 .arc_name =
"ip4-drop",
51 #define _(sym,string) string, 61 vnet_feat_arc_ip4_punt.feature_arc_index,
68 .name =
"ip4-punt-policer",
69 .vector_size =
sizeof (
u32),
84 .arc_name =
"ip4-punt",
85 .node_name =
"ip4-punt-policer",
102 s =
format (s,
"via %U on %U using adj:%d",
107 s =
format (s,
"via %U on %d using adj:%d",
124 #define foreach_ip4_punt_redirect_error \ 125 _(DROP, "ip4 punt redirect drop") 129 #define _(sym,str) IP4_PUNT_REDIRECT_ERROR_##sym, 136 #define _(sym,string) string, 146 vnet_feat_arc_ip4_punt.feature_arc_index,
147 &ip4_punt_redirect_cfg));
153 .name =
"ip4-punt-redirect",
154 .vector_size =
sizeof (
u32),
172 .arc_name =
"ip4-punt",
173 .node_name =
"ip4-punt-redirect",
185 vnet_feat_arc_ip4_drop.feature_arc_index);
196 vnet_feat_arc_ip4_punt.feature_arc_index);
204 .vector_size =
sizeof (
u32),
218 .vector_size =
sizeof (
u32),
227 .arc_name =
"ip4-punt",
228 .node_name =
"error-punt",
233 .arc_name =
"ip4-drop",
234 .node_name =
"error-drop",
265 if (
unformat (line_input,
"%d", &policer_index))
267 else if (
unformat (line_input,
"del"))
269 else if (
unformat (line_input,
"add"))
278 if (is_add && ~0 == policer_index)
302 .path =
"ip punt policer",
304 .short_help =
"ip punt policer [add|del] <index>",
324 if (~0 == rx_sw_if_index)
332 rx_sw_if_index, uninit_rx_redirect);
347 if (~0 == rx_sw_if_index)
365 u32 tx_sw_if_index, ip46_address_t * nh)
393 u32 rx_sw_if_index = 0;
394 u32 tx_sw_if_index = 0;
409 else if (
unformat (line_input,
"add"))
411 else if (
unformat (line_input,
"rx all"))
413 else if (
unformat (line_input,
"rx %U",
416 else if (
unformat (line_input,
"via %U %U",
421 else if (
unformat (line_input,
"via %U",
423 memset (&nh, 0,
sizeof (nh));
433 if (rx_sw_if_index && tx_sw_if_index)
459 .path =
"ip punt redirect",
461 .short_help =
"ip punt redirect [add|del] rx [<interface>|all] via [<nh>] <tx_interface>",
478 s =
format (s,
" rx %U redirect via %U %U\n",
488 s =
format (s,
" rx all redirect via %U %U\n",
493 any_rx_sw_if_index.tx_sw_if_index));
517 .path =
"show ip punt redirect",
519 .short_help =
"show ip punt redirect",
#define vec_foreach_index(var, v)
Iterate over vector indices.
VLIB_NODE_FUNCTION_MULTIARCH(ip4_punt_policer_node, ip4_punt_policer)
static clib_error_t * ip4_punt_redirect_show_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
vnet_main_t * vnet_get_main(void)
ip4_punt_redirect_error_t
static vlib_node_registration_t ip4_drop_node
(constructor) VLIB_REGISTER_NODE (ip4_drop_node)
ip_punt_redirect_rx_t uninit_rx_redirect
ip_punt_redirect_rx_t * redirect_by_rx_sw_if_index
per-RX interface configuration
static uword ip4_punt_policer(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword ip_drop_or_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 arc_index)
void ip_punt_redirect_del(ip_punt_redirect_t *cfg, u32 rx_sw_if_index)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
unformat_function_t unformat_vnet_sw_interface
void ip4_punt_policer_add_del(u8 is_add, u32 policer_index)
#define foreach_ip4_punt_redirect_error
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u8 * format_ip_punt_redirect_trace(u8 *s, va_list *args)
static vlib_node_registration_t ip4_punt_policer_node
(constructor) VLIB_REGISTER_NODE (ip4_punt_policer_node)
#define clib_error_return(e, args...)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
ip46_address_t nh
The next-hop to send redirected packets to.
#define foreach_ip_punt_policer_error
static char * ip4_punt_redirect_error_strings[]
IP punt redirect configuration.
static uword ip_punt_policer(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 arc_index, u32 policer_index)
IP punt policing node function.
u8 * format_ip_punt_policer_trace(u8 *s, va_list *args)
format_function_t format_vnet_sw_interface_name
ip_punt_redirect_rx_t redirect
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
static char * ip4_punt_policer_error_strings[]
static clib_error_t * ip4_punt_redirect_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
static uword ip_punt_redirect(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 arc_index, ip_punt_redirect_t *redirect)
static vlib_node_registration_t ip4_punt_node
(constructor) VLIB_REGISTER_NODE (ip4_punt_node)
ip_punt_redirect_rx_t any_rx_sw_if_index
any RX interface redirect
static uword ip4_punt_redirect(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
IP4 punt redirect per-rx interface configuration redirect punted traffic to another location...
static vnet_sw_interface_t * vnet_get_sw_interface_safe(vnet_main_t *vnm, u32 sw_if_index)
static vlib_node_registration_t ip4_punt_redirect_node
(constructor) VLIB_REGISTER_NODE (ip4_punt_redirect_node)
u32 tx_sw_if_index
the TX interface to send redirected packets
#define VLIB_CLI_COMMAND(x,...)
static uword ip4_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword ip4_drop(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
IP4 punt policer configuration we police the punt rate to prevent overloading the host...
static clib_error_t * ip4_punt_police_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
void ip4_punt_redirect_del(u32 rx_sw_if_index)
#define VLIB_NODE_FLAG_TRACE
#define VNET_FEATURES(...)
void ip4_punt_redirect_add(u32 rx_sw_if_index, u32 tx_sw_if_index, ip46_address_t *nh)
void ip_punt_redirect_add(ip_punt_redirect_t *cfg, u32 rx_sw_if_index, ip_punt_redirect_rx_t *redirect, fib_protocol_t fproto, vnet_link_t linkt)
Add a punt redirect entry.
void ip4_forward_next_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, vlib_rx_or_tx_t which_adj_index)
u8 * format_ip4_forward_next_trace(u8 *s, va_list *args)
#define VLIB_REGISTER_NODE(x,...)
adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Neighbour Adjacency sub-type.
u8 * format_ip_punt_redirect(u8 *s, va_list *args)
u16 flags
Copy of main node flags.
#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)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
VNET_FEATURE_INIT(ip4_punt_policer_node, static)
adj_index_t adj_index
redirect forwarding adjacency
VNET_FEATURE_ARC_INIT(ip4_punt)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)