diff options
author | Gabriel Oginski <gabrielx.oginski@intel.com> | 2022-10-06 06:58:45 +0000 |
---|---|---|
committer | Gabriel Oginski <gabrielx.oginski@intel.com> | 2022-12-01 06:47:07 +0000 |
commit | 583d4c94dc69f624a44a8dfa5c82165f3ca27271 (patch) | |
tree | 47ec5fefeabff30ee53dae04d131a227c7dd7687 /src/plugins/wireguard/wireguard_peer.c | |
parent | 4afdfb4a069558a65269f26061c02a5d24632f6a (diff) |
wireguard: add atomic mutex
The initiate handshake process can be called a numbers times for each
peers, then the main VPP thread called by Wireguard starting to
allocate memory. This behaviour can lead to out of memory when VPP has
a lot of Wireguard tunnels concurrently.
This fix add mutex to send only once handshake initiate at time for
each peers.
Type: fix
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: I13b4b2d47021753926d42a38ccadb36a411c5b79
Diffstat (limited to 'src/plugins/wireguard/wireguard_peer.c')
-rw-r--r-- | src/plugins/wireguard/wireguard_peer.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/plugins/wireguard/wireguard_peer.c b/src/plugins/wireguard/wireguard_peer.c index ef791c669dd..a8f1ab91644 100644 --- a/src/plugins/wireguard/wireguard_peer.c +++ b/src/plugins/wireguard/wireguard_peer.c @@ -83,6 +83,7 @@ wg_peer_clear (vlib_main_t * vm, wg_peer_t * peer) peer->new_handshake_interval_tick = 0; peer->rehandshake_interval_tick = 0; peer->timer_need_another_keepalive = false; + peer->handshake_is_sent = false; vec_free (peer->rewrite); vec_free (peer->allowed_ips); vec_free (peer->adj_indices); |