mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-04 02:44:29 +08:00
add auto relay only when the relay and relayed nodes are in the same network (#3249)
This commit is contained in:
parent
70ffdef387
commit
94cc85377f
1 changed files with 2 additions and 2 deletions
|
@ -257,7 +257,7 @@ func CheckNetRegAndHostUpdate(networks []string, h *models.Host, relayNodeId uui
|
|||
if relayNodeId != uuid.Nil && !newNode.IsRelayed {
|
||||
// check if relay node exists and acting as relay
|
||||
relaynode, err := logic.GetNodeByID(relayNodeId.String())
|
||||
if err == nil && relaynode.IsRelay {
|
||||
if err == nil && relaynode.IsRelay && relaynode.Network == newNode.Network {
|
||||
slog.Info(fmt.Sprintf("adding relayed node %s to relay %s on network %s", newNode.ID.String(), relayNodeId.String(), network))
|
||||
newNode.IsRelayed = true
|
||||
newNode.RelayedBy = relayNodeId.String()
|
||||
|
@ -271,7 +271,7 @@ func CheckNetRegAndHostUpdate(networks []string, h *models.Host, relayNodeId uui
|
|||
slog.Error("failed to update node", "nodeid", relayNodeId.String())
|
||||
}
|
||||
} else {
|
||||
slog.Error("failed to relay node. maybe specified relay node is actually not a relay?", "err", err)
|
||||
slog.Error("failed to relay node. maybe specified relay node is actually not a relay? Or the relayed node is not in the same network with relay?", "err", err)
|
||||
}
|
||||
}
|
||||
logger.Log(1, "added new node", newNode.ID.String(), "to host", h.Name)
|
||||
|
|
Loading…
Add table
Reference in a new issue