|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
32 #include <sys/socket.h>
38 #define punt_error(n,s) PUNT_ERROR_##n,
44 #define foreach_punt_next \
45 _ (PUNT4, "ip4-punt") \
50 #define _(s,n) PUNT_NEXT_##s,
64 #define punt_next_punt(is_ip4) (is_ip4 ? PUNT_NEXT_PUNT4 : PUNT_NEXT_PUNT6)
114 b0->
error =
node->errors[PUNT_ERROR_UDP_PORT];
124 #define punt_error(n,s) s,
187 .name =
"ip4-udp-punt",
189 .vector_size =
sizeof (
u32),
196 #define _(s,n) [PUNT_NEXT_##s] = n,
203 .name =
"ip6-udp-punt",
205 .vector_size =
sizeof (
u32),
212 #define _(s,n) [PUNT_NEXT_##s] = n,
262 for (
i = 0;
i < n_packets;
i++)
272 if (PUNT_TYPE_L4 == pt)
297 else if (PUNT_TYPE_IP_PROTO == pt)
315 else if (PUNT_TYPE_EXCEPTION == pt)
325 PUNT_ERROR_SOCKET_TX_ERROR, 1);
329 struct sockaddr_un *caddr = &
c->caddr;
338 iov->iov_base = &packetdesc;
339 iov->iov_len =
sizeof (packetdesc);
376 while (
b->
flags & VLIB_BUFFER_NEXT_PRESENT);
379 struct msghdr msg = {
381 .msg_namelen =
sizeof (*caddr),
386 if (sendmsg (pm->
socket_fd, &msg, 0) < (ssize_t) l)
388 PUNT_ERROR_SOCKET_TX_ERROR, 1);
418 PUNT_TYPE_IP_PROTO,
AF_IP4);
426 PUNT_TYPE_IP_PROTO,
AF_IP6);
434 PUNT_TYPE_EXCEPTION,
AF_IP4);
441 .name =
"ip4-udp-punt-socket",
445 .vector_size =
sizeof (
u32),
451 .name =
"ip6-udp-punt-socket",
454 .vector_size =
sizeof (
u32),
460 .name =
"ip4-proto-punt-socket",
464 .vector_size =
sizeof (
u32),
470 .name =
"ip6-proto-punt-socket",
473 .vector_size =
sizeof (
u32),
479 .name =
"exception-punt-socket",
482 .vector_size =
sizeof (
u32),
527 error = PUNT_ERROR_NOBUFFER;
532 io[0].iov_base = &packetdesc;
533 io[0].iov_len =
sizeof (packetdesc);
534 io[1].iov_base =
b->
data;
535 io[1].iov_len = buffer_size;
537 size = readv (fd, io, 2);
542 error = PUNT_ERROR_READV;
546 b->
flags = VNET_BUFFER_F_LOCALLY_ORIGINATED;
549 switch (packetdesc.
action)
569 error = PUNT_ERROR_ACTION;
621 .name =
"punt-socket-rx",
624 .state = VLIB_NODE_STATE_INTERRUPT,
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
u32 next_buffer
Next buffer for this linked-list of buffers.
static uword punt_socket_rx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
static u8 * format_udp_punt_trace(u8 *s, va_list *args)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
nat44_ei_hairpin_src_next_t next_index
vlib_node_registration_t punt_socket_rx_node
(constructor) VLIB_REGISTER_NODE (punt_socket_rx_node)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
@ PUNT_SOCKET_RX_NEXT_IP4_LOOKUP
vlib_main_t vlib_node_runtime_t * node
static uword punt_socket_rx_fd(vlib_main_t *vm, vlib_node_runtime_t *node, u32 fd)
static_always_inline punt_client_t * punt_client_exception_get(vlib_punt_reason_t reason)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static uword udp6_punt_socket(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static u32 vlib_get_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt)
#define foreach_punt_next
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
static u8 * format_punt_trace(u8 *s, va_list *va)
#define punt_next_punt(is_ip4)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static_always_inline punt_client_t * punt_client_ip_proto_get(ip_address_family_t af, ip_protocol_t proto)
vlib_node_registration_t ip4_proto_punt_socket_node
(constructor) VLIB_REGISTER_NODE (ip4_proto_punt_socket_node)
static_always_inline punt_client_t * punt_client_l4_get(ip_address_family_t af, u16 port)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
enum punt_action_e action
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
vlib_node_registration_t exception_punt_socket_node
(constructor) VLIB_REGISTER_NODE (exception_punt_socket_node)
#define VLIB_NODE_FN(node)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static uword ip6_proto_punt_socket(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
vnet_main_t * vnet_get_main(void)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static uword exception_punt_socket(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static uword udp4_punt_socket(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_NODE_FLAG_TRACE_SUPPORTED
vlib_node_registration_t udp6_punt_node
(constructor) VLIB_REGISTER_NODE (udp6_punt_node)
#define VLIB_NODE_FLAG_IS_DROP
static uword ip4_proto_punt_socket(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static void vlib_set_trace_count(vlib_main_t *vm, vlib_node_runtime_t *rt, u32 count)
struct _vlib_node_registration vlib_node_registration_t
u16 current_length
Nbytes between current data and the end of this buffer.
static char * punt_error_strings[]
#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.
Definitions for punt infrastructure.
format_function_t format_vnet_sw_if_index_name
description fragment has unexpected format
enum punt_action_e action
@ PUNT_SOCKET_RX_NEXT_IP6_LOOKUP
vlib_put_next_frame(vm, node, next_index, 0)
static_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
vl_api_address_family_t af
vlib_node_registration_t udp4_punt_socket_node
(constructor) VLIB_REGISTER_NODE (udp4_punt_socket_node)
enum punt_type_t_ punt_type_t
enum ip_protocol ip_protocol_t
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static uword udp46_punt_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int is_ip4)
IPv4/IPv6 UDP punt node main loop.
static uword punt_socket_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, punt_type_t pt, ip_address_family_t af)
@ PUNT_SOCKET_RX_NEXT_INTERFACE_OUTPUT
punt_thread_data_t * thread_data
vlib_node_registration_t udp4_punt_node
(constructor) VLIB_REGISTER_NODE (udp4_punt_node)
static __clib_warn_unused_result int vlib_trace_buffer(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, vlib_buffer_t *b, int follow_chain)
struct punt_trace_t_ punt_trace_t
vlib_node_registration_t udp6_punt_socket_node
(constructor) VLIB_REGISTER_NODE (udp6_punt_socket_node)
vl_api_mac_event_action_t action
#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).
vlib_node_registration_t ip6_proto_punt_socket_node
(constructor) VLIB_REGISTER_NODE (ip6_proto_punt_socket_node)
#define vec_del1(v, i)
Delete the element at index I.
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
enum ip_address_family_t_ ip_address_family_t
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)