wgengine/magicsock: never set a DERP server as a roamAddr.

DERP traffic is asymmetric by design, with nodes always sending
to their peer's home DERP server. However, if roamAddr is set,
magicsock will always push data there, rather than let DERP
server selection do its thing, so we end up accidentally
creating a symmetric flow.

Signed-Off-By: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson 2020-03-05 17:38:17 -08:00 committed by Dave Anderson
parent 4f5c0da1ae
commit 2839854994

View File

@ -1098,6 +1098,11 @@ func (a *AddrSet) UpdateDst(new *net.UDPAddr) error {
// Packet from current-priority address, no logging.
// This is a hot path for established connections.
return nil
} else if new.IP.Equal(derpMagicIP) {
// Never pick DERP addresses as a roaming addr. DERP obeys its
// own endpoint selection logic.
// This is a hot path for established connections.
return nil
}
index := -1