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);
197 vnet_feat_arc_ip4_drop.feature_arc_index);
207 vnet_feat_arc_ip4_punt.feature_arc_index);
215 .vector_size =
sizeof (
u32),
228 .name =
"ip4-not-enabled",
229 .vector_size =
sizeof (
u32),
243 .vector_size =
sizeof (
u32),
252 .arc_name =
"ip4-punt",
253 .node_name =
"error-punt",
258 .arc_name =
"ip4-drop",
259 .node_name =
"error-drop",
290 if (
unformat (line_input,
"%d", &policer_index))
292 else if (
unformat (line_input,
"del"))
294 else if (
unformat (line_input,
"add"))
303 if (is_add && ~0 == policer_index)
327 .path =
"ip punt policer",
329 .short_help =
"ip punt policer [add|del] <index>",
349 if (~0 == rx_sw_if_index)
357 rx_sw_if_index, uninit_rx_redirect);
372 if (~0 == rx_sw_if_index)
390 u32 tx_sw_if_index, ip46_address_t * nh)
419 u32 rx_sw_if_index = 0;
420 u32 tx_sw_if_index = 0;
434 else if (
unformat (line_input,
"add"))
436 else if (
unformat (line_input,
"rx all"))
438 else if (
unformat (line_input,
"rx %U",
441 else if (
unformat (line_input,
"via %U %U",
446 else if (
unformat (line_input,
"via %U",
458 if (rx_sw_if_index && tx_sw_if_index)
484 .path =
"ip punt redirect",
486 .short_help =
"ip punt redirect [add|del] rx [<interface>|all] via [<nh>] <tx_interface>",
503 s =
format (s,
" rx %U redirect via %U %U\n",
513 s =
format (s,
" rx all redirect via %U %U\n",
518 any_rx_sw_if_index.tx_sw_if_index));
534 if (sw_if_index == ~0 || sw_if_index == rx_sw_if_index)
578 .path =
"show ip punt redirect",
580 .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 uword ip4_not_enabled(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static vlib_node_registration_t ip4_drop_node
(constructor) VLIB_REGISTER_NODE (ip4_drop_node)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
ip_punt_redirect_rx_t uninit_rx_redirect
ip_punt_redirect_detail_t * ip4_punt_redirect_entries(u32 sw_if_index)
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)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
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)
static vlib_node_registration_t ip4_not_enabled_node
(constructor) VLIB_REGISTER_NODE (ip4_not_enabled_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)
#define ip46_address_initializer
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)
#define VLIB_REGISTER_NODE(x,...)
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 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)
u32 rx_sw_if_index
the RX interface
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 VLIB_NODE_FLAG_TRACE
#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)