summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2023-09-12 20:29:26 -0700
committerBrad Fitzpatrick <brad@danga.com>2023-09-12 21:16:56 -0700
commit3c276d7de20a90f15d98da4e9d2cdb12a01ee8f4 (patch)
treea2b5d51ef27c98c1b1560f4bb2cb346bf29443bf
parent67396d716b2120f747abe84b77500c0a738d4c89 (diff)
downloadtailscale-3c276d7de20a90f15d98da4e9d2cdb12a01ee8f4.tar.xz
tailscale-3c276d7de20a90f15d98da4e9d2cdb12a01ee8f4.zip
wgengine: remove SetDERPMap method from Engine interface
(continuing the mission of removing rando methods from the Engine interface that we don't need anymore) Updates #cleanup Change-Id: Id5190917596bf04d7185c3b331a852724a3f5a16 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
-rw-r--r--ipn/ipnlocal/local.go4
-rw-r--r--ipn/ipnlocal/peerapi.go6
-rw-r--r--wgengine/bench/wg.go25
-rw-r--r--wgengine/userspace.go4
-rw-r--r--wgengine/watchdog.go3
-rw-r--r--wgengine/wgengine.go5
6 files changed, 18 insertions, 29 deletions
diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go
index cc27447e7..b975b0730 100644
--- a/ipn/ipnlocal/local.go
+++ b/ipn/ipnlocal/local.go
@@ -1098,7 +1098,7 @@ func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st control
}
b.e.SetNetworkMap(st.NetMap)
- b.e.SetDERPMap(st.NetMap.DERPMap)
+ b.magicConn().SetDERPMap(st.NetMap.DERPMap)
// Update our cached DERP map
dnsfallback.UpdateCache(st.NetMap.DERPMap, b.logf)
@@ -2896,7 +2896,7 @@ func (b *LocalBackend) setPrefsLockedOnEntry(caller string, newp *ipn.Prefs) ipn
}
if netMap != nil {
- b.e.SetDERPMap(netMap.DERPMap)
+ b.magicConn().SetDERPMap(netMap.DERPMap)
}
if !oldp.WantRunning() && newp.WantRunning {
diff --git a/ipn/ipnlocal/peerapi.go b/ipn/ipnlocal/peerapi.go
index 00055c8a8..e892c9252 100644
--- a/ipn/ipnlocal/peerapi.go
+++ b/ipn/ipnlocal/peerapi.go
@@ -1234,11 +1234,7 @@ func (h *peerAPIHandler) handleServeMagicsock(w http.ResponseWriter, r *http.Req
http.Error(w, "denied; no debug access", http.StatusForbidden)
return
}
- if mc, ok := h.ps.b.sys.MagicSock.GetOK(); ok {
- mc.ServeHTTPDebug(w, r)
- return
- }
- http.Error(w, "miswired", 500)
+ h.ps.b.magicConn().ServeHTTPDebug(w, r)
}
func (h *peerAPIHandler) handleServeMetrics(w http.ResponseWriter, r *http.Request) {
diff --git a/wgengine/bench/wg.go b/wgengine/bench/wg.go
index 7231267d8..b0a4e7886 100644
--- a/wgengine/bench/wg.go
+++ b/wgengine/bench/wg.go
@@ -16,6 +16,7 @@ import (
"tailscale.com/net/dns"
"tailscale.com/tailcfg"
+ "tailscale.com/tsd"
"tailscale.com/types/key"
"tailscale.com/types/logger"
"tailscale.com/types/netmap"
@@ -38,11 +39,13 @@ func setupWGTest(b *testing.B, logf logger.Logf, traf *TrafficGen, a1, a2 netip.
logf: logger.WithPrefix(logf, "tun1: "),
traf: traf,
}
+ s1 := new(tsd.System)
e1, err := wgengine.NewUserspaceEngine(l1, wgengine.Config{
- Router: router.NewFake(l1),
- NetMon: nil,
- ListenPort: 0,
- Tun: t1,
+ Router: router.NewFake(l1),
+ NetMon: nil,
+ ListenPort: 0,
+ Tun: t1,
+ SetSubsystem: s1.Set,
})
if err != nil {
log.Fatalf("e1 init: %v", err)
@@ -62,11 +65,13 @@ func setupWGTest(b *testing.B, logf logger.Logf, traf *TrafficGen, a1, a2 netip.
logf: logger.WithPrefix(logf, "tun2: "),
traf: traf,
}
+ s2 := new(tsd.System)
e2, err := wgengine.NewUserspaceEngine(l2, wgengine.Config{
- Router: router.NewFake(l2),
- NetMon: nil,
- ListenPort: 0,
- Tun: t2,
+ Router: router.NewFake(l2),
+ NetMon: nil,
+ ListenPort: 0,
+ Tun: t2,
+ SetSubsystem: s2.Set,
})
if err != nil {
log.Fatalf("e2 init: %v", err)
@@ -156,8 +161,8 @@ func setupWGTest(b *testing.B, logf logger.Logf, traf *TrafficGen, a1, a2 netip.
})
// Not using DERP in this test (for now?).
- e1.SetDERPMap(&tailcfg.DERPMap{})
- e2.SetDERPMap(&tailcfg.DERPMap{})
+ s1.MagicSock.Get().SetDERPMap(&tailcfg.DERPMap{})
+ s2.MagicSock.Get().SetDERPMap(&tailcfg.DERPMap{})
wait.Wait()
}
diff --git a/wgengine/userspace.go b/wgengine/userspace.go
index ea40d01fa..5385146a6 100644
--- a/wgengine/userspace.go
+++ b/wgengine/userspace.go
@@ -1150,10 +1150,6 @@ func (e *userspaceEngine) linkChange(delta *netmon.ChangeDelta) {
e.magicConn.ReSTUN(why)
}
-func (e *userspaceEngine) SetDERPMap(dm *tailcfg.DERPMap) {
- e.magicConn.SetDERPMap(dm)
-}
-
func (e *userspaceEngine) SetNetworkMap(nm *netmap.NetworkMap) {
e.magicConn.SetNetworkMap(nm)
e.mu.Lock()
diff --git a/wgengine/watchdog.go b/wgengine/watchdog.go
index a5e1e8917..968751e66 100644
--- a/wgengine/watchdog.go
+++ b/wgengine/watchdog.go
@@ -137,9 +137,6 @@ func (e *watchdogEngine) UpdateStatus(sb *ipnstate.StatusBuilder) {
func (e *watchdogEngine) RequestStatus() {
e.watchdog("RequestStatus", func() { e.wrap.RequestStatus() })
}
-func (e *watchdogEngine) SetDERPMap(m *tailcfg.DERPMap) {
- e.watchdog("SetDERPMap", func() { e.wrap.SetDERPMap(m) })
-}
func (e *watchdogEngine) SetNetworkMap(nm *netmap.NetworkMap) {
e.watchdog("SetNetworkMap", func() { e.wrap.SetNetworkMap(nm) })
}
diff --git a/wgengine/wgengine.go b/wgengine/wgengine.go
index 68956729c..7f3d249b3 100644
--- a/wgengine/wgengine.go
+++ b/wgengine/wgengine.go
@@ -95,11 +95,6 @@ type Engine interface {
// TODO: return an error?
Wait()
- // SetDERPMap controls which (if any) DERP servers are used.
- // If nil, DERP is disabled. It starts disabled until a DERP map
- // is configured.
- SetDERPMap(*tailcfg.DERPMap)
-
// SetNetworkMap informs the engine of the latest network map
// from the server. The network map's DERPMap field should be
// ignored as as it might be disabled; get it from SetDERPMap