15 #ifndef __included_udp_h__ 16 #define __included_udp_h__ 31 #define udp_error(n,s) UDP_ERROR_##n, 53 #define foreach_udp4_dst_port \ 55 _ (67, dhcp_to_server) \ 56 _ (68, dhcp_to_client) \ 67 _ (48879, vxlan_gbp) \ 74 #define foreach_udp6_dst_port \ 76 _ (547, dhcpv6_to_server) \ 77 _ (546, dhcpv6_to_client) \ 83 _ (48879, vxlan6_gbp) \ 84 _ (4790, VXLAN6_GPE) \ 92 #define _(n,f) UDP_DST_PORT_##f = n, 99 #define _(n,f) UDP6_DST_PORT_##f = n, 190 return (uc - udp_main.
connections[uc->c_thread_index]);
239 old_c = udp_main.
connections[thread_index] + connection_index;
242 new_c->c_thread_index = current_thread_index;
244 new_c->c_fib_index = old_c->c_fib_index;
263 u32 node_index,
u8 is_ip4);
282 uh->
length = clib_host_to_net_u16 (udp_len);
285 b->
flags |= VNET_BUFFER_F_OFFLOAD_UDP_CKSUM;
380 ASSERT (_vec_len (ec0) == _vec_len (ec1));
389 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.
port belong to conn (UDPC)
static udp_connection_t * udp_listener_get(u32 conn_index)
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
unformat_function_t unformat_udp_header
uword * dst_port_info_by_dst_port[N_UDP_AF]
static udp_connection_t * udp_get_connection_from_transport(transport_connection_t *tc)
unformat_function_t unformat_udp_port
#define clib_memcpy_fast(a, b, c)
unformat_function_t * unformat_pg_edit
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.
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.
#define foreach_udp6_dst_port
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)
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
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.
transport_connection_t connection
must be first
clib_spinlock_t rx_lock
rx fifo lock
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_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