Skip to content

fix(capture): recover stale traffic takeover state#37

Open
MiChongs wants to merge 1 commit into
mainfrom
agent/fix-capture-crash-recovery
Open

fix(capture): recover stale traffic takeover state#37
MiChongs wants to merge 1 commit into
mainfrom
agent/fix-capture-crash-recovery

Conversation

@MiChongs

Copy link
Copy Markdown
Owner

Summary

  • persist an fsync-backed recovery journal and advisory lock before mutating host networking
  • recover stale nftables/iptables rules, policy rules, route tables, and TUN state at the next startup
  • distinguish Android VpnService mode from root-managed Android/Linux traffic takeover
  • include SIGTERM in the ordered shutdown path

Root cause

Traffic cleanup depended on the process reaching the cooperative asynchronous stop path. A crash or forced termination could leave kernel networking rules installed, causing the host—especially a rooted Android device—to lose connectivity.

Impact

A successor process now self-heals stale takeover state before installing new rules, while the advisory lock prevents two instances from managing the same host state concurrently. SIGTERM performs immediate ordered cleanup; uncatchable termination such as SIGKILL is recovered on the next startup.

Checks

  • cargo check -p wuther-core
  • cargo test -p core-capture --lib platform::linux_recovery::tests
  • full cargo test -p core-capture --lib: 313 passed during implementation

Linux cross-compilation reached third-party native dependencies but could not complete because the local environment lacks a Linux C sysroot (for example assert.h and sys/types.h).

@MiChongs
MiChongs marked this pull request as ready for review July 25, 2026 10:46
@MiChongs
MiChongs requested a review from Tools-cx-app as a code owner July 25, 2026 10:46
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