19 #include <vpp/app/version.h> 86 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
93 while (n_left_from > 0)
98 while (n_left_from > 0 && n_left_to_next > 0)
104 pi0 = to_next[0] = from[0];
121 int ethernet_header_offset = 0;
125 if (clib_net_to_host_u16(eth->
type) == ETHERNET_TYPE_IP4)
131 n_left_to_next, pi0, next0);
148 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
155 while (n_left_from > 0)
160 while (n_left_from > 0 && n_left_to_next > 0)
167 pi0 = to_next[0] = from[0];
189 if (kv.
value != ~(0L))
198 clib_memcpy(eth, &stn_ip4_ethernet_header,
sizeof(*eth));
200 clib_memcpy(eth, &stn_ip6_ethernet_header,
sizeof(*eth));
211 n_left_to_next, pi0, next0);
220 #define foreach_stn_ip_punt_error \ 224 #define _(sym,str) STN_IP_punt_ERROR_##sym, 231 #define _(sym,string) string, 253 .name =
"stn-ip6-punt",
254 .vector_size =
sizeof (
u32),
283 .name =
"stn-ip4-punt",
284 .vector_size =
sizeof (
u32),
306 stn_ip4_ethernet_header.
type = clib_host_to_net_u16(ETHERNET_TYPE_IP4);
310 stn_ip6_ethernet_header.
type = clib_host_to_net_u16(ETHERNET_TYPE_IP6);
327 .version = VPP_BUILD_VER,
328 .description =
"VPP Steals the NIC for Container integration",
370 u32 output_node_index =
399 this_vlib_main->os_punt_frame =
NULL;
405 return VNET_API_ERROR_NO_SUCH_ENTRY;
419 s = format (s,
"- %U\n", format_stn_rule, rule);
430 .path =
"show stn rules",
458 else if (
unformat (line_input,
"del"))
494 .short_help =
"address <addr> interface <iface> [del]",
static uword stn_ip4_punt_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static u8 stn_hw_addr_local[6]
vnet_main_t * vnet_get_main(void)
static char * stn_ip_punt_error_strings[]
u32 sw_if_index
TX interface to send packets to.
struct _vlib_node_registration vlib_node_registration_t
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
#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.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define static_always_inline
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
static uword stn_ip6_punt_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#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)
static void stn_punt_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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 foreach_vlib_main(body)
#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).
u32 punt_to_stn_ip4_next_index
#define ip46_address_is_ip4(ip46)
void udp_punt_unknown(vlib_main_t *vm, u8 is_ip4, u8 is_add)
clib_error_t * stn_init(vlib_main_t *vm)
INDENT-ON
static u8 stn_hw_addr_dst[6]
#define vec_free(V)
Free vector's memory (no header).
#define VLIB_BUFFER_IS_TRACED
u32 vnet_tx_node_index_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define clib_memcpy(a, b, c)
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_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
#define VLIB_CLI_COMMAND(x,...)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
u32 punt_to_stn_ip6_next_index
#define ip46_address_set_ip4(ip46, ip)
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.
static vlib_main_t * vlib_get_main(void)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
void tcp_punt_unknown(vlib_main_t *vm, u8 is_ip4, u8 is_add)
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
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)
#define VLIB_REGISTER_NODE(x,...)
static clib_error_t * show_stn_rules_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
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)