48 memset (uc, 0,
sizeof (*uc));
50 uc->c_thread_index = thread_index;
61 memset (uc, 0xFA,
sizeof (*uc));
81 listener->c_lcl_port = lcl->port;
89 ip_set (&lcl->ip, iface_ip, lcl->is_ip4);
91 ip_copy (&listener->c_lcl_ip, &lcl->ip, lcl->is_ip4);
92 listener->c_is_ip4 = lcl->is_ip4;
94 listener->c_s_index = session_index;
95 listener->c_fib_index = lcl->fib_index;
101 return listener->c_c_index;
146 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
192 s =
format (s,
"[#%d][%s] %U:%d->%U:%d", uc->c_thread_index,
"U",
195 &uc->c_rmt_ip4, clib_net_to_host_u16 (uc->c_rmt_port));
197 s =
format (s,
"[#%d][%s] %U:%d->%U:%d", uc->c_thread_index,
"U",
200 &uc->c_rmt_ip6, clib_net_to_host_u16 (uc->c_rmt_port));
208 u32 verbose = va_arg (*args,
u32);
215 s =
format (s,
"%-15s\n",
"-");
225 u32 uci = va_arg (*args,
u32);
226 u32 thread_index = va_arg (*args,
u32);
227 u32 verbose = va_arg (*args,
u32);
244 u32 tci = va_arg (*args,
u32);
270 ip46_address_t lcl_addr;
296 ip_copy (&uc->c_rmt_ip, &rmt->ip, rmt->is_ip4);
297 ip_copy (&uc->c_lcl_ip, &lcl_addr, rmt->is_ip4);
298 uc->c_rmt_port = rmt->port;
299 uc->c_lcl_port = clib_host_to_net_u16 (lcl_port);
300 uc->c_is_ip4 = rmt->is_ip4;
302 uc->c_fib_index = rmt->fib_index;
304 return uc->c_c_index;
434 for (i = 0; i < num_threads; i++)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
void udp_session_cleanup(u32 connection_index, u32 thread_index)
int udpc_connection_open(transport_endpoint_t *rmt)
static udp_connection_t * udp_listener_get(u32 conn_index)
u8 * format_udp_session(u8 *s, va_list *args)
void ip_copy(ip46_address_t *dst, ip46_address_t *src, u8 is_ip4)
struct _transport_connection transport_connection_t
static clib_error_t * ip4_lookup_init(vlib_main_t *vm)
static udp_connection_t * udp_get_connection_from_transport(transport_connection_t *tc)
void ip_set(ip46_address_t *dst, void *src, u8 is_ip4)
static clib_error_t * udp_init(vlib_main_t *vm)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
transport_connection_t * udp_session_get_half_open(u32 conn_index)
#define pool_get_aligned_will_expand(P, YESNO, A)
See if pool_get will expand the pool or not.
struct _transport_proto_vft transport_proto_vft_t
static udp_dst_port_info_t * udp_get_dst_port_info(udp_main_t *um, udp_dst_port_t dst_port, u8 is_ip4)
transport_connection_t * udp_session_get_listener(u32 listener_index)
void * ip_interface_get_first_ip(u32 sw_if_index, u8 is_ip4)
u32 udp_push_header(transport_connection_t *tc, vlib_buffer_t *b)
static void * vlib_buffer_push_udp(vlib_buffer_t *b, u16 sp, u16 dp, u8 offload_csum)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static udp_main_t * vnet_get_udp_main()
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
memset(h->entries, 0, sizeof(h->entries[0])*entries)
unformat_function_t * unformat_pg_edit
void udp_connection_free(udp_connection_t *uc)
#define VLIB_INIT_FUNCTION(x)
u32 udp_session_bind(u32 session_index, transport_endpoint_t *lcl)
#define clib_error_return(e, args...)
void stream_session_delete_notify(transport_connection_t *tc)
Notification from transport that connection is being deleted.
static const transport_proto_vft_t udpc_proto
#define vlib_call_init_function(vm, x)
static void clib_spinlock_init(clib_spinlock_t *p)
vlib_node_registration_t udp4_input_node
(constructor) VLIB_REGISTER_NODE (udp4_input_node)
static ip_protocol_info_t * ip_get_protocol_info(ip_main_t *im, u32 protocol)
format_function_t * format_header
u32 udp_session_unbind(u32 listener_index)
udp_connection_t * udp_connection_alloc(u32 thread_index)
clib_spinlock_t * peekers_readers_locks
#define pool_put(P, E)
Free an object E in pool P.
vlib_node_registration_t udp6_input_node
(constructor) VLIB_REGISTER_NODE (udp6_input_node)
udp_connection_t * listener_pool
u16 udp_send_mss(transport_connection_t *t)
int udp_open_connection(transport_endpoint_t *rmt)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
clib_error_t * ip_main_init(vlib_main_t *vm)
static_always_inline uword vlib_get_thread_index(void)
#define ENDPOINT_INVALID_INDEX
void udp_unregister_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u8 is_ip4)
#define clib_warning(format, args...)
static udp_connection_t * udp_connection_get(u32 conn_index, u32 thread_index)
void transport_register_protocol(transport_proto_t transport_proto, const transport_proto_vft_t *vft, fib_protocol_t fib_proto, u32 output_node)
Register transport virtual function table.
vlib_node_registration_t ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (ip6_lookup_node)
clib_spinlock_t * peekers_write_locks
static vlib_main_t * vlib_get_main(void)
u8 * format_udp_connection(u8 *s, va_list *args)
unreliable transport protos
u8 ip_is_zero(ip46_address_t *ip46_address, u8 is_ip4)
u32 udpc_connection_listen(u32 session_index, transport_endpoint_t *lcl)
static const transport_proto_vft_t udp_proto
static void * vlib_buffer_push_ip6(vlib_main_t *vm, vlib_buffer_t *b, ip6_address_t *src, ip6_address_t *dst, int proto)
Push IPv6 header to buffer.
transport_connection_t connection
must be first
clib_spinlock_t rx_lock
rx fifo lock
void udp_session_close(u32 connection_index, u32 thread_index)
struct _transport_endpoint transport_endpoint_t
u8 * format_udp_half_open_session(u8 *s, va_list *args)
u8 * format_udp_connection_id(u8 *s, va_list *args)
transport_connection_t * udp_session_get(u32 connection_index, u32 thread_index)
static vlib_thread_main_t * vlib_get_thread_main()
static u32 vlib_num_workers()
int transport_alloc_local_endpoint(u8 proto, transport_endpoint_t *rmt, ip46_address_t *lcl_addr, u16 *lcl_port)
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
int transport_alloc_local_port(u8 proto, ip46_address_t *ip)
Allocate local port and add if successful add entry to local endpoint table to mark the pair as used...
static clib_error_t * ip6_lookup_init(vlib_main_t *vm)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
u32 udp_send_space(transport_connection_t *t)
udp_connection_t ** connections
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
static void * vlib_buffer_push_ip4(vlib_main_t *vm, vlib_buffer_t *b, ip4_address_t *src, ip4_address_t *dst, int proto, u8 csum_offload)
Push IPv4 header to buffer.
u8 is_connected
connected mode
u8 * format_udp_listener_session(u8 *s, va_list *args)