[PR #4241] [MERGED] [client] Disable the dns host manager properly if disabled through management #22811

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/4241
Author: @lixmal
Created: 7/29/2025
Status: Merged
Merged: 7/29/2025
Merged by: @lixmal

Base: mainHead: fix-disable-dns


📝 Commits (1)

  • 3fdcab1 Disable the dns host manager properly if disabled through management

📊 Changes

2 files changed (+76 additions, -31 deletions)

View changed files

📝 client/internal/dns/handler_chain.go (+1 -1)
📝 client/internal/dns/server.go (+75 -30)

📄 Description

Describe your changes

This PR fixes several DNS manager cleanup issues:

  1. DNS not cleaned up when disabled via management
  • Start with DNS enabled in management
  • Run netbird up
  • Disable DNS in management
  • Result: Host DNS still points to NetBird's IP instead of being restored (e.g., /etc/resolv.conf on Linux, but varies by system)
  1. Invalid IP in host DNS when starting with DNS disabled
  • Start with DNS disabled in management
  • Run netbird up
  • Result: Host DNS configuration gets an invalid IP address
  1. Deadlock during shutdown after DNS disable/enable cycle
  • Start with DNS disabled in management
  • Run netbird up
  • Enable DNS, then disable it again via management
  • Run netbird down
  • Result: DNS cleanup hangs and blocks shutdown
  1. Client DNS flags ignored after management DNS toggle
  • Start with DNS disabled on client (via --disable-dns flag or netstack mode)
  • Management has DNS enabled
  • Run netbird up - correctly no host DNS changes
  • Toggle DNS off then on again in management
  • Result: Client DNS becomes active, ignoring the client-side disable flag

#4236

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

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


🔄 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/4241 **Author:** [@lixmal](https://github.com/lixmal) **Created:** 7/29/2025 **Status:** ✅ Merged **Merged:** 7/29/2025 **Merged by:** [@lixmal](https://github.com/lixmal) **Base:** `main` ← **Head:** `fix-disable-dns` --- ### 📝 Commits (1) - [`3fdcab1`](https://github.com/netbirdio/netbird/commit/3fdcab10109e0188ae24ef15be22b39f8a5dfcb0) Disable the dns host manager properly if disabled through management ### 📊 Changes **2 files changed** (+76 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/dns/handler_chain.go` (+1 -1) 📝 `client/internal/dns/server.go` (+75 -30) </details> ### 📄 Description ## Describe your changes This PR fixes several DNS manager cleanup issues: 1. DNS not cleaned up when disabled via management - Start with DNS enabled in management - Run netbird up - Disable DNS in management - Result: Host DNS still points to NetBird's IP instead of being restored (e.g., /etc/resolv.conf on Linux, but varies by system) 2. Invalid IP in host DNS when starting with DNS disabled - Start with DNS disabled in management - Run netbird up - Result: Host DNS configuration gets an invalid IP address 3. Deadlock during shutdown after DNS disable/enable cycle - Start with DNS disabled in management - Run netbird up - Enable DNS, then disable it again via management - Run netbird down - Result: DNS cleanup hangs and blocks shutdown 4. Client DNS flags ignored after management DNS toggle - Start with DNS disabled on client (via --disable-dns flag or netstack mode) - Management has DNS enabled - Run netbird up - correctly no host DNS changes - Toggle DNS off then on again in management - Result: Client DNS becomes active, ignoring the client-side disable flag ## Issue ticket number and link #4236 ## Stack <!-- branch-stack --> ### Checklist - [x] 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 > 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). --- <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 06:06:26 -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#22811