[PR #6453] [MERGED] [client] Reduce false-positive DNS health warnings #29550

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6453
Author: @lixmal
Created: 6/17/2026
Status: Merged
Merged: 6/19/2026
Merged by: @lixmal

Base: mainHead: dns-health-grace-window


📝 Commits (1)

  • 37fc0d9 Treat answering upstreams as reachable and widen DNS health grace window

📊 Changes

4 files changed (+133 additions, -7 deletions)

View changed files

📝 client/internal/dns/server.go (+29 -4)
📝 client/internal/dns/server_test.go (+26 -0)
📝 client/internal/dns/upstream.go (+6 -3)
📝 client/internal/dns/upstream_test.go (+72 -0)

📄 Description

Describe your changes

Reduces false-positive "Unable to reach one or more DNS servers" warnings introduced by the passive DNS health model in 0.71. A nameserver group was being marked unreachable on outcomes that don't actually indicate a connectivity problem.

  • Treat an upstream that answers with SERVFAIL or REFUSED as reachable, since those are per-question outcomes (DNSSEC-bogus names, refused zones, transient recursion errors) rather than reachability failures. Failover for a better answer still happens, but the upstream is no longer marked unhealthy. Only timeouts and non-responses count as unreachable.
  • Double the base grace window before a "nameserver group unreachable" warning fires, giving slow peer connections more time to establish before a routed nameserver is reported down.
  • Add the NB_DNS_HEALTH_WARNING_DELAY environment variable to override the grace window base (Go duration string; invalid or non-positive values fall back to the default).

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)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See CONTRIBUTING.md.

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)

NB_DNS_HEALTH_WARNING_DELAY is an internal diagnostic tuning knob with a sensible default; the behavior change otherwise only affects health-warning sensitivity.

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

Release Notes

  • New Features

    • DNS health warning grace window is now configurable via an environment variable (default: 60 seconds).
  • Bug Fixes

    • Improved upstream DNS health tracking so SERVFAIL and REFUSED responses are treated as reachable (updating “last ok” without marking failures), while true transport timeouts still reflect unreachable behavior.
  • Tests

    • Added coverage for warning delay configuration.
    • Added coverage for upstream resolver health tracking behavior.

🔄 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/6453 **Author:** [@lixmal](https://github.com/lixmal) **Created:** 6/17/2026 **Status:** ✅ Merged **Merged:** 6/19/2026 **Merged by:** [@lixmal](https://github.com/lixmal) **Base:** `main` ← **Head:** `dns-health-grace-window` --- ### 📝 Commits (1) - [`37fc0d9`](https://github.com/netbirdio/netbird/commit/37fc0d91d23d13474852351f821335270265563a) Treat answering upstreams as reachable and widen DNS health grace window ### 📊 Changes **4 files changed** (+133 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/dns/server.go` (+29 -4) 📝 `client/internal/dns/server_test.go` (+26 -0) 📝 `client/internal/dns/upstream.go` (+6 -3) 📝 `client/internal/dns/upstream_test.go` (+72 -0) </details> ### 📄 Description ## Describe your changes Reduces false-positive "Unable to reach one or more DNS servers" warnings introduced by the passive DNS health model in 0.71. A nameserver group was being marked unreachable on outcomes that don't actually indicate a connectivity problem. - Treat an upstream that answers with SERVFAIL or REFUSED as reachable, since those are per-question outcomes (DNSSEC-bogus names, refused zones, transient recursion errors) rather than reachability failures. Failover for a better answer still happens, but the upstream is no longer marked unhealthy. Only timeouts and non-responses count as unreachable. - Double the base grace window before a "nameserver group unreachable" warning fires, giving slow peer connections more time to establish before a routed nameserver is reported down. - Add the `NB_DNS_HEALTH_WARNING_DELAY` environment variable to override the grace window base (Go duration string; invalid or non-positive values fall back to the default). ## Issue ticket number and link ## 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) - [ ] This change does **not** modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — **OR** I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See [CONTRIBUTING.md](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#discuss-changes-with-the-netbird-team-first). > 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) `NB_DNS_HEALTH_WARNING_DELAY` is an internal diagnostic tuning knob with a sensible default; the behavior change otherwise only affects health-warning sensitivity. ### 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 ## Release Notes * **New Features** * DNS health warning grace window is now configurable via an environment variable (default: 60 seconds). * **Bug Fixes** * Improved upstream DNS health tracking so `SERVFAIL` and `REFUSED` responses are treated as reachable (updating “last ok” without marking failures), while true transport timeouts still reflect unreachable behavior. * **Tests** * Added coverage for warning delay configuration. * Added coverage for upstream resolver health tracking behavior. <!-- 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 08:08:17 -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#29550