[PR #2191] [CLOSED] macOS HostDNS refactor #16645

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/2191
Author: @hurricanehrndz
Created: 6/24/2024
Status: Closed

Base: mainHead: chernand/refactor_macos_split_dns


📝 Commits (1)

  • c0ac4fc Refactor macOS system DNS configuration

📊 Changes

1 file changed (+125 additions, -52 deletions)

View changed files

📝 client/internal/dns/host_darwin.go (+125 -52)

📄 Description

On macOS use the recommended settings for providing split DNS. As per the docs an empty string will force the configuration to be the default. In order to to support split DNS an additional service config is added for the local server and search domain settings.

see: https://developer.apple.com/documentation/devicemanagement/vpn/dns

Describe your changes

This patch refactors split DNS on macOS devices. Current code tries to force mDNSResponder to use a specific search order for search domains. Unfortunately macOS will randomly choose which DNS server to forward queries to. This leads to unexpected behavior and results.

This patch does create an issue though. When Management and Signal domains are part of the search domains and/or all DNS is being forwarded to servers only available via the Wireguard tunnel, resuming connections after sleep can be a little unpredictable.

In order to increase stability a strategy needs to be employed that ensures Management/Admin/TURN URLs are resolvable via the local DNS servers. There are two means to go about this, in the upstream resolver code force lookup to Admin/Signal/TURN URLs to the the local resolver or you can apply a system configuration that forwards lookup for said URLs to the local resolver. I tested with the latter with hardcoded entries and it worked well. I am incline to provide another patch to achieve a similar outcome but wanted your opinion.

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)
  • Extended the README / documentation, if necessary

🔄 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/2191 **Author:** [@hurricanehrndz](https://github.com/hurricanehrndz) **Created:** 6/24/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `chernand/refactor_macos_split_dns` --- ### 📝 Commits (1) - [`c0ac4fc`](https://github.com/netbirdio/netbird/commit/c0ac4fcac8c795cc141d02bd8b9c22f22fb7ee59) Refactor macOS system DNS configuration ### 📊 Changes **1 file changed** (+125 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/dns/host_darwin.go` (+125 -52) </details> ### 📄 Description On macOS use the recommended settings for providing split DNS. As per the docs an empty string will force the configuration to be the default. In order to to support split DNS an additional service config is added for the local server and search domain settings. see: https://developer.apple.com/documentation/devicemanagement/vpn/dns ## Describe your changes This patch refactors split DNS on macOS devices. Current code tries to force mDNSResponder to use a specific search order for search domains. Unfortunately macOS will randomly choose which DNS server to forward queries to. This leads to unexpected behavior and results. This patch does create an issue though. When Management and Signal domains are part of the search domains and/or all DNS is being forwarded to servers only available via the Wireguard tunnel, resuming connections after sleep can be a little unpredictable. In order to increase stability a strategy needs to be employed that ensures Management/Admin/TURN URLs are resolvable via the local DNS servers. There are two means to go about this, in the upstream resolver code force lookup to Admin/Signal/TURN URLs to the the local resolver or you can apply a system configuration that forwards lookup for said URLs to the local resolver. I tested with the latter with hardcoded entries and it worked well. I am incline to provide another patch to achieve a similar outcome but wanted your opinion. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <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 04:06:22 -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#16645