Skip to content

Conversation

Tugzrida
Copy link
Contributor

1. Why is this pull request needed and what does it do?

It is standard behaviour of authoritative DNS servers to return REFUSED when responding to a request they are not authoritative for. CoreDNS correctly follows this when responding to queries that don't match any server blocks, however when broader server blocks are present (such as a catch-all), queries not responded to by any plugin are typically responded to with SERVFAIL, as this is defined in plugin.NextOrFailure().

By itself, this is not really an issue, however as described in #7346, this causes CoreDNS to return SERVFAIL when resolving out-of-bailiwick CNAME targets, which breaks these CNAMEs.

While it is difficult to map the traditional authoritative/resolver framework onto CoreDNS, for the case of the auto and file plugins, they fall more on the authoritative side, particularly when they are the last plugin in the chain.

Therefore, this PR adds logic to the auto and file plugins that, when they are the last plugin, they return REFUSED for unrecognised names, instead of SERVFAIL.

2. Which issues (if any) are related?

fixes #7346

3. Which documentation changes (if any) need to be made?

None, this corrects the behaviour of the examples already in the auto documentation

4. Does this introduce a backward incompatible change or deprecation?

No

Tugzrida and others added 2 commits July 4, 2025 10:06
Signed-off-by: Cameron Steel <git@tugzrida.xyz>
Signed-off-by: Cameron Steel <git@tugzrida.xyz>
@Tugzrida Tugzrida force-pushed the fix-auto-refused branch from 68b4ba4 to 7b363cf Compare July 4, 2025 00:07
@Tugzrida
Copy link
Contributor Author

Tugzrida commented Jul 4, 2025

Apologies, I didn't realise the existence of the e2e tests. Those fails should be fixed now.

Copy link

codecov bot commented Jul 4, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 59.94%. Comparing base (93c57b6) to head (7b363cf).
Report is 1520 commits behind head on master.

Files with missing lines Patch % Lines
plugin/file/file.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7381      +/-   ##
==========================================
+ Coverage   55.70%   59.94%   +4.24%     
==========================================
  Files         224      273      +49     
  Lines       10016    18014    +7998     
==========================================
+ Hits         5579    10798    +5219     
- Misses       3978     6585    +2607     
- Partials      459      631     +172     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yongtang yongtang merged commit 0aee758 into coredns:master Jul 4, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

auto: Incorrect rcode returned when CNAME points to other zone - with proposed solutions
2 participants