19 #include <vpp/app/version.h> 93 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
100 while (n_left_from > 0)
105 while (n_left_from > 0 && n_left_to_next > 0)
112 pi0 = to_next[0] = from[0];
134 if (kv.
value != ~(0L))
160 n_left_to_next, pi0, next0);
169 #define foreach_stn_ip_punt_error \ 173 #define _(sym,str) STN_IP_punt_ERROR_##sym, 180 #define _(sym,string) string, 202 .name =
"stn-ip6-punt",
203 .vector_size =
sizeof (
u32),
214 .arc_name =
"ip6-punt",
215 .node_name =
"stn-ip6-punt",
237 .name =
"stn-ip4-punt",
238 .vector_size =
sizeof (
u32),
249 .arc_name =
"ip4-punt",
250 .node_name =
"stn-ip4-punt",
265 stn_ip4_ethernet_header.
type = clib_host_to_net_u16(ETHERNET_TYPE_IP4);
269 stn_ip6_ethernet_header.
type = clib_host_to_net_u16(ETHERNET_TYPE_IP6);
280 .version = VPP_BUILD_VER,
281 .description =
"VPP Steals the NIC (STN) for Container Integration",
320 .protocol = IP_PROTOCOL_UDP,
323 .type = PUNT_TYPE_L4,
338 u32 output_node_index =
368 return VNET_API_ERROR_NO_SUCH_ENTRY;
393 .path =
"show stn rules",
421 else if (
unformat (line_input,
"del"))
457 .short_help =
"address <addr> interface <iface> [del]",
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static uword stn_ip4_punt_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
A registration, by a client, to direct punted traffic to a given node.
static u8 stn_hw_addr_local[6]
vnet_main_t * vnet_get_main(void)
#define pool_foreach(VAR, POOL)
Iterate through pool.
static char * stn_ip_punt_error_strings[]
#define clib_memcpy_fast(a, b, c)
u32 sw_if_index
TX interface to send packets to.
static vlib_node_registration_t stn_ip6_punt
INDENT-OFF
int stn_rule_add_del(stn_rule_add_del_args_t *args)
Add or delete an stn rule.
clib_bihash_16_8_t rule_by_address_table
unformat_function_t unformat_vnet_sw_interface
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
format_function_t format_vnet_sw_if_index_name
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
static vlib_node_registration_t stn_ip4_punt
INDENT-OFF
ip46_address_t address
Destination address of intercepted packets.
#define static_always_inline
#define VLIB_INIT_FUNCTION(x)
static uword stn_ip6_punt_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
description fragment has unexpected format
#define clib_error_return(e, args...)
u8 del
Whether to delete the rule.
static_always_inline uword stn_ip46_punt_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_ipv4)
#define foreach_stn_ip_punt_error
u8 * format_stn_ip6_punt_trace(u8 *s, va_list *args)
void ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
clib_error_t * stn_api_init(vlib_main_t *vm, stn_main_t *sm)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define pool_put(P, E)
Free an object E in pool P.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
format_function_t format_ip46_address
clib_error_t * stn_init(vlib_main_t *vm)
INDENT-ON
#define VLIB_REGISTER_NODE(x,...)
static u8 stn_hw_addr_dst[6]
#define vec_free(V)
Free vector's memory (no header).
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
u32 vnet_tx_node_index_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
VNET_FEATURE_INIT(stn_ip6_punt_feat_node, static)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
vlib_main_t vlib_node_runtime_t * node
#define VLIB_CLI_COMMAND(x,...)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static clib_error_t * stn_rule_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static_always_inline u8 * format_stn_ip46_punt_trace(u8 *s, va_list *args, u8 is_ipv4)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define VNET_FEATURES(...)
static vlib_main_t * vlib_get_main(void)
struct _vlib_node_registration vlib_node_registration_t
static vlib_node_t * vlib_get_next_node(vlib_main_t *vm, u32 node_index, u32 next_index)
Get vlib node by graph arc (next) index.
u8 * format_stn_ip4_punt_trace(u8 *s, va_list *args)
INDENT-ON
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static u8 * format_stn_rule(u8 *s, va_list *args)
static clib_error_t * show_stn_rules_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
clib_error_t * vnet_punt_add_del(vlib_main_t *vm, const punt_reg_t *pr, bool is_add)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
static void ip46_address_set_ip4(ip46_address_t *ip46, const ip4_address_t *ip)
Definitions for punt infrastructure.
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)