From: Florin Coras Date: Thu, 25 May 2023 19:04:53 +0000 (-0700) Subject: udp: fix local port reuse check X-Git-Tag: v24.02-rc0~210 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F38906%2F2;p=vpp.git udp: fix local port reuse check Type: fix Signed-off-by: Florin Coras Change-Id: I323946f7838507110c663f5a904399a74fc76691 --- diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c index 7147fa32657..493275006f7 100644 --- a/src/vnet/udp/udp.c +++ b/src/vnet/udp/udp.c @@ -364,7 +364,8 @@ udp_open_connection (transport_endpoint_cfg_t * rmt) if (rv) return rv; - if (udp_is_valid_dst_port (lcl_port, rmt->is_ip4)) + if (udp_connection_port_used_extern (clib_net_to_host_u16 (lcl_port), + rmt->is_ip4)) { /* If specific source port was requested abort */ if (rmt->peer.port) @@ -375,7 +376,8 @@ udp_open_connection (transport_endpoint_cfg_t * rmt) } /* Try to find a port that's not used */ - while (udp_is_valid_dst_port (lcl_port, rmt->is_ip4)) + while (udp_connection_port_used_extern (clib_net_to_host_u16 (lcl_port), + rmt->is_ip4)) { transport_release_local_endpoint (TRANSPORT_PROTO_UDP, &lcl_addr, lcl_port); diff --git a/test/asf/test_vcl.py b/test/asf/test_vcl.py index 9853529da56..59c077ee4f7 100644 --- a/test/asf/test_vcl.py +++ b/test/asf/test_vcl.py @@ -996,6 +996,7 @@ class LDPThruHostStackIperfUdp(VCLTestCase): "-t 2", "-u", "-l 1400", + "-P 2", "-c", self.loop0.local_ip4, ]