15 #ifndef __included_udp_h__ 16 #define __included_udp_h__ 31 #define udp_error(n,s) UDP_ERROR_##n, 37 #define foreach_udp_connection_flag \ 38 _(CONNECTED, "CONNECTED") \ 39 _(OWNS_PORT, "OWNS_PORT") \ 40 _(CLOSING, "CLOSING") \ 42 _(MIGRATED, "MIGRATED") \ 46 #define _(sym, str) UDP_CONN_F_BIT_##sym, 54 #define _(sym, str) UDP_CONN_F_##sym = 1 << UDP_CONN_F_BIT_##sym, 69 #define foreach_udp4_dst_port \ 71 _ (67, dhcp_to_server) \ 72 _ (68, dhcp_to_client) \ 83 _ (48879, vxlan_gbp) \ 90 #define foreach_udp6_dst_port \ 92 _ (547, dhcpv6_to_server) \ 93 _ (546, dhcpv6_to_client) \ 99 _ (48879, vxlan6_gbp) \ 100 _ (4790, VXLAN6_GPE) \ 104 _ (53053, dns_reply6) 108 #define _(n,f) UDP_DST_PORT_##f = n, 115 #define _(n,f) UDP6_DST_PORT_##f = n, 158 u16 *next_by_dst_port4;
213 return (uc - udp_main.
connections[uc->c_thread_index]);
263 old_c = udp_main.
connections[thread_index] + connection_index;
265 old_c->
flags |= UDP_CONN_F_MIGRATED;
267 new_c->c_thread_index = current_thread_index;
269 new_c->c_fib_index = old_c->c_fib_index;
287 char *dst_port_name,
u8 is_ip4);
290 u32 node_index,
u8 is_ip4);
310 uh->
length = clib_host_to_net_u16 (udp_len);
312 b->
flags |= VNET_BUFFER_F_OFFLOAD_UDP_CKSUM;
314 b->
flags |= VNET_BUFFER_F_L4_HDR_OFFSET_VALID;
407 ASSERT (_vec_len (ec0) == _vec_len (ec1));
416 u16 old_l0 = 0, old_l1 = 0;
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 udp_connection_t * udp_connection_from_transport(transport_connection_t *tc)
static udp_connection_t * udp_listener_get(u32 conn_index)
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
unformat_function_t unformat_udp_header
vl_api_wireguard_peer_flags_t flags
vl_api_ip_port_and_mask_t dst_port
uword * dst_port_info_by_dst_port[N_UDP_AF]
unformat_function_t unformat_udp_port
#define clib_memcpy_fast(a, b, c)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
u16 current_length
Nbytes between current data and the end of this buffer.
uword unformat_pg_edit(unformat_input_t *input, va_list *args)
static udp_dst_port_info_t * udp_get_dst_port_info(udp_main_t *um, udp_dst_port_t dst_port, u8 is_ip4)
vlib_node_registration_t udp4_local_node
(constructor) VLIB_REGISTER_NODE (udp4_local_node)
static void * vlib_buffer_push_udp(vlib_buffer_t *b, u16 sp, u16 dp, u8 offload_csum)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static udp_main_t * vnet_get_udp_main()
udp_connection_t * udp_connection_alloc(u32 thread_index)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
void udp_add_dst_port(udp_main_t *um, udp_dst_port_t dst_port, char *dst_port_name, u8 is_ip4)
#define foreach_udp6_dst_port
void udp_connection_share_port(u16 lcl_port, u8 is_ip4)
static ct_connection_t * connections
static void udp_pool_remove_peeker(u32 thread_index)
vlib_node_registration_t udp4_input_node
(constructor) VLIB_REGISTER_NODE (udp4_input_node)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static u32 udp_connection_index(udp_connection_t *uc)
format_function_t format_udp_connection
udp_dst_port_info_t * dst_port_infos[N_UDP_AF]
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
clib_spinlock_t * peekers_readers_locks
vlib_node_registration_t udp6_input_node
(constructor) VLIB_REGISTER_NODE (udp6_input_node)
udp_connection_t * listener_pool
static void ip_udp_encap_one(vlib_main_t *vm, vlib_buffer_t *b0, u8 *ec0, word ec_len, u8 is_ip4)
static void udp_pool_add_peeker(u32 thread_index)
Acquires a lock that blocks a connection pool from expanding.
void udp_punt_unknown(vlib_main_t *vm, u8 is_ip4, u8 is_add)
static void ip_udp_fixup_one(vlib_main_t *vm, vlib_buffer_t *b0, u8 is_ip4)
format_function_t format_udp_rx_trace
static void ip_udp_encap_two(vlib_main_t *vm, vlib_buffer_t *b0, vlib_buffer_t *b1, u8 *ec0, u8 *ec1, word ec_len, u8 is_v4)
static_always_inline uword vlib_get_thread_index(void)
void udp_unregister_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u8 is_ip4)
static udp_connection_t * udp_connection_get(u32 conn_index, u32 thread_index)
struct _transport_connection transport_connection_t
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
#define foreach_udp4_dst_port
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
clib_spinlock_t * peekers_write_locks
#define foreach_udp_connection_flag
cloned to another thread
enum udp_conn_flags_ udp_conn_flags_t
struct _vlib_node_registration vlib_node_registration_t
static void * vlib_buffer_push_uninit(vlib_buffer_t *b, u8 size)
Prepend uninitialized data to buffer.
bool udp_is_valid_dst_port(udp_dst_port_t dst_port, u8 is_ip4)
VLIB buffer representation.
#define ip_csum_update(sum, old, new, type, field)
vlib_node_registration_t udp6_local_node
(constructor) VLIB_REGISTER_NODE (udp6_local_node)
void udp_connection_free(udp_connection_t *uc)
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
static udp_connection_t * udp_connection_clone_safe(u32 connection_index, u32 thread_index)
u32 total_length_not_including_first_buffer
Only valid for first buffer in chain.
udp_connection_t ** connections
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
static u16 ip_csum_fold(ip_csum_t c)
format_function_t format_udp_header