mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-09 02:53:09 -05:00
The PreferredDERP selection loop only considers RegionLatency, which STUN probes populate for STUN-only regions too. When such a region is the only one with a latency sample (e.g. self-hosted DERP behind a TCP-only tunnel while a public STUN server is reachable), it gets selected as the preferred DERP and all relay traffic blackholes, since the region has no DERP server to relay through. Filter STUN-only regions in the selection loop by reusing the existing regionHasDERPNode predicate (renamed to CanServeDERP), which was already applied to the HTTPS/ICMP fallback probing but not here. Regions missing from the map, or present without any nodes, keep the old behavior, as some tests use latency-only DERP maps. Fixes #21975 Signed-off-by: Luo Chen <luochen1990@gmail.com>