minor logic revisions

This commit is contained in:
afeiszli
2022-04-24 13:47:23 -04:00
parent 91ca96534b
commit 9a66674a5c
3 changed files with 11 additions and 18 deletions

View File

@@ -209,11 +209,9 @@ func GetPeerUpdate(node *models.Node) (models.PeerUpdate, error) {
// set_local // set_local
if node.LocalAddress != peer.LocalAddress && peer.LocalAddress != "" { if node.LocalAddress != peer.LocalAddress && peer.LocalAddress != "" {
peer.Endpoint = peer.LocalAddress peer.Endpoint = peer.LocalAddress
} else { if peer.LocalListenPort != 0 {
continue peer.ListenPort = peer.LocalListenPort
} }
if peer.LocalListenPort != 0 {
peer.ListenPort = peer.LocalListenPort
} else { } else {
continue continue
} }

View File

@@ -225,18 +225,13 @@ func GetServerPeers(serverNode *models.Node) ([]wgtypes.PeerConfig, bool, []stri
if serverNode.PublicKey == node.PublicKey { if serverNode.PublicKey == node.PublicKey {
continue continue
} }
/* if serverNode.Endpoint == node.Endpoint {
// Test This: Removed logic to set local address for nodes on same network as server if serverNode.LocalAddress != node.LocalAddress && node.LocalAddress != "" {
// This may be causing issues setting nodes on server currently node.Endpoint = node.LocalAddress
// Removing may fix but could cause other issues } else {
if serverNode.Endpoint == node.Endpoint { continue
if serverNode.LocalAddress != node.LocalAddress && node.LocalAddress != "" { }
node.Endpoint = node.LocalAddress }
} else {
continue
}
}
*/
if currentNetworkACL != nil && currentNetworkACL.IsAllowed(acls.AclID(serverNode.ID), acls.AclID(node.ID)) { if currentNetworkACL != nil && currentNetworkACL.IsAllowed(acls.AclID(serverNode.ID), acls.AclID(node.ID)) {
continue continue
} }

View File

@@ -11,7 +11,7 @@ import (
"github.com/gravitl/netmaker/netclient/ncutils" "github.com/gravitl/netmaker/netclient/ncutils"
) )
// Get LocalListenPort - Gets the port running on the local interface // GetLocalListenPort - Gets the port running on the local interface
func GetLocalListenPort(ifacename string) (int32, error) { func GetLocalListenPort(ifacename string) (int32, error) {
portstring, err := ncutils.RunCmd("wg show "+ifacename+" listen-port", false) portstring, err := ncutils.RunCmd("wg show "+ifacename+" listen-port", false)
if err != nil { if err != nil {