wgengine/magicsock: always set home DERP if no control conn

The logic we added in #11378 would prevent selecting a home DERP if we
have no control connection.

Updates tailscale/corp#18095

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I44bb6ac4393989444e4961b8cfa27dc149a33c6e
This commit is contained in:
Andrew Dunham
2024-06-25 22:23:19 -04:00
parent a475c435ec
commit 8161024176
2 changed files with 28 additions and 2 deletions
+15
View File
@@ -1276,6 +1276,7 @@ func newTestConn(t testing.TB) *Conn {
conn, err := NewConn(Options{
NetMon: netMon,
HealthTracker: new(health.Tracker),
DisablePortMapper: true,
Logf: t.Logf,
Port: port,
@@ -3128,6 +3129,20 @@ func TestMaybeSetNearestDERP(t *testing.T) {
connectedToControl: false,
want: 1, // no change
},
{
name: "not_connected_with_report_derp_and_no_current",
old: 0, // no current DERP
reportDERP: 21, // have new DERP
connectedToControl: false, // not connected...
want: 21, // ... but want to change to new DERP
},
{
name: "not_connected_with_fallback_and_no_current",
old: 0, // no current DERP
reportDERP: 0, // no new DERP
connectedToControl: false, // not connected...
want: 31, // ... but we fallback to deterministic value
},
{
name: "connected_no_derp",
old: 1,