cmd/tailscaled, ipn/ipnlocal, wgengine: shutdown tailscaled if wgdevice is closed

Tailscaled becomes inoperative if the Tailscale Tunnel wintun adapter is abruptly removed.
wireguard-go closes the device in case of a read error, but tailscaled keeps running.
This adds detection of a closed WireGuard device, triggering a graceful shutdown of tailscaled.
It is then restarted by the tailscaled watchdog service process.

Fixes #11222

Signed-off-by: Nick Khyl <nickk@tailscale.com>
This commit is contained in:
Nick Khyl
2024-02-23 19:55:08 -06:00
committed by Nick Khyl
parent b42b9817b0
commit 7ef1fb113d
6 changed files with 46 additions and 16 deletions

View File

@@ -678,7 +678,7 @@ func (b *LocalBackend) Shutdown() {
}
b.ctxCancel()
b.e.Close()
b.e.Wait()
<-b.e.Done()
}
func stripKeysFromPrefs(p ipn.PrefsView) ipn.PrefsView {