diff --git a/functions/daemon.go b/functions/daemon.go index 29aab710..bc086a6a 100644 --- a/functions/daemon.go +++ b/functions/daemon.go @@ -215,7 +215,7 @@ func startGoRoutines(wg *sync.WaitGroup) context.CancelFunc { } } slog.Info("configuring netmaker wireguard interface") - pullresp, _, _, pullErr := Pull(true) + pullresp, _, _, pullErr := Pull(false) if pullErr != nil { slog.Error("fail to pull config from server", "error", pullErr.Error()) } diff --git a/wireguard/wireguard.go b/wireguard/wireguard.go index 110b0a7a..3b371661 100644 --- a/wireguard/wireguard.go +++ b/wireguard/wireguard.go @@ -41,7 +41,8 @@ func ShouldReplace(incomingPeers []wgtypes.PeerConfig) bool { // SetPeers - sets peers on netmaker WireGuard interface func SetPeers(replace bool) error { - + wgMutex.Lock() + defer wgMutex.Unlock() peers := config.Netclient().HostPeers for i := range peers { peer := peers[i] @@ -70,6 +71,8 @@ func SetPeers(replace bool) error { // temporarily making public func to pass staticchecks // this function will be required in future when update node on server is refactored func UpdatePeer(p *wgtypes.PeerConfig) error { + wgMutex.Lock() + defer wgMutex.Unlock() config := wgtypes.Config{ Peers: []wgtypes.PeerConfig{*p}, ReplacePeers: false,