Skip to content

Fix network initialization during system boot - #4394

Open
everyx wants to merge 2 commits into
SagerNet:stablefrom
everyx:pr/network-init
Open

Fix network initialization during system boot#4394
everyx wants to merge 2 commits into
SagerNet:stablefrom
everyx:pr/network-init

Conversation

@everyx

@everyx everyx commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fix network initialization during system boot and make the started flag atomic to avoid a data race with interface monitor callbacks.

everyx added 2 commits August 7, 2026 09:08
During Linux system boot, the network stack may not be fully initialized
when sing-box starts. The original code would trigger NetworkPause() for
a missing default interface, preventing automatic recovery after network
initialization completes.

Skipping the pause when not yet started lets the router recover once the
network has been initialized.
started is written during Start(PostStart) and read without
synchronization by netif callbacks running on separate goroutines.
Use atomic.Bool to avoid a data race.
@everyx everyx changed the title Pr/network init Fix network initialization during system boot Aug 7, 2026
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.

1 participant