Skip to content

[client] Fix Android DNS routes lost after TUN rebuild#5739

Merged
lixmal merged 1 commit intomainfrom
fix-android-fakeip-routes
Mar 31, 2026
Merged

[client] Fix Android DNS routes lost after TUN rebuild#5739
lixmal merged 1 commit intomainfrom
fix-android-fakeip-routes

Conversation

@lixmal
Copy link
Copy Markdown
Collaborator

@lixmal lixmal commented Mar 30, 2026

Describe your changes

When Android receives a route update from management, the TUN interface is rebuilt with the new route list. The notify() method was only sending currentRoutes (which excludes the fake IP block), so the fake IP block route (240.0.0.0/8) was dropped from the TUN after the first route update. Traffic to fake IPs then had no route to the TUN and went nowhere.

  • Merge extra initial routes (fake IP blocks) into every route notification sent to the Android listener
  • Extract filterStatic helper and extraInitialRoutes to keep the logic clean

Issue ticket number and link

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
    • Updated network route notifications on Android to include initial setup routes alongside active routes, ensuring comprehensive route reflection during network changes.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2722d97f-f3b7-4b07-82bc-699ce838d06c

📥 Commits

Reviewing files that changed from the base of the PR and between 7bbe71c and 4fad085.

📒 Files selected for processing (1)
  • client/internal/routemanager/notifier/notifier_android.go

📝 Walkthrough

Walkthrough

The notifier_android.go file refactors route initialization logic. SetInitialClientRoutes now uses a shared static-route filter to assign both initial and current routes. During notification, the route set is expanded to include missing initial routes computed via extraInitialRoutes(). New helper functions extraInitialRoutes and filterStatic were introduced.

Changes

Cohort / File(s) Summary
Android Route Notification
client/internal/routemanager/notifier/notifier_android.go
Refactored SetInitialClientRoutes to use shared static-route filter; expanded route set during notify to include missing initial routes via new extraInitialRoutes() helper; added filterStatic helper function.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • mlsmaycon

Poem

🐰 Routes are routes, but some are more fine,
Static filtered, arranged in a line—
Extra initial ones, once left behind,
Now bundled together for Android's mind!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main bug fix: Android DNS/route functionality affected by TUN rebuilds losing fake IP block routes.
Description check ✅ Passed The description includes a clear problem statement, explains the solution with specific code changes, marks the PR type correctly as a bug fix, and justifies why documentation is not needed.

✏️ 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-fakeip-routes

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.

@sonarqubecloud
Copy link
Copy Markdown

@lixmal lixmal merged commit a62d472 into main Mar 31, 2026
41 of 43 checks passed
@lixmal lixmal deleted the fix-android-fakeip-routes branch March 31, 2026 08:36
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.

2 participants