From 33a953fb21893ef26eac59619bc7c288b17c4340 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 4 Dec 2020 16:24:56 +0100 Subject: [PATCH] cmd/tailscale: only refresh VPN tunnel if configuration changed This used to work, but a later ChromeOS workaround closed and cleared the last configuration before comparing it with the new. Fixes tailscale/tailscale#966 Signed-off-by: Elias Naur --- cmd/tailscale/backend.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/tailscale/backend.go b/cmd/tailscale/backend.go index 7ce297b..22f01a4 100644 --- a/cmd/tailscale/backend.go +++ b/cmd/tailscale/backend.go @@ -142,6 +142,10 @@ func (b *backend) setCfg(cfg *router.Config) error { } func (b *backend) updateTUN(service jni.Object, cfg *router.Config) error { + if reflect.DeepEqual(cfg, b.lastCfg) { + return nil + } + // Close previous tunnel(s). // This is necessary for ChromeOS, native Android devices // seem to handle seamless handover between tunnels correctly. @@ -150,9 +154,6 @@ func (b *backend) updateTUN(service jni.Object, cfg *router.Config) error { // the closing on ChromeOS. b.CloseTUNs() - if reflect.DeepEqual(cfg, b.lastCfg) { - return nil - } if len(cfg.LocalAddrs) == 0 { return nil }