aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/udp/udp.c
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2019-05-13 16:25:50 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-05-14 02:02:43 +0000
commit161638f14b967c9b11dee130c596f008c9e857c3 (patch)
tree9c969b7c2ed1b1646c8f986096fa6f20f7fc75a9 /src/vnet/udp/udp.c
parent07c0a9d0687a8f38b2863ada33836caf05399bac (diff)
Unregister UDPC port only when owned
Needed in QUIC, when cleaning up accepted UDP sessions Change-Id: Ifcb32687175562bed4ca69bdc519cedd4dc3c2bc Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vnet/udp/udp.c')
-rw-r--r--src/vnet/udp/udp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 4178a49c4db..d5166d9142e 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -95,6 +95,7 @@ udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
listener->c_proto = TRANSPORT_PROTO_UDP;
listener->c_s_index = session_index;
listener->c_fib_index = lcl->fib_index;
+ listener->owns_port = 1;
clib_spinlock_init (&listener->rx_lock);
node_index = lcl->is_ip4 ? udp4_input_node.index : udp6_input_node.index;
@@ -168,8 +169,9 @@ udp_session_close (u32 connection_index, u32 thread_index)
uc = udp_connection_get (connection_index, thread_index);
if (uc)
{
- udp_unregister_dst_port (vm, clib_net_to_host_u16 (uc->c_lcl_port),
- uc->c_is_ip4);
+ if (uc->owns_port || !uc->is_connected)
+ udp_unregister_dst_port (vm, clib_net_to_host_u16 (uc->c_lcl_port),
+ uc->c_is_ip4);
session_transport_delete_notify (&uc->connection);
udp_connection_free (uc);
}
@@ -302,6 +304,7 @@ udp_open_connection (transport_endpoint_cfg_t * rmt)
uc->c_is_ip4 = rmt->is_ip4;
uc->c_proto = TRANSPORT_PROTO_UDP;
uc->c_fib_index = rmt->fib_index;
+ uc->owns_port = 1;
return uc->c_c_index;
}