wgengine: replace Engine.SetNetworkMap with SetSelfNode

The engine only used the netmap to look up self addresses and the
self node's primary routes, so pass it the self node directly
rather than the whole netmap.

Updates #12542

Change-Id: I13c0028eed65d2177baf4cf6c449f5e441845a18
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2026-06-24 15:03:55 -07:00
committed by Brad Fitzpatrick
parent 1b2062f3c1
commit 87cb2a8d1e
6 changed files with 46 additions and 70 deletions
+4 -4
View File
@@ -116,7 +116,7 @@ func TestUserspaceEngineReconfig(t *testing.T) {
},
}
e.SetNetworkMap(nm)
e.SetSelfNode(nm.SelfNode)
err = e.Reconfig(cfg, routerCfg, &dns.Config{})
if err != nil {
t.Fatal(err)
@@ -168,7 +168,7 @@ func TestUserspaceEngineTSMPLearned(t *testing.T) {
if err != nil {
t.Fatal(err)
}
e.SetNetworkMap(nm)
e.SetSelfNode(nm.SelfNode)
newDisco := key.NewDisco()
cfg := &wgcfg.Config{
@@ -244,7 +244,7 @@ func TestUserspaceEngineTSMPLearnedMismatch(t *testing.T) {
if err != nil {
t.Fatal(err)
}
e.SetNetworkMap(nm)
e.SetSelfNode(nm.SelfNode)
newDisco := key.NewDisco()
cfg := &wgcfg.Config{
@@ -485,7 +485,7 @@ func TestTSMPKeyAdvertisement(t *testing.T) {
},
}
ue.SetNetworkMap(nm)
ue.SetSelfNode(nm.SelfNode)
err = ue.Reconfig(cfg, routerCfg, &dns.Config{})
if err != nil {
t.Fatal(err)