Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions pkg/mesh/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,35 @@ func (t *Topology) Routes(kiloIfaceName string, kiloIface, privIface, tunlIface
}
}
}
// When not managing local routes, the leader still needs to
// route return WireGuard traffic through IPIP when non-leaders
// use overlay routing (e.g. Cilium) to reach the leader.
// Use the overlay gateway (e.g. Cilium internal IP) so the
// IPIP outer packet is routed through the overlay tunnel,
// since direct IPIP may be blocked by the cloud network.
if !local && t.privateIP != nil && enc.Strategy() != encapsulation.Never {
for i := range segment.cidrs {
if segment.privateIPs[i].Equal(t.privateIP.IP) {
continue
}
nodeGw := enc.Gw(nil, segment.privateIPs[i], segment.ciliumInternalIPs[i], segment.cidrs[i])
if nodeGw != nil && !nodeGw.Equal(segment.privateIPs[i]) {
routes = append(routes, &netlink.Route{
Dst: oneAddressCIDR(segment.privateIPs[i]),
Flags: int(netlink.FLAG_ONLINK),
Gw: nodeGw,
LinkIndex: tunlIface,
Protocol: unix.RTPROT_STATIC,
Table: kiloTableIndex,
})
rules = append(rules, defaultRule(&netlink.Rule{
Dst: oneAddressCIDR(segment.privateIPs[i]),
Table: kiloTableIndex,
IifName: kiloIfaceName,
}))
}
}
}
// Continuing here prevents leaders form adding routes via WireGuard to
// nodes in their own location.
continue
Expand Down