[PR #967] [MERGED] Feature/permanent dns #13193

Closed
opened 2026-08-05 02:07:42 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/967
Author: @pappz
Created: 6/19/2023
Status: Merged
Merged: 7/14/2023
Merged by: @mlsmaycon

Base: mainHead: feature/permanent_dns


📝 Commits (10+)

  • 45f32ea Add DNS list argument for mobile client
  • 66159fe Write testable code
  • 2bc6713 Refactor the DNS server internal code structure
  • 9f14138 Add host dns addr feature for the server
  • f5def2c Connection between Mobile client and DNS server
  • ce5459b Fix dns service type on Android and add log
  • 64f0a2f Fix
  • 6272274 Refactor the on update host dns mechanism
  • 970efba Remove initial dns config reading
  • 65e23f4 Remove unused variables and lint fixes

📊 Changes

30 files changed (+918 additions, -359 deletions)

View changed files

📝 client/android/client.go (+21 -2)
client/android/dns_list.go (+26 -0)
client/android/dns_list_test.go (+24 -0)
📝 client/cmd/up.go (+1 -1)
📝 client/internal/connect.go (+20 -9)
📝 client/internal/dns/host_android.go (+1 -5)
📝 client/internal/dns/host_darwin.go (+1 -3)
📝 client/internal/dns/host_linux.go (+3 -3)
📝 client/internal/dns/host_windows.go (+1 -3)
📝 client/internal/dns/mockServer.go (+5 -0)
📝 client/internal/dns/network_manager_linux.go (+1 -3)
📝 client/internal/dns/resolvconf_linux.go (+1 -3)
📝 client/internal/dns/server.go (+91 -237)
client/internal/dns/server_export.go (+29 -0)
client/internal/dns/server_export_test.go (+24 -0)
📝 client/internal/dns/server_test.go (+282 -63)
client/internal/dns/service.go (+18 -0)
client/internal/dns/service_listener.go (+145 -0)
client/internal/dns/service_memory.go (+139 -0)
client/internal/dns/service_memory_test.go (+31 -0)

...and 10 more files

📄 Description

Describe your changes

Because on Android system hard to update DNS settings the system will set our DNS service as permanent DNS server on mobile system.
This PR modify the original logic. Now the DNS service can functional in two different way

  1. the DNS service will start listen when get update from mgm server
  2. the DNS service start listening immediately when it instantiated

In the second case the upstream DNS server will be the DNS servers from the host machine.
The relevant Android code: https://github.com/netbirdio/react-native-app/pull/24

Android

The Android code track the network changes and update the DNS configuration when it has been changed on the host machine. For example when switch from 4G to WIFI.

Test

Because this change refactor the whole logic necessary to test all combination of the supported systems

  • Mac, Win, Linux, Android
  • On Linux with WG bind interface and with kernel module support
  • On Linux with systemd, resolve.conf

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/967 **Author:** [@pappz](https://github.com/pappz) **Created:** 6/19/2023 **Status:** ✅ Merged **Merged:** 7/14/2023 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `feature/permanent_dns` --- ### 📝 Commits (10+) - [`45f32ea`](https://github.com/netbirdio/netbird/commit/45f32ea54121bc219221df53c204c0f2d6797a85) Add DNS list argument for mobile client - [`66159fe`](https://github.com/netbirdio/netbird/commit/66159fe2bd4eda49848b96d36de0d02a77ddbfb9) Write testable code - [`2bc6713`](https://github.com/netbirdio/netbird/commit/2bc67134a48b88c0eea535eba2d4e3979b6b19a1) Refactor the DNS server internal code structure - [`9f14138`](https://github.com/netbirdio/netbird/commit/9f141389a10fb6f232eb84929947598304131110) Add host dns addr feature for the server - [`f5def2c`](https://github.com/netbirdio/netbird/commit/f5def2cae4bedd73fca952fc3c38701250dbb3ff) Connection between Mobile client and DNS server - [`ce5459b`](https://github.com/netbirdio/netbird/commit/ce5459b655ef6366de3bbd942375593f5fb30340) Fix dns service type on Android and add log - [`64f0a2f`](https://github.com/netbirdio/netbird/commit/64f0a2f7b8d1010d8242c4c3932f725a1448275e) Fix - [`6272274`](https://github.com/netbirdio/netbird/commit/62722746894fd9590f5fc38891d2a04936af57d4) Refactor the on update host dns mechanism - [`970efba`](https://github.com/netbirdio/netbird/commit/970efba7e1f4e299abf7c65d8c0ac7b9310db57d) Remove initial dns config reading - [`65e23f4`](https://github.com/netbirdio/netbird/commit/65e23f41d3d877edc66bbafc8a1117b0ecde15fb) Remove unused variables and lint fixes ### 📊 Changes **30 files changed** (+918 additions, -359 deletions) <details> <summary>View changed files</summary> 📝 `client/android/client.go` (+21 -2) ➕ `client/android/dns_list.go` (+26 -0) ➕ `client/android/dns_list_test.go` (+24 -0) 📝 `client/cmd/up.go` (+1 -1) 📝 `client/internal/connect.go` (+20 -9) 📝 `client/internal/dns/host_android.go` (+1 -5) 📝 `client/internal/dns/host_darwin.go` (+1 -3) 📝 `client/internal/dns/host_linux.go` (+3 -3) 📝 `client/internal/dns/host_windows.go` (+1 -3) 📝 `client/internal/dns/mockServer.go` (+5 -0) 📝 `client/internal/dns/network_manager_linux.go` (+1 -3) 📝 `client/internal/dns/resolvconf_linux.go` (+1 -3) 📝 `client/internal/dns/server.go` (+91 -237) ➕ `client/internal/dns/server_export.go` (+29 -0) ➕ `client/internal/dns/server_export_test.go` (+24 -0) 📝 `client/internal/dns/server_test.go` (+282 -63) ➕ `client/internal/dns/service.go` (+18 -0) ➕ `client/internal/dns/service_listener.go` (+145 -0) ➕ `client/internal/dns/service_memory.go` (+139 -0) ➕ `client/internal/dns/service_memory_test.go` (+31 -0) _...and 10 more files_ </details> ### 📄 Description ## Describe your changes Because on Android system hard to update DNS settings the system will set our DNS service as permanent DNS server on mobile system. This PR modify the original logic. Now the DNS service can functional in two different way 1. the DNS service will start listen when get update from mgm server 2. the DNS service start listening immediately when it instantiated In the second case the upstream DNS server will be the DNS servers from the host machine. The relevant Android code: https://github.com/netbirdio/react-native-app/pull/24 ### Android The Android code track the network changes and update the DNS configuration when it has been changed on the host machine. For example when switch from 4G to WIFI. ### Test Because this change refactor the whole logic necessary to test all combination of the supported systems - Mac, Win, Linux, Android - On Linux with WG bind interface and with kernel module support - On Linux with systemd, resolve.conf ## Issue ticket number and link ### 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) - [ ] 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 02:07:42 -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#13193