summaryrefslogtreecommitdiffstats
path: root/src/vnet/udp
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-04-01 23:16:11 +0000
committerDave Barach <openvpp@barachs.net>2020-04-02 11:28:01 +0000
commit57a5a2df5970f61259c9a14b5eb79358a2115b01 (patch)
treeb77c249a79c10dda35a07b32cac2e4e5ffce2a8f /src/vnet/udp
parentdfd980fcffacc2bed90e53b9da669eac53025bb2 (diff)
udp session vcl: add udp iperf test
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ib4bc2ce781887a84055a4d5cdb7f453fc7d52c79
Diffstat (limited to 'src/vnet/udp')
-rw-r--r--src/vnet/udp/udp.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 375e95bab58..ba1821a5026 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -132,15 +132,23 @@ udp_connection_free (udp_connection_t * uc)
pool_put (udp_main.connections[thread_index], uc);
}
-void
-udp_connection_delete (udp_connection_t * uc)
+static void
+udp_connection_cleanup (udp_connection_t * uc)
{
+ transport_endpoint_cleanup (TRANSPORT_PROTO_UDP, &uc->c_lcl_ip,
+ uc->c_lcl_port);
udp_connection_unregister_port (clib_net_to_host_u16 (uc->c_lcl_port),
uc->c_is_ip4);
- session_transport_delete_notify (&uc->connection);
udp_connection_free (uc);
}
+void
+udp_connection_delete (udp_connection_t * uc)
+{
+ session_transport_delete_notify (&uc->connection);
+ udp_connection_cleanup (uc);
+}
+
u32
udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
{
@@ -149,12 +157,14 @@ udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
transport_endpoint_cfg_t *lcl_ext;
udp_connection_t *listener;
udp_dst_port_info_t *pi;
+ u16 lcl_port_ho;
void *iface_ip;
- pi = udp_get_dst_port_info (um, clib_net_to_host_u16 (lcl->port),
- lcl->is_ip4);
+ lcl_port_ho = clib_net_to_host_u16 (lcl->port);
+ pi = udp_get_dst_port_info (um, lcl_port_ho, lcl->is_ip4);
- if (pi && !pi->n_connections)
+ if (pi && !pi->n_connections
+ && udp_is_valid_dst_port (lcl_port_ho, lcl->is_ip4))
{
clib_warning ("port already used");
return -1;
@@ -186,8 +196,7 @@ udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
listener->c_flags |= TRANSPORT_CONNECTION_F_CLESS;
clib_spinlock_init (&listener->rx_lock);
- udp_connection_register_port (vm, clib_net_to_host_u16 (lcl->port),
- lcl->is_ip4);
+ udp_connection_register_port (vm, lcl_port_ho, lcl->is_ip4);
return listener->c_c_index;
}
@@ -276,7 +285,7 @@ udp_session_cleanup (u32 connection_index, u32 thread_index)
udp_connection_t *uc;
uc = udp_connection_get (connection_index, thread_index);
if (uc)
- udp_connection_free (uc);
+ udp_connection_cleanup (uc);
}
u8 *