[PR #6912] [client] Fall back to the handler chain for DNS route query types a peer cannot resolve #29231

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

Original Pull Request: https://github.com/netbirdio/netbird/pull/6912

State: open
Merged: No


Describe your changes

A DNS route forwarded every query type to its routing peer and returned whatever came back, so a record type the peer's forwarder cannot resolve failed hard instead of being answered elsewhere. Peers running a client that predates non-address record support answer NOTIMP for all of them, which breaks SRV-based service discovery through a route.

  • Ask the routing peer only for the record types a forwarder can resolve, and send the rest straight to the remaining DNS handlers
  • Fall back to those handlers as well when a peer reports it cannot resolve a type, so a route served by an older peer keeps working
  • Answer a routed name whose type we could not resolve with an empty NOERROR carrying no SOA, so it is not cacheable and cannot outlive the route, rather than an NXDOMAIN that would wipe out the addresses the route does serve or a REFUSED that would send the client looking for one
  • Record a deferred query and a rewritten verdict on the response log line, and report the rewrite to the client as an Extended DNS Error
  • Set the recursion-available bit on DNS forwarder replies

https://github.com/netbirdio/netbird/discussions/6881

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)

Restores the DNS resolution behaviour users already expect from a DNS route. No configuration, flags or user-facing options change.

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

  • New Features
    • Enhanced DNS interception and routing with qtype-based disposition and clearer handling of capability/probe failures.
    • Extended DNS Error (EDE) now includes richer, stable upstream and softened-negative details; EDNS0-aware behavior is improved and OPT is stripped when not advertised.
    • Forwarder responses now correctly report recursion availability, with typed, deterministic response annotations.
  • Bug Fixes
    • Prevented unsupported queries from incorrectly surfacing NXDOMAIN by downgrading softened negatives into empty NOERROR responses when appropriate.
    • Deferred queries now preserve the client’s original EDNS0/AD/OPT state, and authoritative downstream responses remain unchanged.
  • Tests
    • Added coverage for soft-negative behavior, recursion-available responses, and pristine deferred queries.
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/6912 **State:** open **Merged:** No --- ## Describe your changes A DNS route forwarded every query type to its routing peer and returned whatever came back, so a record type the peer's forwarder cannot resolve failed hard instead of being answered elsewhere. Peers running a client that predates non-address record support answer NOTIMP for all of them, which breaks SRV-based service discovery through a route. - Ask the routing peer only for the record types a forwarder can resolve, and send the rest straight to the remaining DNS handlers - Fall back to those handlers as well when a peer reports it cannot resolve a type, so a route served by an older peer keeps working - Answer a routed name whose type we could not resolve with an empty NOERROR carrying no SOA, so it is not cacheable and cannot outlive the route, rather than an NXDOMAIN that would wipe out the addresses the route does serve or a REFUSED that would send the client looking for one - Record a deferred query and a rewritten verdict on the response log line, and report the rewrite to the client as an Extended DNS Error - Set the recursion-available bit on DNS forwarder replies ## Issue ticket number and link https://github.com/netbirdio/netbird/discussions/6881 ## 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) - [x] 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) Restores the DNS resolution behaviour users already expect from a DNS route. No configuration, flags or user-facing options change. ### 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 * **New Features** * Enhanced DNS interception and routing with qtype-based disposition and clearer handling of capability/probe failures. * Extended DNS Error (EDE) now includes richer, stable upstream and softened-negative details; EDNS0-aware behavior is improved and OPT is stripped when not advertised. * Forwarder responses now correctly report recursion availability, with typed, deterministic response annotations. * **Bug Fixes** * Prevented unsupported queries from incorrectly surfacing NXDOMAIN by downgrading softened negatives into empty NOERROR responses when appropriate. * Deferred queries now preserve the client’s original EDNS0/AD/OPT state, and authoritative downstream responses remain unchanged. * **Tests** * Added coverage for soft-negative behavior, recursion-available responses, and pristine deferred queries. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
saavagebueno added the pull-request label 2026-08-05 08:07:43 -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#29231