Skip to content

Fix Android internet blackhole caused by stale route re-injection on TUN rebuild #160

Merged
pappz merged 3 commits intomainfrom
fix/android-route-blackhole-on-tun-rebuild
Apr 13, 2026
Merged

Fix Android internet blackhole caused by stale route re-injection on TUN rebuild #160
pappz merged 3 commits intomainfrom
fix/android-route-blackhole-on-tun-rebuild

Conversation

@pappz
Copy link
Copy Markdown
Collaborator

@pappz pappz commented Apr 12, 2026

Problem

After upgrading to v0.4.0, Android users lose all internet connectivity while the VPN is active.

  • Internal NetBird mesh traffic continues to work
  • External traffic (e.g., ping duckduckgo.com) results in 100% packet loss
  • Downgrading to v0.3.2 resolves the issue
  • Bump Netbird submodule version to v0.68.2

Fixes #158


Root Cause

The netbird submodule was bumped from v0.64.1 → v0.68.0, which included [netbirdio/netbird#5739].

That change introduced extraInitialRoutes() to preserve the fake IP block route (240.0.0.0/8) across Android TUN rebuilds. Without it, DNS resolution via fake IPs breaks after the first route update.

However, the implementation has an unintended side effect:

  • extraInitialRoutes() diffs all initial routes against current routes and re-injects missing ones
  • The initial route set includes:
    • All client routes from the first management sync
    • Exit node routes (e.g., 0.0.0.0/0)

When FilterSelectedExitNodes removes an unselected exit node:

  • extraInitialRoutes() re-injects 0.0.0.0/0 during TUN rebuild
  • This causes Android VPN to:
    • Capture all traffic
    • Have no exit node to route it through

➡️ Result: routing black hole (total internet loss)


Fix

Instead of diffing and re-injecting the entire initial route set:

  • Store the fake IP route (240.0.0.0/8) explicitly on the notifier
  • Append only this route in notify()

Summary by CodeRabbit

  • Chores
    • Updated an internal dependency to a newer upstream revision to incorporate recent fixes and maintenance. No public API changes or user-facing differences expected. Low review effort; minimal changes overall.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 12, 2026

📝 Walkthrough

Walkthrough

This pull request updates the netbird git submodule reference from commit 332c624c55a486c0ab7b981a26cf8e00a6fa0774 to commit 4eed459f27bd7e90faa7fe99e1edf4a59dc71265.

Changes

Cohort / File(s) Summary
Submodule Update
netbird
Bumped the netbird git submodule reference to a newer commit (332c624c...4eed459f...). No other source changes in this diff.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • doromaraujo
  • lixmal

Poem

🐰 I hopped through hashes, quick and light,
Swapped one little tag in the pale moonlight.
A tiny leap, a silent cheer,
New commit found — the path is clear.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main fix: preventing stale route re-injection on TUN rebuild that caused Android internet loss, matching the PR's core objective.
Linked Issues check ✅ Passed The PR addresses issue #158 by fixing the stale route re-injection problem during TUN rebuilds, restoring external internet connectivity for Android clients.
Out of Scope Changes check ✅ Passed The change is limited to updating the netbird submodule reference to a patched version addressing the specific routing issue, remaining in scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/android-route-blackhole-on-tun-rebuild

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

lixmal
lixmal previously approved these changes Apr 12, 2026
lixmal
lixmal previously approved these changes Apr 13, 2026
@pappz pappz merged commit 625510f into main Apr 13, 2026
7 checks passed
@pappz pappz deleted the fix/android-route-blackhole-on-tun-rebuild branch April 13, 2026 19:19
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.

[Bug] v0.4.0 update blocked my internet connection

2 participants