diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/udp/udp.c | 8 | ||||
-rw-r--r-- | src/vnet/udp/udp.h | 1 | ||||
-rw-r--r-- | src/vnet/udp/udp_input.c | 4 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c index e194b9cc643..0a0247a5ef4 100644 --- a/src/vnet/udp/udp.c +++ b/src/vnet/udp/udp.c @@ -43,6 +43,14 @@ udp_connection_register_port (u16 lcl_port, u8 is_ip4) __ATOMIC_RELAXED); } +void +udp_connection_share_port (u16 lcl_port, u8 is_ip4) +{ + udp_main_t *um = &udp_main; + __atomic_add_fetch (&um->transport_ports_refcnt[is_ip4][lcl_port], 1, + __ATOMIC_RELAXED); +} + static void udp_connection_unregister_port (u16 lcl_port, u8 is_ip4) { diff --git a/src/vnet/udp/udp.h b/src/vnet/udp/udp.h index 3dc116ee4d7..8e4e87f85a8 100644 --- a/src/vnet/udp/udp.h +++ b/src/vnet/udp/udp.h @@ -205,6 +205,7 @@ udp_connection_from_transport (transport_connection_t * tc) void udp_connection_free (udp_connection_t * uc); udp_connection_t *udp_connection_alloc (u32 thread_index); +void udp_connection_share_port (u16 lcl_port, u8 is_ip4); always_inline udp_connection_t * udp_connection_clone_safe (u32 connection_index, u32 thread_index) diff --git a/src/vnet/udp/udp_input.c b/src/vnet/udp/udp_input.c index f1dcab8116f..3a7de623270 100644 --- a/src/vnet/udp/udp_input.c +++ b/src/vnet/udp/udp_input.c @@ -123,8 +123,8 @@ udp_connection_accept (udp_connection_t * listener, session_dgram_hdr_t * hdr, udp_connection_free (uc); return 0; } - transport_share_local_endpoint (TRANSPORT_PROTO_UDP, &uc->c_lcl_ip, - uc->c_lcl_port); + + udp_connection_share_port (uc->c_lcl_port, uc->c_is_ip4); return uc; } |