wireguard: add barrier to sync data 52/38352/2
authorGabriel Oginski <gabrielx.oginski@intel.com>
Tue, 21 Feb 2023 08:42:06 +0000 (08:42 +0000)
committerFan Zhang <fanzhang.oss@gmail.com>
Thu, 2 Mar 2023 13:21:52 +0000 (13:21 +0000)
commit9ad423fceb8d9877b337ada5fc1e053de21323b2
treeed506032af861e9724fe5bb8dab50a234285cba8
parent04853c67e4f06b8b33005b7c2ccaca5a2d015760
wireguard: add barrier to sync data

The current implmentation of the hash table is not thread-safe.
This design leads to a segfault when VPP is handling a lot of tunnels
for Wireguard, where one thread modifies the hash table and other
threads start the lookup at the same time.

This fix adds a barrier sync to the hash table access when Wireguard
adds or deletes an element.

Type: fix
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: Id460dfcd46ace17c7bdcd23bd9687d26cecf0a39
src/plugins/wireguard/wireguard_if.c
src/plugins/wireguard/wireguard_index_table.c
src/plugins/wireguard/wireguard_index_table.h
src/plugins/wireguard/wireguard_noise.c
src/plugins/wireguard/wireguard_noise.h
src/plugins/wireguard/wireguard_peer.c