diff --git a/netclient/server/grpc.go b/netclient/server/grpc.go index 9aeea6a2..ade846fc 100644 --- a/netclient/server/grpc.go +++ b/netclient/server/grpc.go @@ -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) continue // if can't parse CIDR } - nodeEndpointArr := strings.Split(nodecfg.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 - ncutils.PrintLog("egress IP range of "+iprange+" overlaps with "+nodecfg.Endpoint+", omitting", 1) + nodeEndpointArr := strings.Split(node.Endpoint, ":") // getting the 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 "+node.Endpoint+", omitting", 2) 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) if err != nil { log.Println("ERROR ENCOUNTERED SETTING GATEWAY")