From c1aa5a2e33083943d0298dc2d7275907305e9c03 Mon Sep 17 00:00:00 2001 From: Matt Drollette Date: Thu, 12 Aug 2021 12:08:46 -0500 Subject: [PATCH] ipn/ipnlocal: update requested tags in host info Fixes #2641 Signed-off-by: Matt Drollette --- ipn/ipnlocal/local.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 046744404..125096704 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -784,8 +784,6 @@ func (b *LocalBackend) Start(opts ipn.Options) error { b.inServerMode = b.prefs.ForceDaemon b.serverURL = b.prefs.ControlURLOrDefault() - hostinfo.RoutableIPs = append(hostinfo.RoutableIPs, b.prefs.AdvertiseRoutes...) - hostinfo.RequestTags = append(hostinfo.RequestTags, b.prefs.AdvertiseTags...) if b.inServerMode || runtime.GOOS == "windows" { b.logf("Start: serverMode=%v", b.inServerMode) } @@ -1581,7 +1579,6 @@ func (b *LocalBackend) setPrefsLockedOnEntry(caller string, newp *ipn.Prefs) { oldHi := b.hostinfo newHi := oldHi.Clone() - newHi.RoutableIPs = append([]netaddr.IPPrefix(nil), b.prefs.AdvertiseRoutes...) applyPrefsToHostinfo(newHi, newp) b.hostinfo = newHi hostInfoChanged := !oldHi.Equal(newHi) @@ -2219,6 +2216,8 @@ func applyPrefsToHostinfo(hi *tailcfg.Hostinfo, prefs *ipn.Prefs) { if m := prefs.DeviceModel; m != "" { hi.DeviceModel = m } + hi.RoutableIPs = append(prefs.AdvertiseRoutes[:0:0], prefs.AdvertiseRoutes...) + hi.RequestTags = append(prefs.AdvertiseTags[:0:0], prefs.AdvertiseTags...) hi.ShieldsUp = prefs.ShieldsUp }