summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-06-04 11:17:40 +0200
committerBeno�t Ganne <bganne@cisco.com>2021-06-09 12:16:54 +0000
commit8afa5d3ccd06df80212ce2ea23b6482287d9481b (patch)
treea0a08289d6a89258f68f51e1206d17ad8b4096e5 /src/plugins
parente9d7b0982d7bd189097260b6581abff472da251a (diff)
cnat: fix spinlock
Type: fix Change-Id: Id6406702061ada54e51ebcf5c367328605de2b6b Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/cnat/cnat_src_policy.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/cnat/cnat_src_policy.c b/src/plugins/cnat/cnat_src_policy.c
index e11e912ab15..cac24b7742c 100644
--- a/src/plugins/cnat/cnat_src_policy.c
+++ b/src/plugins/cnat/cnat_src_policy.c
@@ -122,7 +122,10 @@ cnat_allocate_port (u16 * port, ip_protocol_t iproto)
if (PREDICT_FALSE (*port >= UINT16_MAX))
*port = clib_bitmap_next_clear (ca->bmap, MIN_SRC_PORT);
if (PREDICT_FALSE (*port >= UINT16_MAX))
- return -1;
+ {
+ clib_spinlock_unlock (&ca->lock);
+ return -1;
+ }
}
clib_bitmap_set_no_check (ca->bmap, *port, 1);
*port = clib_host_to_net_u16 (*port);