[PR #5625] [CLOSED] fix(dns): skip probe for NetBird overlay addresses at engine startup #23470

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5625
Author: @sbeaudry-qms
Created: 3/18/2026
Status: Closed

Base: mainHead: fix/dns-skip-overlay-probe


📝 Commits (3)

  • 434ad13 fix(dns): skip probe for NetBird overlay addresses at engine startup
  • dc9aaa6 fix(dns): Addressing CodeRabbit suggestion. Remove mutex around wg.Wait() in Stop() to prevent deadlock
  • 931dbae fix(dns): Following CodeRabbit's suggestion: Using probedAny flag instead of success=true for skipped overlay servers

📊 Changes

2 files changed (+324 additions, -20 deletions)

View changed files

📝 client/internal/dns/upstream.go (+72 -20)
📝 client/internal/dns/upstream_test.go (+252 -0)

📄 Description

Describe your changes

When a nameserver is configured with a NetBird overlay IP (in the 100.64.0.0/10 CGNAT range), ProbeAvailability() is called at engine startup before the WireGuard tunnel to that peer is established. The probe always fails at this point — not because the nameserver is down, but because the tunnel isn't up yet. This produces a spurious "Unable to reach one or more DNS servers" warning in netbird status -d even though DNS resolves correctly once the connection settles.

This change skips the startup probe for any nameserver whose IP falls within the NetBird CGNAT range. A debug log message is emitted instead. These nameservers continue to be exercised normally by real DNS queries, and the waitUntilResponse retry loop still handles genuine failures.

Non-overlay nameservers (LAN IPs, public DNS) are unaffected and continue to be probed as before.

N/A — no existing issue. This addresses a known annoyance discussed in the NetBird community forum: https://forum.netbird.io/t/unable-to-reach-one-or-more-dns-servers/204

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)

Documentation

  • Documentation is not needed for this change (explain why)

This is a bug fix for a false-positive warning with no user-facing behaviour change. DNS resolution is unaffected.

Summary by CodeRabbit

  • Bug Fixes

    • Skip CGNAT overlay (100.64.0.0/10) addresses during startup probes to avoid false-positive DNS failures; skipping is logged and treated as passed.
    • Improve shutdown coordination and concurrency safety for probing and disabling to ensure clean stop behavior.
    • Aggregate probe errors and strengthen context-aware probing/cancellation for more reliable failure reporting.
  • Tests

    • Added comprehensive tests covering overlay detection and probing behavior across LAN, public, mixed, and overlay-only scenarios.

🔄 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/5625 **Author:** [@sbeaudry-qms](https://github.com/sbeaudry-qms) **Created:** 3/18/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/dns-skip-overlay-probe` --- ### 📝 Commits (3) - [`434ad13`](https://github.com/netbirdio/netbird/commit/434ad1331bd844073ca087a7b65b2a0e1b44ca84) fix(dns): skip probe for NetBird overlay addresses at engine startup - [`dc9aaa6`](https://github.com/netbirdio/netbird/commit/dc9aaa6e82678bb2ebaa58ffbbcdea87cbe0e4a2) fix(dns): Addressing CodeRabbit suggestion. Remove mutex around wg.Wait() in Stop() to prevent deadlock - [`931dbae`](https://github.com/netbirdio/netbird/commit/931dbaebe8a59e5a75e7437f045da94a18998f0e) fix(dns): Following CodeRabbit's suggestion: Using probedAny flag instead of success=true for skipped overlay servers ### 📊 Changes **2 files changed** (+324 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/dns/upstream.go` (+72 -20) 📝 `client/internal/dns/upstream_test.go` (+252 -0) </details> ### 📄 Description ## Describe your changes When a nameserver is configured with a NetBird overlay IP (in the `100.64.0.0/10` CGNAT range), `ProbeAvailability()` is called at engine startup before the WireGuard tunnel to that peer is established. The probe always fails at this point — not because the nameserver is down, but because the tunnel isn't up yet. This produces a spurious "Unable to reach one or more DNS servers" warning in `netbird status -d` even though DNS resolves correctly once the connection settles. This change skips the startup probe for any nameserver whose IP falls within the NetBird CGNAT range. A debug log message is emitted instead. These nameservers continue to be exercised normally by real DNS queries, and the `waitUntilResponse` retry loop still handles genuine failures. Non-overlay nameservers (LAN IPs, public DNS) are unaffected and continue to be probed as before. ## Issue ticket number and link N/A — no existing issue. This addresses a known annoyance discussed in the NetBird community forum: https://forum.netbird.io/t/unable-to-reach-one-or-more-dns-servers/204 ## Stack <!-- branch-stack --> ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [x] Created tests that fail without the change (if possible) ## Documentation - [x] Documentation is **not needed** for this change (explain why) This is a bug fix for a false-positive warning with no user-facing behaviour change. DNS resolution is unaffected. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Skip CGNAT overlay (100.64.0.0/10) addresses during startup probes to avoid false-positive DNS failures; skipping is logged and treated as passed. * Improve shutdown coordination and concurrency safety for probing and disabling to ensure clean stop behavior. * Aggregate probe errors and strengthen context-aware probing/cancellation for more reliable failure reporting. * **Tests** * Added comprehensive tests covering overlay detection and probing behavior across LAN, public, mixed, and overlay-only scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <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:07:16 -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#23470