[client] Fix lazy-conn exclusion for ingress forward peers

peerRoutesAddr compared AllowedIPs (CIDR, e.g. a peer's overlay IP as /32)
against the unmasked TranslatedAddress string, so the match never fired and
forward-target peers were never excluded from lazy connections. Use prefix
containment so a routed address matches the peer's AllowedIP.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
riccardom
2026-07-06 11:03:17 +02:00
parent 460967d218
commit 22434897b6

View File

@@ -2580,7 +2580,11 @@ func (e *Engine) toExcludedLazyPeers(rules []firewallManager.ForwardRule, peers
// peerRoutesAddr verifies if the peer is a router for a given address.
func peerRoutesAddr(p *mgmProto.RemotePeerConfig, addr netip.Addr) bool {
for _, allowedIP := range p.GetAllowedIps() {
if allowedIP == addr.String() {
prefix, err := netip.ParsePrefix(allowedIP)
if err != nil {
continue
}
if prefix.Contains(addr) {
return true
}
}