summaryrefslogtreecommitdiffhomepage
path: root/ipn/ipnlocal/node_backend.go
diff options
context:
space:
mode:
authorClaus Lensbøl <claus@tailscale.com>2026-04-17 12:35:56 +0200
committerClaus Lensbøl <claus@tailscale.com>2026-04-24 13:05:15 +0200
commitb6bda5b9157dcd215bf311a6c0162fde82e056d6 (patch)
treed629cdd14c0e03543bf6e38eee1af50240e161e3 /ipn/ipnlocal/node_backend.go
parent1dc08f4d41000f9ea08eb754aa35d91bbad62802 (diff)
downloadtailscale-cmol/load_home_derp_from_cache.tar.xz
tailscale-cmol/load_home_derp_from_cache.zip
wgengine/magicsock,ipn/ipnlocal: store and load homeDERP from cachecmol/load_home_derp_from_cache
With netmap caching, the home DERP of the self node was neither saved to the cache or loaded from it, making nodes not stick to a DERP when starting without a connection to control. Instead, make sure that when a cache is available, load that cache, before looking for DERP servers. This is implemented by allowing a skip of ReSTUN in setting the DERP map (we must have a DERP map before setting the home DERP), so the DERP from cache will set itself and be sticky until a connection to control is established. Making DERP only change when connected to control is handled by existing code from f072d017bd8241675aa946a27fc1827f570435cb. Updates #19490 Signed-off-by: Claus Lensbøl <claus@tailscale.com>
Diffstat (limited to 'ipn/ipnlocal/node_backend.go')
-rw-r--r--ipn/ipnlocal/node_backend.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/ipn/ipnlocal/node_backend.go b/ipn/ipnlocal/node_backend.go
index 6c5db0e0d..48b5dfa3b 100644
--- a/ipn/ipnlocal/node_backend.go
+++ b/ipn/ipnlocal/node_backend.go
@@ -79,6 +79,13 @@ type nodeBackend struct {
eventClient *eventbus.Client
derpMapViewPub *eventbus.Publisher[tailcfg.DERPMapView]
+ // homeDERP lives here temporarily. as long as mapSession is short lived, we
+ // don't have a location delivering netmaps to local backend that knows our
+ // homeDERP hence why it is cached here for now.
+ // TODO(cmol): move this field into a refactorred mapSession that is not
+ // short lived.
+ homeDERP atomic.Int64
+
// TODO(nickkhyl): maybe use sync.RWMutex?
mu syncs.Mutex // protects the following fields