diff options
| author | Jonathan Nobels <jnobels@gmail.com> | 2024-07-30 12:54:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-30 12:54:03 -0400 |
| commit | 8a8ecac6a75e930fe0fe7611507fb736007ec61e (patch) | |
| tree | 2f11c3d83cd54b35754c9e3a88d10543d66d71cf | |
| parent | eead25560fad858dc480f2b64dabc457fb93f211 (diff) | |
| download | tailscale-8a8ecac6a75e930fe0fe7611507fb736007ec61e.tar.xz tailscale-8a8ecac6a75e930fe0fe7611507fb736007ec61e.zip | |
net/dns, cmd/tailscaled: plumb system health tracker into dns cleanup (#12969)
fixes tailscale#12968
The dns manager cleanup func was getting passed a nil
health tracker, which will panic. Fixed to pass it
the system health tracker.
Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
| -rw-r--r-- | cmd/tailscaled/tailscaled.go | 2 | ||||
| -rw-r--r-- | net/dns/manager.go | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/cmd/tailscaled/tailscaled.go b/cmd/tailscaled/tailscaled.go index a2ab7271c..1a9a367da 100644 --- a/cmd/tailscaled/tailscaled.go +++ b/cmd/tailscaled/tailscaled.go @@ -394,7 +394,7 @@ func run() (err error) { // Always clean up, even if we're going to run the server. This covers cases // such as when a system was rebooted without shutting down, or tailscaled // crashed, and would for example restore system DNS configuration. - dns.CleanUp(logf, netMon, args.tunname) + dns.CleanUp(logf, netMon, sys.HealthTracker(), args.tunname) router.CleanUp(logf, netMon, args.tunname) // If the cleanUp flag was passed, then exit. if args.cleanUp { diff --git a/net/dns/manager.go b/net/dns/manager.go index 818748ac4..dfce5b2ac 100644 --- a/net/dns/manager.go +++ b/net/dns/manager.go @@ -538,7 +538,9 @@ func (m *Manager) FlushCaches() error { // CleanUp restores the system DNS configuration to its original state // in case the Tailscale daemon terminated without closing the router. // No other state needs to be instantiated before this runs. -func CleanUp(logf logger.Logf, netMon *netmon.Monitor, interfaceName string) { +// +// health must not be nil +func CleanUp(logf logger.Logf, netMon *netmon.Monitor, health *health.Tracker, interfaceName string) { oscfg, err := NewOSConfigurator(logf, nil, nil, interfaceName) if err != nil { logf("creating dns cleanup: %v", err) @@ -546,7 +548,7 @@ func CleanUp(logf logger.Logf, netMon *netmon.Monitor, interfaceName string) { } d := &tsdial.Dialer{Logf: logf} d.SetNetMon(netMon) - dns := NewManager(logf, oscfg, nil, d, nil, nil, runtime.GOOS) + dns := NewManager(logf, oscfg, health, d, nil, nil, runtime.GOOS) if err := dns.Down(); err != nil { logf("dns down: %v", err) } |
