소스 검색

Merge pull request #285 from squat/fix_routes_for_nat_nodes

pkg/mesh: fix routes for NATed nodes
Lucas Servén Marín 4 년 전
부모
커밋
ed1e9ea400
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      pkg/mesh/routes.go

+ 2 - 2
pkg/mesh/routes.go

@@ -40,7 +40,7 @@ func (t *Topology) Routes(kiloIfaceName string, kiloIface, privIface, tunlIface
 		var gw net.IP
 		var gw net.IP
 		for _, segment := range t.segments {
 		for _, segment := range t.segments {
 			if segment.location == t.location {
 			if segment.location == t.location {
-				gw = enc.Gw(segment.endpoint.IP(), segment.privateIPs[segment.leader], segment.cidrs[segment.leader])
+				gw = enc.Gw(t.updateEndpoint(segment.endpoint, segment.key, &segment.persistentKeepalive).IP(), segment.privateIPs[segment.leader], segment.cidrs[segment.leader])
 				break
 				break
 			}
 			}
 		}
 		}
@@ -196,7 +196,7 @@ func (t *Topology) Routes(kiloIfaceName string, kiloIface, privIface, tunlIface
 			// equals the external IP. This means that the node
 			// equals the external IP. This means that the node
 			// is only accessible through an external IP and we
 			// is only accessible through an external IP and we
 			// cannot encapsulate traffic to an IP through the IP.
 			// cannot encapsulate traffic to an IP through the IP.
-			if segment.privateIPs == nil || segment.privateIPs[i].Equal(segment.endpoint.IP()) {
+			if segment.privateIPs == nil || segment.privateIPs[i].Equal(t.updateEndpoint(segment.endpoint, segment.key, &segment.persistentKeepalive).IP()) {
 				continue
 				continue
 			}
 			}
 			// Add routes to the private IPs of nodes in other segments.
 			// Add routes to the private IPs of nodes in other segments.