udp: unregister ports on all cleanups 20/40320/2
authorFlorin Coras <fcoras@cisco.com>
Wed, 7 Feb 2024 19:42:02 +0000 (11:42 -0800)
committerDave Wallace <dwallacelf@gmail.com>
Fri, 16 Feb 2024 18:18:56 +0000 (18:18 +0000)
UDP transport port refcount is incremented even if port is shared. So
decrement it, by unregistering, whener udp connections are cleaned up.

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Id0a2c60c5faf4dea8b2cd9ded0334934ad9e918c

src/vnet/udp/udp.c

index a8e0130..e194b9c 100644 (file)
@@ -91,10 +91,9 @@ udp_connection_free (udp_connection_t * uc)
 static void
 udp_connection_cleanup (udp_connection_t * uc)
 {
-  /* Unregister port from udp_local only if refcount went to zero */
-  if (!transport_release_local_endpoint (TRANSPORT_PROTO_UDP, &uc->c_lcl_ip,
-                                        uc->c_lcl_port))
-    udp_connection_unregister_port (uc->c_lcl_port, uc->c_is_ip4);
+  transport_release_local_endpoint (TRANSPORT_PROTO_UDP, &uc->c_lcl_ip,
+                                   uc->c_lcl_port);
+  udp_connection_unregister_port (uc->c_lcl_port, uc->c_is_ip4);
   udp_connection_free (uc);
 }