24 .arc_name =
"ip4-punt",
30 .arc_name =
"ip4-drop",
39 #ifndef CLIB_MARCH_VARIANT 57 #define _(sym,string) string, 67 vnet_feat_arc_ip4_punt.feature_arc_index,
73 .name =
"ip4-punt-policer",
74 .vector_size =
sizeof (
u32),
86 .arc_name =
"ip4-punt",
87 .node_name =
"ip4-punt-policer",
92 #ifndef CLIB_MARCH_VARIANT 105 s =
format (s,
"via %U on %U using adj:%d",
110 s =
format (s,
"via %U on %d using adj:%d",
128 #define foreach_ip4_punt_redirect_error \ 129 _(DROP, "ip4 punt redirect drop") 133 #define _(sym,str) IP4_PUNT_REDIRECT_ERROR_##sym, 140 #define _(sym,string) string, 150 vnet_feat_arc_ip4_punt.feature_arc_index,
151 &ip4_punt_redirect_cfg));
156 .name =
"ip4-punt-redirect",
157 .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);
214 .vector_size =
sizeof (
u32),
224 .name =
"ip4-not-enabled",
225 .vector_size =
sizeof (
u32),
237 .vector_size =
sizeof (
u32),
246 .arc_name =
"ip4-punt",
247 .node_name =
"error-punt",
252 .arc_name =
"ip4-drop",
253 .node_name =
"error-drop",
258 #ifndef CLIB_MARCH_VARIANT 286 if (
unformat (line_input,
"%d", &policer_index))
288 else if (
unformat (line_input,
"del"))
290 else if (
unformat (line_input,
"add"))
299 if (is_add && ~0 == policer_index)
323 .path =
"ip punt policer",
325 .short_help =
"ip punt policer [add|del] <index>",
329 #ifndef CLIB_MARCH_VARIANT 346 if (~0 == rx_sw_if_index)
354 rx_sw_if_index, uninit_rx_redirect);
369 if (~0 == rx_sw_if_index)
387 u32 tx_sw_if_index, ip46_address_t * nh)
417 u32 rx_sw_if_index = 0;
418 u32 tx_sw_if_index = 0;
432 else if (
unformat (line_input,
"add"))
434 else if (
unformat (line_input,
"rx all"))
436 else if (
unformat (line_input,
"rx %U",
439 else if (
unformat (line_input,
"via %U %U",
444 else if (
unformat (line_input,
"via %U",
456 if (rx_sw_if_index && tx_sw_if_index)
482 .path =
"ip punt redirect",
484 .short_help =
"ip punt redirect [add|del] rx [<interface>|all] via [<nh>] <tx_interface>",
488 #ifndef CLIB_MARCH_VARIANT 502 s =
format (s,
" rx %U redirect via %U %U\n",
512 s =
format (s,
" rx all redirect via %U %U\n",
517 any_rx_sw_if_index.tx_sw_if_index));
533 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.
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
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_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
#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)
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
unformat_function_t unformat_vnet_sw_interface
#define VLIB_NODE_FN(node)
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)
ip_punt_redirect_t ip4_punt_redirect_cfg
vlib_node_registration_t ip4_punt_policer_node
(constructor) VLIB_REGISTER_NODE (ip4_punt_policer_node)
vlib_node_registration_t ip4_not_enabled_node
(constructor) VLIB_REGISTER_NODE (ip4_not_enabled_node)
ip_punt_policer_t ip4_punt_policer_cfg
#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)
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
IP4 punt redirect per-rx interface configuration redirect punted traffic to another location...
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
VNET_FEATURE_INIT(ip4_punt_policer_node)
#define VLIB_CLI_COMMAND(x,...)
static uword ip4_punt(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,...)
adj_index_t adj_index
redirect forwarding adjacency
static vnet_sw_interface_t * vnet_get_sw_interface_or_null(vnet_main_t *vnm, u32 sw_if_index)
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)