mirror of
https://github.com/gravitl/netmaker.git
synced 2025-02-25 16:44:01 +08:00
fixing egress omission in peers:
This commit is contained in:
parent
c826b782ed
commit
dad6097202
1 changed files with 7 additions and 3 deletions
|
@ -214,11 +214,15 @@ func GetPeers(macaddress string, network string, server string, dualstack bool,
|
||||||
ncutils.PrintLog("could not parse gateway IP range. Not adding "+iprange, 1)
|
ncutils.PrintLog("could not parse gateway IP range. Not adding "+iprange, 1)
|
||||||
continue // if can't parse CIDR
|
continue // if can't parse CIDR
|
||||||
}
|
}
|
||||||
nodeEndpointArr := strings.Split(nodecfg.Endpoint, ":") // getting the public ip of node
|
nodeEndpointArr := strings.Split(node.Endpoint, ":") // getting the public ip of node
|
||||||
if ipnet.Contains(net.IP(nodeEndpointArr[0])) { // ensuring egress gateway range does not contain public ip of node
|
if ipnet.Contains(net.ParseIP(nodeEndpointArr[0])) { // ensuring egress gateway range does not contain public ip of node
|
||||||
ncutils.PrintLog("egress IP range of "+iprange+" overlaps with "+nodecfg.Endpoint+", omitting", 1)
|
ncutils.PrintLog("egress IP range of "+iprange+" overlaps with "+node.Endpoint+", omitting", 2)
|
||||||
continue // skip adding egress range if overlaps with node's ip
|
continue // skip adding egress range if overlaps with node's ip
|
||||||
}
|
}
|
||||||
|
if ipnet.Contains(net.ParseIP(nodecfg.LocalAddress)) { // ensuring egress gateway range does not contain public ip of node
|
||||||
|
ncutils.PrintLog("egress IP range of "+iprange+" overlaps with "+nodecfg.LocalAddress+", omitting", 2)
|
||||||
|
continue // skip adding egress range if overlaps with node's local ip
|
||||||
|
}
|
||||||
gateways = append(gateways, iprange)
|
gateways = append(gateways, iprange)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("ERROR ENCOUNTERED SETTING GATEWAY")
|
log.Println("ERROR ENCOUNTERED SETTING GATEWAY")
|
||||||
|
|
Loading…
Reference in a new issue