port offsets for peer mismatch

(cherry picked from commit 405a78f415)
This commit is contained in:
JackDoan authored and Wade Simmons committed 2026-09-02 11:26:36 -04:00
1 parent 0ae7ba073c
commit 2c9f47c252
4 files changed
+111 -6

No files matched your search

+6 -2
View File
@@ -746,7 +746,11 @@ func (hm *HandshakeManager) maybeAllocLaneState(hostinfo *HostInfo, result *hand
// A certified-but-hostile peer doesn't get to size our state.
peerPorts = 256
}
hostinfo.lanes = newLaneState(hm.f.routines, uint16(peerPorts), uint16(result.PeerBasePort))
var offset uint16
if len(hm.f.myVpnAddrs) > 0 && len(hostinfo.vpnAddrs) > 0 {
offset = lanePortOffset(hm.f.myVpnAddrs[0], hostinfo.vpnAddrs[0], uint16(peerPorts))
}
hostinfo.lanes = newLaneState(hm.f.routines, uint16(peerPorts), uint16(result.PeerBasePort), offset)
}
// EnsureLanes starts lane handshakes for every empty, non-pending, retry-due
@@ -791,7 +795,7 @@ func (hm *HandshakeManager) startLaneHandshake(base *HostInfo, i int) {
ls.noteLaneFailure(i)
return
}
target := netip.AddrPortFrom(remote.Addr(), ls.peerBasePort+uint16(i%int(ls.peerPortCount)))
target := netip.AddrPortFrom(remote.Addr(), ls.laneTargetPort(i))
hostinfo := &HostInfo{
vpnAddrs: slices.Clone(base.vpnAddrs),