wgengine/magicsock: add DERP homeless debug mode for testing

In DERP homeless mode, a DERP home connection is not sought or
maintained and the local node is not reachable.

Updates #3363
Updates tailscale/corp#396

Change-Id: Ibc30488ac2e3cfe4810733b96c2c9f10a51b8331
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-11-15 15:10:45 -08:00
committed by Brad Fitzpatrick
parent 2ff54f9d12
commit 3bd382f369
6 changed files with 53 additions and 15 deletions

View File

@@ -144,6 +144,10 @@ func (c *Conn) setNearestDERP(derpNum int) (wantDERP bool) {
health.SetMagicSockDERPHome(0)
return false
}
if c.homeless {
c.myDerp = 0
return false
}
if derpNum == c.myDerp {
// No change.
return true