};
/* *INDENT-ON* */
+extern ip_punt_policer_t ip6_punt_policer_cfg;
+
+#ifndef CLIB_MARCH_VARIANT
ip_punt_policer_t ip6_punt_policer_cfg;
+#endif /* CLIB_MARCH_VARIANT */
static char *ip6_punt_policer_error_strings[] = {
#define _(sym,string) string,
#undef _
};
-static uword
-ip6_punt_policer (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_punt_policer_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return (ip_punt_policer (vm, node, frame,
vnet_feat_arc_ip6_punt.feature_arc_index,
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip6_punt_policer_node, static) = {
- .function = ip6_punt_policer,
+VLIB_REGISTER_NODE (ip6_punt_policer_node) = {
.name = "ip6-punt-policer",
.vector_size = sizeof (u32),
.n_next_nodes = IP_PUNT_POLICER_N_NEXT,
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_punt_policer_node,
- ip6_punt_policer);
-
VNET_FEATURE_INIT (ip6_punt_policer_node, static) = {
.arc_name = "ip6-punt",
.node_name = "ip6-punt-policer",
};
/* *INDENT-ON* */
-static uword
-ip6_drop (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_drop_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip6_forward_next_trace (vm, node, frame, VLIB_TX);
}
-static uword
-ip6_not_enabled (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_not_enabled_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip6_forward_next_trace (vm, node, frame, VLIB_TX);
}
-static uword
-ip6_punt (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_punt_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip6_forward_next_trace (vm, node, frame, VLIB_TX);
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip6_drop_node, static) =
+VLIB_REGISTER_NODE (ip6_drop_node) =
{
- .function = ip6_drop,
.name = "ip6-drop",
.vector_size = sizeof (u32),
.format_trace = format_ip6_forward_next_trace,
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_drop_node, ip6_drop);
-
-VLIB_REGISTER_NODE (ip6_not_enabled_node, static) =
+VLIB_REGISTER_NODE (ip6_not_enabled_node) =
{
- .function = ip6_not_enabled,
.name = "ip6-not-enabled",
.vector_size = sizeof (u32),
.format_trace = format_ip6_forward_next_trace,
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_not_enabled_node, ip6_not_enabled);
-
-VLIB_REGISTER_NODE (ip6_punt_node, static) =
+VLIB_REGISTER_NODE (ip6_punt_node) =
{
- .function = ip6_punt,
.name = "ip6-punt",
.vector_size = sizeof (u32),
.format_trace = format_ip6_forward_next_trace,
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_punt_node, ip6_punt);
-
VNET_FEATURE_INIT (ip6_punt_end_of_arc, static) = {
.arc_name = "ip6-punt",
.node_name = "error-punt",
};
/* *INDENT-ON */
+#ifndef CLIB_MARCH_VARIANT
void
ip6_punt_policer_add_del (u8 is_add, u32 policer_index)
{
vnet_feature_enable_disable ("ip6-punt", "ip6-punt-policer",
0, is_add, 0, 0);
}
+#endif /* CLIB_MARCH_VARIANT */
static clib_error_t *
ip6_punt_police_cmd (vlib_main_t * vm,
.short_help = "ip6 punt policer [add|del] <index>",
};
-
-ip_punt_redirect_t ip6_punt_redirect_cfg = {
- .any_rx_sw_if_index = {
- .tx_sw_if_index = ~0,
- .adj_index = ADJ_INDEX_INVALID,
- },
-};
/* *INDENT-ON* */
#define foreach_ip6_punt_redirect_error \
#undef _
};
-static uword
-ip6_punt_redirect (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (ip6_punt_redirect_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return (ip_punt_redirect (vm, node, frame,
vnet_feat_arc_ip6_punt.feature_arc_index,
- &ip6_punt_redirect_cfg));
+ FIB_PROTOCOL_IP6));
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip6_punt_redirect_node, static) = {
- .function = ip6_punt_redirect,
+VLIB_REGISTER_NODE (ip6_punt_redirect_node) = {
.name = "ip6-punt-redirect",
.vector_size = sizeof (u32),
.n_next_nodes = IP_PUNT_REDIRECT_N_NEXT,
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (ip6_punt_redirect_node,
- ip6_punt_redirect);
-
VNET_FEATURE_INIT (ip6_punt_redirect_node, static) = {
.arc_name = "ip6-punt",
.node_name = "ip6-punt-redirect",
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
+
void
ip6_punt_redirect_add (u32 rx_sw_if_index,
u32 tx_sw_if_index, ip46_address_t * nh)
{
- ip_punt_redirect_rx_t rx = {
- .tx_sw_if_index = tx_sw_if_index,
- .nh = *nh,
+ /* *INDENT-OFF* */
+ fib_route_path_t *rpaths = NULL, rpath = {
+ .frp_proto = DPO_PROTO_IP6,
+ .frp_addr = *nh,
+ .frp_sw_if_index = tx_sw_if_index,
+ .frp_weight = 1,
+ .frp_fib_index = ~0,
};
+ /* *INDENT-ON* */
+ vec_add1 (rpaths, rpath);
+
+ ip6_punt_redirect_add_paths (rx_sw_if_index, rpaths);
+
+ vec_free (rpaths);
+}
- ip_punt_redirect_add (&ip6_punt_redirect_cfg,
- rx_sw_if_index, &rx, FIB_PROTOCOL_IP6, VNET_LINK_IP6);
+void
+ip6_punt_redirect_add_paths (u32 rx_sw_if_index, fib_route_path_t * rpaths)
+{
+ ip_punt_redirect_add (FIB_PROTOCOL_IP6,
+ rx_sw_if_index,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP6, rpaths);
vnet_feature_enable_disable ("ip6-punt", "ip6-punt-redirect", 0, 1, 0, 0);
}
{
vnet_feature_enable_disable ("ip6-punt", "ip6-punt-redirect", 0, 0, 0, 0);
- ip_punt_redirect_del (&ip6_punt_redirect_cfg, rx_sw_if_index);
+ ip_punt_redirect_del (FIB_PROTOCOL_IP6, rx_sw_if_index);
}
+#endif /* CLIB_MARCH_VARIANT */
static clib_error_t *
ip6_punt_redirect_cmd (vlib_main_t * vm,
vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
+ fib_route_path_t *rpaths = NULL, rpath;
+ dpo_proto_t payload_proto;
clib_error_t *error = 0;
- u32 rx_sw_if_index = 0;
- u32 tx_sw_if_index = 0;
- ip46_address_t nh;
+ u32 rx_sw_if_index = ~0;
vnet_main_t *vnm;
u8 is_add;
else if (unformat (line_input, "rx %U",
unformat_vnet_sw_interface, vnm, &rx_sw_if_index))
;
- else if (unformat (line_input, "via %U %U",
- unformat_ip6_address,
- &nh.ip6,
- unformat_vnet_sw_interface, vnm, &tx_sw_if_index))
- ;
else if (unformat (line_input, "via %U",
- unformat_vnet_sw_interface, vnm, &tx_sw_if_index))
- memset (&nh, 0, sizeof (nh));
+ unformat_fib_route_path, &rpath, &payload_proto))
+ vec_add1 (rpaths, rpath);
else
{
error = unformat_parse_error (line_input);
}
}
+ if (~0 == rx_sw_if_index)
+ {
+ error = unformat_parse_error (line_input);
+ goto done;
+ }
+
if (is_add)
{
- if (rx_sw_if_index && tx_sw_if_index)
- {
- ip6_punt_redirect_add (rx_sw_if_index, tx_sw_if_index, &nh);
- }
+ if (vec_len (rpaths))
+ ip6_punt_redirect_add_paths (rx_sw_if_index, rpaths);
}
else
{
- if (rx_sw_if_index)
- {
- ip6_punt_redirect_del (rx_sw_if_index);
- }
+ ip6_punt_redirect_del (rx_sw_if_index);
}
done:
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
+
+#endif /* CLIB_MARCH_VARIANT */
+
static clib_error_t *
ip6_punt_redirect_show_cmd (vlib_main_t * vm,
unformat_input_t * main_input,
vlib_cli_command_t * cmd)
{
- vlib_cli_output (vm, "%U", format_ip_punt_redirect, &ip6_punt_redirect_cfg);
+ vlib_cli_output (vm, "%U", format_ip_punt_redirect, FIB_PROTOCOL_IP6);
return (NULL);
}