52 uc->c_thread_index = thread_index;
53 uc->c_proto = TRANSPORT_PROTO_UDP;
61 u32 thread_index = uc->c_thread_index;
73 clib_net_to_host_u16 (uc->c_lcl_port),
97 listener->c_lcl_port = lcl->port;
105 ip_set (&lcl->ip, iface_ip, lcl->is_ip4);
107 ip_copy (&listener->c_lcl_ip, &lcl->ip, lcl->is_ip4);
108 listener->c_is_ip4 = lcl->is_ip4;
109 listener->c_proto = TRANSPORT_PROTO_UDP;
110 listener->c_s_index = session_index;
111 listener->c_fib_index = lcl->fib_index;
118 return listener->c_c_index;
163 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
215 s =
format (s,
"[#%d][%s] %U:%d->%U:%d", uc->c_thread_index,
"U",
218 &uc->c_rmt_ip4, clib_net_to_host_u16 (uc->c_rmt_port));
220 s =
format (s,
"[#%d][%s] %U:%d->%U:%d", uc->c_thread_index,
"U",
223 &uc->c_rmt_ip6, clib_net_to_host_u16 (uc->c_rmt_port));
231 u32 verbose = va_arg (*args,
u32);
238 s =
format (s,
"%-15s",
"-");
248 u32 uci = va_arg (*args,
u32);
249 u32 thread_index = va_arg (*args,
u32);
250 u32 verbose = va_arg (*args,
u32);
260 u32 __clib_unused tci = va_arg (*args,
u32);
261 u32 __clib_unused thread_index = va_arg (*args,
u32);
269 u32 tci = va_arg (*args,
u32);
270 u32 __clib_unused thread_index = va_arg (*args,
u32);
271 u32 verbose = va_arg (*args,
u32);
297 ip46_address_t lcl_addr;
323 ip_copy (&uc->c_rmt_ip, &rmt->ip, rmt->is_ip4);
324 ip_copy (&uc->c_lcl_ip, &lcl_addr, rmt->is_ip4);
325 uc->c_rmt_port = rmt->port;
326 uc->c_lcl_port = clib_host_to_net_u16 (lcl_port);
327 uc->c_is_ip4 = rmt->is_ip4;
328 uc->c_proto = TRANSPORT_PROTO_UDP;
329 uc->c_fib_index = rmt->fib_index;
332 return uc->c_c_index;
365 .transport_options = {
381 if (uc_index == (
u32) ~ 0)
394 if (li_index == (
u32) ~ 0)
417 .transport_options = {
420 .half_open_has_fifos = 1
467 for (i = 0; i < num_threads; i++)
478 .runs_after =
VLIB_INITS(
"ip_main_init",
"ip4_lookup_init",
538 .path =
"show udp punt",
539 .short_help =
"show udp punt [ipv4|ipv6]",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static clib_error_t * show_udp_punt_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd_arg)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
void udp_session_cleanup(u32 connection_index, u32 thread_index)
#define ENDPOINT_INVALID_INDEX
port belong to conn (UDPC)
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)
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)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void session_transport_delete_notify(transport_connection_t *tc)
Notification from transport that connection is being deleted.
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.
static udp_dst_port_info_t * udp_get_dst_port_info(udp_main_t *um, udp_dst_port_t dst_port, u8 is_ip4)
int udp_open_connection(transport_endpoint_cfg_t *rmt)
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)
unformat_function_t * unformat_pg_edit
void udp_connection_free(udp_connection_t *uc)
int udpc_connection_open(transport_endpoint_cfg_t *rmt)
#define VLIB_INIT_FUNCTION(x)
u32 udp_session_bind(u32 session_index, transport_endpoint_t *lcl)
#define clib_error_return(e, args...)
int transport_alloc_local_endpoint(u8 proto, transport_endpoint_cfg_t *rmt_cfg, ip46_address_t *lcl_addr, u16 *lcl_port)
static const transport_proto_vft_t udpc_proto
struct _transport_proto_vft transport_proto_vft_t
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_dst_port_info_t * dst_port_infos[N_UDP_AF]
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)
void udp_connection_delete(udp_connection_t *uc)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
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)
struct _transport_connection transport_connection_t
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.
#define VLIB_CLI_COMMAND(x,...)
static u32 transport_max_tx_dequeue(transport_connection_t *tc)
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)
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
bool udp_is_valid_dst_port(udp_dst_port_t dst_port, u8 is_ip4)
void udp_session_close(u32 connection_index, u32 thread_index)
VLIB buffer representation.
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()
#define vec_foreach(var, vec)
Vector iterator.
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...
#define CLIB_CACHE_LINE_BYTES
u32 udp_send_space(transport_connection_t *t)
udp_connection_t ** connections
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
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 * format_udp_listener_session(u8 *s, va_list *args)