Selaa lähdekoodia

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.
Lucas Servén Marín 7 vuotta sitten
vanhempi
sitoutus
8ed1b549d1
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  1. 7 0
      pkg/mesh/topology.go

+ 7 - 0
pkg/mesh/topology.go

@@ -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.