Skip to content

libtailscale: do not close old TUNs during reconfig#790

Merged
nickkhyl merged 2 commits into
mainfrom
nickkhyl/keep-old-tun
May 15, 2026
Merged

libtailscale: do not close old TUNs during reconfig#790
nickkhyl merged 2 commits into
mainfrom
nickkhyl/keep-old-tun

Conversation

@nickkhyl
Copy link
Copy Markdown
Member

@nickkhyl nickkhyl commented May 13, 2026

[2 commits to preserve a bit more context around these changes; see commit messages for details]

  • libtailscale: do not close old TUNs during reconfig, except on ChromeOS
  • libtailscale: do not close old TUNs during reconfig on ChromeOS

Updates tailscale/tailscale#19591

nickkhyl added 2 commits May 12, 2026 18:36
Back in 2020, to work around a ChromeOS bug, we started
closing previous tunnels, breaking TCP sessions on reconfig,
in 8dbac87.

This behavior has been preserved during the android app rewrite
in 98a72c2, but we never actually
needed it on Android.

In c290ccf, the author of the original
commit said: "note that seamless VPN tunnel handover works on Android
But not on ChromeOS, and I haven't found a robust way to detect
ChromeOS.".

The isChromeOS method was added in a7dfea2
for an unrelated reason, but we never stopped closing the tunnels on Android.

In this PR, we update (*backend).updateTUN to avoid closing the old tunnels
unless we're running on ChromeOS or have an empty config.

Updates tailscale/tailscale#19591

Signed-off-by: Nick Khyl <nickk@tailscale.com>
The bug that required us to close previous tunnels during VPN reconfiguration
on ChromeOS in 8dbac87 was resolved
sometime between June 2020 and February 2021.

While we do not know exactly when it was fixed, we believe the issue was resolved
in November 2020, when OpenVpnDriver was migrated to the VpnService state machine:
https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2497361

While I couldn't find a reliable way to determine which ChromeOS version we're running on,
the Auto Update Expiration (AUE) policy suggests that only devices manufactured in 2017
or earlier might not be eligible for an update to a version with the seamless handover fix.

Considering the above, in this commit we stop closing old TUNs on ChromeOS to avoid
breaking connections for users running newer (November 2020+) ChromeOS releases.

Updates tailscale/tailscale#19591

Signed-off-by: Nick Khyl <nickk@tailscale.com>
@nickkhyl nickkhyl requested a review from kari-ts May 13, 2026 00:15
@nickkhyl
Copy link
Copy Markdown
Member Author

nickkhyl commented May 13, 2026

I tested this manually on both Android and ChromeOS -- seems fine.

But I'd give it a bit more time on a few devices before merging, mainly because the multiTUN implementation as a whole is a bit fragile.

/cc @croakerbcts -- this change might be a good candidate for more scrupulous testing in 1.99.x / 1.100 when it lands.

@kari-ts
Copy link
Copy Markdown
Collaborator

kari-ts commented May 15, 2026

Awesome!! Thanks for the fix!

@nickkhyl nickkhyl merged commit 02768ec into main May 15, 2026
4 checks passed
@nickkhyl nickkhyl deleted the nickkhyl/keep-old-tun branch May 15, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants