|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
39 #define UDP_NO_NODE_SET ((u16) ~0)
41 #ifndef CLIB_MARCH_VARIANT
49 s =
format (s,
"UDP: src-port %d dst-port %d%s",
52 t->
bound ?
"" :
" (no listener)");
73 b->
error =
node->errors[UDP_ERROR_NO_LISTENER];
83 b, ICMP4_destination_unreachable,
84 ICMP4_destination_unreachable_port_unreachable, 0);
85 b->
error =
node->errors[UDP_ERROR_NO_LISTENER];
91 b, ICMP6_destination_unreachable,
92 ICMP6_destination_unreachable_port_unreachable, 0);
93 b->
error =
node->errors[UDP_ERROR_NO_LISTENER];
106 u16 *next_by_dst_port = (is_ip4 ?
124 u32 i0, i1, dst_port0, dst_port1;
125 u32 advance0, advance1;
126 u32 error0, next0, error1, next1;
168 error0 = UDP_ERROR_LENGTH_ERROR;
175 error0 = UDP_ERROR_NONE;
180 error0 = UDP_ERROR_LENGTH_ERROR;
187 error1 = UDP_ERROR_LENGTH_ERROR;
194 error1 = UDP_ERROR_NONE;
199 error1 = UDP_ERROR_LENGTH_ERROR;
205 dst_port0 = (error0 == 0) ? h0->
dst_port : 0;
206 dst_port1 = (error1 == 0) ? h1->dst_port : 0;
209 next0 = (error0 == 0) ?
vec_elt (next_by_dst_port, i0) : next0;
210 next1 = (error1 == 0) ?
vec_elt (next_by_dst_port, i1) : next1;
219 b0->
error =
node->errors[UDP_ERROR_NONE];
231 b1->
error =
node->errors[UDP_ERROR_NONE];
240 if (b0->
error !=
node->errors[UDP_ERROR_LENGTH_ERROR])
251 if (b1->
error !=
node->errors[UDP_ERROR_LENGTH_ERROR])
253 tr->
src_port = h1 ? h1->src_port : 0;
254 tr->
dst_port = h1 ? h1->dst_port : 0;
260 to_next, n_left_to_next,
261 bi0, bi1, next0, next1);
289 b0->
error =
node->errors[UDP_ERROR_LENGTH_ERROR];
302 next0 =
vec_elt (next_by_dst_port, i0);
311 b0->
error =
node->errors[UDP_ERROR_NONE];
318 b0->
error =
node->errors[UDP_ERROR_LENGTH_ERROR];
327 if (b0->
error !=
node->errors[UDP_ERROR_LENGTH_ERROR])
336 to_next, n_left_to_next,
346 #define udp_error(n,s) s,
367 .name =
"ip4-udp-lookup",
369 .vector_size =
sizeof (
u32),
389 .name =
"ip6-udp-lookup",
391 .vector_size =
sizeof (
u32),
409 #ifndef CLIB_MARCH_VARIANT
412 char *dst_port_name,
u8 is_ip4)
420 pi->
name = dst_port_name;
527 u8 **result = va_arg (*args,
u8 **);
529 __attribute__ ((unused))
int old_length;
536 old_length =
vec_len (*result);
576 for (
i = 0;
i < 2;
i++)
596 #define _(n,s) udp_add_dst_port (um, UDP_DST_PORT_##s, #s, 1 );
599 #define _(n,s) udp_add_dst_port (um, UDP_DST_PORT_##s, #s, 0 );
#define hash_set(h, key, value)
vl_api_ip_port_and_mask_t dst_port
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
void icmp6_error_set_vnet_buffer(vlib_buffer_t *b, u8 type, u8 code, u32 data)
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
nat44_ei_hairpin_src_next_t next_index
uword unformat_udp_header(unformat_input_t *input, va_list *args)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
vlib_main_t vlib_node_runtime_t * node
#define foreach_udp4_dst_port
#define hash_create_string(elts, value_bytes)
static clib_error_t * udp_init(vlib_main_t *vm)
#define hash_set_mem(h, key, value)
#define vlib_call_init_function(vm, x)
static uword udp46_local_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int is_ip4)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static void udp_setup_node(vlib_main_t *vm, u32 node_index)
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
void ip4_register_protocol(u32 protocol, u32 node_index)
u8 * format_udp_rx_trace(u8 *s, va_list *args)
#define clib_error_report(e)
unformat_function_t * unformat_buffer
#define SPARSE_VEC_INVALID_INDEX
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
void udp_punt_unknown(vlib_main_t *vm, u8 is_ip4, u8 is_add)
uword * dst_port_info_by_name[N_UDP_AF]
#define vec_elt(v, i)
Get vector value at index i.
udp_dst_port_info_t * dst_port_infos[N_UDP_AF]
#define CLIB_PREFETCH(addr, size, type)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
format_function_t * format_buffer
#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.
#define sparse_vec_validate(v, i)
#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.
unformat_function_t * unformat_edit
clib_error_t * udp_local_init(vlib_main_t *vm)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
vlib_node_registration_t udp4_local_node
(constructor) VLIB_REGISTER_NODE (udp4_local_node)
static pg_node_t * pg_get_node(uword node_index)
static char * udp_error_strings[]
static uword sparse_vec_index(void *v, uword sparse_index)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
vl_api_ip_port_and_mask_t src_port
u8 icmp_send_unreachable_disabled
void udp_unregister_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u8 is_ip4)
u8 udp_is_valid_dst_port(udp_dst_port_t dst_port, u8 is_ip4)
struct _vlib_node_registration vlib_node_registration_t
u16 current_length
Nbytes between current data and the end of this buffer.
static_always_inline void icmp4_error_set_vnet_buffer(vlib_buffer_t *b, u8 type, u8 code, u32 data)
#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.
static void sparse_vec_index2(void *v, u32 si0, u32 si1, u32 *i0_return, u32 *i1_return)
description fragment has unexpected format
vlib_put_next_frame(vm, node, next_index, 0)
#define VLIB_INIT_FUNCTION(x)
static void udp_dispatch_error(vlib_node_runtime_t *node, vlib_buffer_t *b, u32 advance, u8 is_ip4, u32 *next)
uword * dst_port_info_by_dst_port[N_UDP_AF]
static udp_dst_port_info_t * udp_get_dst_port_info(udp_main_t *um, udp_dst_port_t dst_port, u8 is_ip4)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
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.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static int ip4_header_bytes(const ip4_header_t *i)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
void udp_add_dst_port(udp_main_t *um, udp_dst_port_t dst_port, char *dst_port_name, u8 is_ip4)
#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 hash_create(elts, value_bytes)
vlib_node_registration_t udp6_local_node
(constructor) VLIB_REGISTER_NODE (udp6_local_node)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
static void * sparse_vec_new(uword elt_bytes, uword sparse_index_bits)
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)