From 52d8d1304752c8d1e9602021901b3d9d795bd9e1 Mon Sep 17 00:00:00 2001 From: leonnicolas Date: Sat, 20 Feb 2021 01:38:26 +0100 Subject: [PATCH] pkg/mesh/mesh.go: iptables rules in encapsulation Because of new naming conventions for locations, the CIDRs were not being set within locations. This lead to no iptables rules added for nodes in the same location. --- pkg/mesh/mesh.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/mesh/mesh.go b/pkg/mesh/mesh.go index 5ae8f17..b736199 100644 --- a/pkg/mesh/mesh.go +++ b/pkg/mesh/mesh.go @@ -490,7 +490,10 @@ func (m *Mesh) applyTopology() { if m.enc.Strategy() != encapsulation.Never && m.local { var cidrs []*net.IPNet for _, s := range t.segments { - if s.location == nodes[m.hostname].Location { + // If the location prefix is not logicalLocation, but nodeLocation, + // we don't need to set any extra rules for encapsulation anyways + // because traffic will go over WireGuard. + if s.location == logicalLocationPrefix+nodes[m.hostname].Location { for i := range s.privateIPs { cidrs = append(cidrs, oneAddressCIDR(s.privateIPs[i])) }