From 583d4c94dc69f624a44a8dfa5c82165f3ca27271 Mon Sep 17 00:00:00 2001 From: Gabriel Oginski Date: Thu, 6 Oct 2022 06:58:45 +0000 Subject: 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 Change-Id: I13b4b2d47021753926d42a38ccadb36a411c5b79 --- src/plugins/wireguard/wireguard_peer.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins/wireguard/wireguard_peer.h') diff --git a/src/plugins/wireguard/wireguard_peer.h b/src/plugins/wireguard/wireguard_peer.h index 85df0727902..613c2640ad1 100644 --- a/src/plugins/wireguard/wireguard_peer.h +++ b/src/plugins/wireguard/wireguard_peer.h @@ -115,6 +115,9 @@ typedef struct wg_peer u32 rehandshake_interval_tick; bool timer_need_another_keepalive; + + /* Handshake is sent to main thread? */ + bool handshake_is_sent; } wg_peer_t; typedef struct wg_peer_table_bind_ctx_t_ -- cgit 1.2.3-korg