mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-25 19:21:18 -08:00
The DERPRegion.Avoid flag signals to the client that it should not pick this DERP region as its home region, unless it has no other choice. Although this was respected during an incremental netcheck and also on the initial netcheck, it wasn’t in subsequent full netchecks. In the following example, derp-2 and derp-8 should both be avoided: netcheck: report: udp=true v6=false v6os=false mapvarydest=false portmap= v4a=192.0.2.108:41641 derp=1 derpdist=1v4:23ms,2v4:67ms,8v4:75ms netcheck: report: udp=true v6=false v6os=false mapvarydest= portmap= v4a=192.0.2.108:41641 derp=1 derpdist=1v4:23ms netcheck: report: udp=true v6=false v6os=false mapvarydest=false portmap= v4a=192.0.2.108:41641 derp=2 derpdist=1v4:24ms,2v4:9ms,8v4:75ms magicsock: home DERP changing from derp-1 [23ms] to derp-2 [9ms] magicsock: home is now derp-2 (sfo) netcheck: report: udp=true v6=false v6os=false mapvarydest=false portmap= v4a=192.0.2.108:41641 derp=2 derpdist=1v4:23ms,2v4:8ms This patch rectifies this by first picking a DERP home from non-avoided regions that have latency measurements in the netcheck report. If no such regions exist, the client falls back on the regions for which it does have measurements. Updates #8603 Updates #13969 Updates tailscale/corp#24697 Signed-off-by: Simon Law <[email protected]>