Browse Source

Merge pull request #902 from gravitl/develop

Develop
Alex Feiszli 3 years ago
parent
commit
6ba5df1288
3 changed files with 5 additions and 1 deletions
  1. 3 0
      netclient/functions/mqhandlers.go
  2. BIN
      netclient/netclient.syso
  3. 2 1
      netclient/wireguard/common.go

+ 3 - 0
netclient/functions/mqhandlers.go

@@ -109,6 +109,9 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) {
 	}
 	if ifaceDelta { // if a change caused an ifacedelta we need to notify the server to update the peers
 		ncutils.Log("applying WG conf to " + file)
+		if ncutils.IsWindows() {
+			wireguard.RemoveConfGraceful(nodeCfg.Node.Interface)
+		}
 		err = wireguard.ApplyConf(&nodeCfg.Node, nodeCfg.Node.Interface, file)
 		if err != nil {
 			ncutils.Log("error restarting wg after node update " + err.Error())

BIN
netclient/netclient.syso


+ 2 - 1
netclient/wireguard/common.go

@@ -192,6 +192,7 @@ func InitWireguard(node *models.Node, privkey string, peers []wgtypes.PeerConfig
 	} else {
 		_, devErr := wgclient.Device(deviceiface)
 		if !ifaceReady || devErr != nil {
+			fmt.Printf("%v\n", devErr)
 			return fmt.Errorf("could not reliably create interface, please check wg installation and retry")
 		}
 	}
@@ -287,7 +288,6 @@ func ApplyConf(node *models.Node, ifacename string, confPath string) error {
 	var err error
 	switch os {
 	case "windows":
-		RemoveConfGraceful(ifacename)
 		ApplyWindowsConf(confPath)
 	case "darwin":
 		ApplyMacOSConf(node, ifacename, confPath)
@@ -490,4 +490,5 @@ func RemoveConfGraceful(ifacename string) {
 			break
 		}
 	}
+	time.Sleep(time.Second << 1)
 }