[PR #5865] [MERGED] [client] Fix Android internet blackhole caused by stale route re-injection on TUN rebuild #28665

Closed
opened 2026-08-05 08:06:43 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5865
Author: @pappz
Created: 4/12/2026
Status: Merged
Merged: 4/13/2026
Merged by: @pappz

Base: mainHead: fix/android-route-blackhole-on-tun-rebuild


📝 Commits (1)

  • f9a07ce Fix Android internet blackhole caused by stale route re-injection on TUN rebuild

📊 Changes

4 files changed (+19 additions, -20 deletions)

View changed files

📝 client/internal/routemanager/manager.go (+1 -0)
📝 client/internal/routemanager/notifier/notifier_android.go (+10 -20)
📝 client/internal/routemanager/notifier/notifier_ios.go (+4 -0)
📝 client/internal/routemanager/notifier/notifier_other.go (+4 -0)

📄 Description

Describe your changes

On Android, users lose all internet connectivity while the VPN is active.

  • Internal NetBird mesh traffic still works
  • External traffic results in 100% packet loss

Root Cause

extraInitialRoutes() (introduced in #5739) was intended to preserve only the fake IP block route (240.0.0.0/8) across TUN rebuilds. However, it re-injects any initial route whose prefix is missing from the current route set.

Since every network map update delivers the full route set (not a diff), the initial routes become stale after the first update.

When the route selector filters out an unselected exit node (0.0.0.0/0):

  • extraInitialRoutes() re-injects it during the TUN rebuild
  • The Android VPN captures all traffic
  • There is no peer to handle it

Fix

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

This preserves the DNS fake IP fix from #5739 without re-injecting stale routes.

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Bug Fixes
    • Improved fake IP route handling across Android, iOS, and other platforms for more reliable network routing management.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/5865 **Author:** [@pappz](https://github.com/pappz) **Created:** 4/12/2026 **Status:** ✅ Merged **Merged:** 4/13/2026 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `fix/android-route-blackhole-on-tun-rebuild` --- ### 📝 Commits (1) - [`f9a07ce`](https://github.com/netbirdio/netbird/commit/f9a07ce4fa45c027ffd06d86cd733c4ef2fd3782) Fix Android internet blackhole caused by stale route re-injection on TUN rebuild ### 📊 Changes **4 files changed** (+19 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/routemanager/manager.go` (+1 -0) 📝 `client/internal/routemanager/notifier/notifier_android.go` (+10 -20) 📝 `client/internal/routemanager/notifier/notifier_ios.go` (+4 -0) 📝 `client/internal/routemanager/notifier/notifier_other.go` (+4 -0) </details> ### 📄 Description ## Describe your changes On Android, users lose all internet connectivity while the VPN is active. - Internal NetBird mesh traffic still works - External traffic results in **100% packet loss** --- ## Root Cause `extraInitialRoutes()` (introduced in #5739) was intended to preserve only the fake IP block route (`240.0.0.0/8`) across TUN rebuilds. However, it re-injects **any** initial route whose prefix is missing from the current route set. Since every network map update delivers the full route set (not a diff), the initial routes become stale after the first update. When the route selector filters out an unselected exit node (`0.0.0.0/0`): - `extraInitialRoutes()` re-injects it during the TUN rebuild - The Android VPN captures all traffic - There is **no peer to handle it** --- ## Fix - Store the fake IP route (`240.0.0.0/8`) explicitly on the notifier - Append **only this route** in `notify()` This preserves the DNS fake IP fix from #5739 without re-injecting stale routes. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved fake IP route handling across Android, iOS, and other platforms for more reliable network routing management. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 08:06:43 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#28665