pkg/mesh: edge case external = internal

Add an exception to the route generation rules for when the external IP
of a node equals the internal IP. In this case, we cannot route traffic
through a tunnel.
This commit is contained in:
Lucas Servén Marín 2019-05-13 17:25:52 +02:00
parent 459262326e
commit 8ed1b549d1
No known key found for this signature in database
GPG Key ID: 586FEAF680DA74AD
1 changed files with 7 additions and 0 deletions

View File

@ -274,6 +274,13 @@ func (t *Topology) Routes(kiloIface, privIface, tunlIface int, local bool, encap
LinkIndex: kiloIface,
Protocol: unix.RTPROT_STATIC,
})
// Don't add routes through Kilo if the private IP
// equals the external IP. This means that the node
// is only accessible through an external IP and we
// cannot encapsulate traffic to an IP through the IP.
if segment.privateIPs[i].Equal(segment.endpoint) {
continue
}
// Add routes to the private IPs of nodes in other segments.
// Number of CIDRs and private IPs always match so
// we can reuse the loop.