19 #include <vpp/app/version.h> 94 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
101 while (n_left_from > 0)
106 while (n_left_from > 0 && n_left_to_next > 0)
113 pi0 = to_next[0] = from[0];
135 if (kv.
value != ~(0L))
161 n_left_to_next, pi0, next0);
170 #define foreach_stn_ip_punt_error \ 174 #define _(sym,str) STN_IP_punt_ERROR_##sym, 181 #define _(sym,string) string, 203 .name =
"stn-ip6-punt",
204 .vector_size =
sizeof (
u32),
215 .arc_name =
"ip6-punt",
216 .node_name =
"stn-ip6-punt",
238 .name =
"stn-ip4-punt",
239 .vector_size =
sizeof (
u32),
250 .arc_name =
"ip4-punt",
251 .node_name =
"stn-ip4-punt",
266 stn_ip4_ethernet_header.
type = clib_host_to_net_u16(ETHERNET_TYPE_IP4);
270 stn_ip6_ethernet_header.
type = clib_host_to_net_u16(ETHERNET_TYPE_IP6);
281 .version = VPP_BUILD_VER,
282 .description =
"VPP Steals the NIC (STN) for Container Integration",
326 u32 output_node_index =
356 return VNET_API_ERROR_NO_SUCH_ENTRY;
370 s = format (s,
"- %U\n", format_stn_rule, rule);
381 .path =
"show stn rules",
409 else if (
unformat (line_input,
"del"))
445 .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[]
#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
#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 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)
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).
#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
#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.
#define VLIB_CLI_COMMAND(x,...)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#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.
#define VNET_FEATURES(...)
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)
struct _vlib_node_registration vlib_node_registration_t
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)
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.
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
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)