diff options
author | Florin Coras <fcoras@cisco.com> | 2023-03-13 16:31:52 -0700 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2023-03-14 16:09:50 +0000 |
commit | 02aa2ca0934dbbed7440bd8225f39dde95610206 (patch) | |
tree | 120ead93929dceae6387c619894ea55569d5dc48 /src/vnet/session | |
parent | 1552228350bb73db281aee43d90bcb068189d5ba (diff) |
session: cleanup lcl endpt freelist before all alloc
Make sure endpoint freelist is drained before alloc of fixed local
source port is tried.
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I302deee5609a463af8135185af71722ac8c55a27
Diffstat (limited to 'src/vnet/session')
-rw-r--r-- | src/vnet/session/transport.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c index 0020d743d9b..8b3dacfe309 100644 --- a/src/vnet/session/transport.c +++ b/src/vnet/session/transport.c @@ -578,10 +578,6 @@ transport_alloc_local_port (u8 proto, ip46_address_t *lcl_addr, /* Only support active opens from one of ctrl threads */ ASSERT (vlib_get_thread_index () <= transport_cl_thread ()); - /* Cleanup freelist if need be */ - if (vec_len (tm->lcl_endpts_freelist)) - transport_cleanup_freelist (); - /* Search for first free slot */ for (tries = 0; tries < limit; tries++) { @@ -669,6 +665,7 @@ transport_alloc_local_endpoint (u8 proto, transport_endpoint_cfg_t * rmt_cfg, ip46_address_t * lcl_addr, u16 * lcl_port) { transport_endpoint_t *rmt = (transport_endpoint_t *) rmt_cfg; + transport_main_t *tm = &tp_main; session_error_t error; int port; @@ -689,6 +686,10 @@ transport_alloc_local_endpoint (u8 proto, transport_endpoint_cfg_t * rmt_cfg, sizeof (rmt_cfg->peer.ip)); } + /* Cleanup freelist if need be */ + if (vec_len (tm->lcl_endpts_freelist)) + transport_cleanup_freelist (); + /* * Allocate source port */ |