[PR #5803] [client] Fix iOS DNS upstream routing for deselected exit nodes #23971

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

Original Pull Request: https://github.com/netbirdio/netbird/pull/5803

State: closed
Merged: Yes


Describe your changes

  • Add GetSelectedClientRoutes() to the route manager that filters through FilterSelectedExitNodes, returning only active routes instead of all management routes
  • Use GetSelectedClientRoutes() in the DNS route checker so deselected exit nodes' 0.0.0.0/0 no longer matches upstream DNS IPs — this prevented the resolver from switching
    away from the utun-bound socket after exit node deselection
  • Initialize iOS DNS server with host DNS fallback addresses (1.1.1.1:53, 1.0.0.1:53) and a permanent root zone handler, matching Android's behavior — without this, unmatched
    DNS queries arriving via the 0.0.0.0/0 tunnel route had no handler and were silently dropped

Test plan

  • Deselect exit node on WiFi — upstream DNS queries should use regular socket (needsPrivate=false), not utun-bound
  • Deselect exit node on cellular — root zone handler should forward unmatched queries to 1.1.1.1
  • Select exit node — DNS queries should route through the WireGuard peer (needsPrivate=true)
  • Verify GetClientRoutes() callers (TriggerSelection, addrViaRoutes) still work correctly with unfiltered 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
    • iOS now correctly initializes and forwards host/system DNS addresses at startup.
    • Improved DNS resolution reliability and network stability on iOS clients.
    • Added default fallback DNS resolvers for iOS to reduce resolution failures during launch.
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/5803 **State:** closed **Merged:** Yes --- ## Describe your changes - Add GetSelectedClientRoutes() to the route manager that filters through FilterSelectedExitNodes, returning only active routes instead of all management routes - Use GetSelectedClientRoutes() in the DNS route checker so deselected exit nodes' 0.0.0.0/0 no longer matches upstream DNS IPs — this prevented the resolver from switching away from the utun-bound socket after exit node deselection - Initialize iOS DNS server with host DNS fallback addresses (1.1.1.1:53, 1.0.0.1:53) and a permanent root zone handler, matching Android's behavior — without this, unmatched DNS queries arriving via the 0.0.0.0/0 tunnel route had no handler and were silently dropped ### Test plan - Deselect exit node on WiFi — upstream DNS queries should use regular socket (needsPrivate=false), not utun-bound - Deselect exit node on cellular — root zone handler should forward unmatched queries to 1.1.1.1 - Select exit node — DNS queries should route through the WireGuard peer (needsPrivate=true) - Verify GetClientRoutes() callers (TriggerSelection, addrViaRoutes) still work correctly with unfiltered routes ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] 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** * iOS now correctly initializes and forwards host/system DNS addresses at startup. * Improved DNS resolution reliability and network stability on iOS clients. * Added default fallback DNS resolvers for iOS to reduce resolution failures during launch. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
saavagebueno added the pull-request label 2026-08-05 06:08:05 -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#23971