net/netmon: poll interfaces after wake#1
Open
eviaaaaa wants to merge 1 commit into
Open
Conversation
The first interface snapshot after a device wakes can run before Wi-Fi or DHCP has recovered. Some operating systems then fail to deliver a later address or route notification, leaving consumers with a stale offline state. After a detected time jump, poll interfaces every 15 seconds for 10 minutes. These non-forcing polls only notify callbacks when the interface state changes. Updates tailscale#10688 RELNOTE: Fixed devices sometimes remaining offline after waking from sleep. Change-Id: Idbf9126f2aeb47db89c65dbcae5a27801834c7ec Signed-off-by: evilhero <2278596667@qq.com>
eviaaaaa
marked this pull request as draft
July 19, 2026 03:26
eviaaaaa
marked this pull request as ready for review
July 19, 2026 05:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mihomo's embedded
tsnet.Servercan remain offline after Windows wakes fromsleep. This was reproduced with:
6414c563dda547f95195f12175a8e3d9f667984b1ab893d4162c4ef42fa39d6da63998edaab4f0e4Stock Tailscale 1.98.2 did not reproduce the problem on the same machine, so
this report is limited to the Mihomo
tsnetintegration.Reproduction
On wake, netmon took its first snapshot before WLAN and Mihomo TUN had
recovered:
WLAN connected about 476 ms later, and Mihomo started using it again after
about two seconds. Tailscale did not receive another interface event and
remained in
network down.At that point ordinary proxy traffic still returned HTTP 204, while the
Tailscale-routed request returned HTTP 502. A second sleep test produced 22
failed WireGuard handshakes over almost two minutes. Restarting the Mihomo core
restored the Tailscale route immediately.
Change
After a wake time jump, netmon now polls interfaces every 15 seconds for up to
10 minutes. The polls are non-forcing, so unchanged state does not result in a
callback or socket rebind. If WLAN recovers without another Windows event, a
later poll updates
magicsock.networkUp.The existing behavior on Android, iOS, and Plan 9 is unchanged because those
platforms do not run the wall-time wake monitor.
Validation
A patched Mihomo build was put through two sleep cycles without restarting the
core. The second cycle hit the original race and recovered on the first poll:
Recovery took 15.6 seconds. A follow-up request was confirmed to use the
Tailscale outbound successfully.
Passed:
Updates tailscale#10688