Commit Graph

1587 Commits

Author SHA1 Message Date
rpb-ant
c2ca1b2c23 plugin/kubernetes: Add support for topology-aware headless services via "az-pinned" subdomains (#8388) 2026-08-10 13:24:50 -07:00
Michael Wolf
c7e5424e7c Support IPv6 service endpoints in trace plugin (#8410)
Use net.JoinHostPort rather than string concatenation to support
both ipv4, ipv6, and hostname service endpoints for the trace
plugin. Previously, ipv6 bind addresses in the coredns configuration
would fail to be parsed, as the ipv6 address was not surrounded in
brackets.

Signed-off-by: Michael Wolf <mwolf@cloudflare.com>

Closes #8409

Co-authored-by: Michael Wolf <mwolf@cloudflare.com>
2026-08-05 21:10:34 -07:00
Manuel Rüger
19cd5fe0c3 plugin/hosts: pre-convert Origins to plugin.Zones in setup (#8383)
* test: add benchmark cases for Request IP/Port and parseRequest

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* test(kubernetes): add BenchmarkServices and BenchmarkServicesHeadless

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* perf(hosts): pre-convert Origins to plugin.Zones in hosts setup

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* style: fix gofmt trailing line formatting

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

---------

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2026-08-03 18:50:45 -07:00
Saleh
097ef7ef91 plugin/file: run additional processing for CNAME/DNAME answers (#8337)
externalLookup, which resolves the chase for ordinary CNAME, wildcard
CNAME, and DNAME answers, returned a nil additional section. So a chased
SRV/MX/SVCB/HTTPS answer with an in-bailiwick target was missing the
target's A/AAAA glue, unlike the direct path.

Run additionalProcessing at externalLookup's return points so all three
callers add the glue, and add ordinary-CNAME, wildcard-CNAME, and DNAME
regression cases.

Fixes #6628

Signed-off-by: Saleh <root@lr0.org>
2026-08-03 18:49:50 -07:00
houyuwushang
0fa6c66797 plugin/forward: cap default connect attempts (#8365)
Default to two connect attempts per configured upstream so fast failures cannot spin until the request deadline. Track whether max_connect_attempts was explicitly configured so zero still opts into the legacy unbounded behavior.

Fixes #7723

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
2026-08-03 18:49:29 -07:00
Yash Singh
dc1e3a96ad kubernetes: add tests for endpoint/service-import equivalence checks (#8368)
Signed-off-by: yashsingh74 <yashsingh1774@gmail.com>
2026-08-03 18:49:05 -07:00
Karan V
aeaadc0f8c plugin/kubernetes: skip zone serial bump on DNS neutral pod updates (#8338)
* plugin/kubernetes: skip zone serial bump on DNS neutral pod updates

In pods verified mode every pod update event bumped the zone modified
timestamp, even when the pod IP did not change. Pod records only depend
on the pod IP, so routine status churn (conditions, container statuses,
labels) caused spurious SOA serial changes and needless zone transfer
activity, even though pod records are not part of transfers at all.

Only bump the modified timestamp when the pod IP changes, mirroring how
service and endpoint updates are already filtered. Also update the pods
verified documentation to describe the actual overhead: modest memory
for a stripped down pod object, plus watch load on the API server.

Ref #8043

Signed-off-by: Karan V <karanvknarayanan@gmail.com>

* plugin/kubernetes: keep pods verified cost description neutral

Avoid characterizing the memory overhead as modest until benchmark
data quantifies it. State only what the code does: the watch requires
additional memory in CoreDNS and adds load to the API server.

Signed-off-by: Karan V <karanvknarayanan@gmail.com>

---------

Signed-off-by: Karan V <karanvknarayanan@gmail.com>
2026-08-03 18:46:10 -07:00
Manuel Rüger
53ad30a268 plugin/kubernetes: pre-allocate search path slice capacity in AutoPath (#8381)
* test: add benchmark cases for Request IP/Port and parseRequest

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* perf(kubernetes): optimize AutoPath slice allocation and copy

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* perf(kubernetes): pre-allocate search path slice capacity in AutoPath

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

---------

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2026-08-03 18:45:17 -07:00
Manuel Rüger
a1642a64dc plugin/forward: fast-path string comparison in isAllowedDomain (#8385)
* test: add benchmark cases for Request IP/Port and parseRequest

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* test(kubernetes): add BenchmarkServices and BenchmarkServicesHeadless

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* perf(forward): fast-path string comparison in isAllowedDomain

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

---------

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2026-08-03 18:44:27 -07:00
houyuwushang
d74404f8ac plugin/file: handle empty non-terminal wildcard sources (#8386)
RFC 4592 permits a wildcard source of synthesis to exist as an empty non-terminal. Track wildcard names proven by descendant records and return NODATA when such a source is selected.

Fixes #4256

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
2026-08-03 18:37:38 -07:00
maximilize
9ddc4fdb8f plugin/rewrite: test EDNS0 revert with a record present and on the replace path (#8315)
Adds two regression tests for #8234 that the existing suite does not cover:

- an OPT-less upstream reply that carries a record, so the per-record
  response rules run while the request OPT is reused by ScrubWriter;
- a request that already carries the option, where "set ... revert" must
  put the client's original value back rather than just drop the option.

Both fail against the tree before #8235 and pass on current master.

Signed-off-by: maximilize <3752128+maximilize@users.noreply.github.com>
2026-08-03 18:13:46 -07:00
Pujitha Paladugu
4438f6d708 plugin/timeouts: add maxtcpqueries option to bound queries per TCP/TLS connection (#8376) 2026-08-03 16:16:43 -07:00
Yong Tang
3a52659cb8 plugin/file: Fixes multi-primary AXFR zone contamination (#8367)
This PR fixes multi-primary AXFR zone contamination. It
use a fresh candidate zone for each primary so records from failed transfers cannot leak into later.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2026-07-30 01:44:02 -07:00
Yong Tang
36515d9dce plugin/cache: Fix cache stale verification metadata race (#8366)
* plugin/cache: Fix cache stale verification metadata race

This PR fixes cache stale verification metadata race
which isolate background stale-refresh metadata from
the foreground request to prevent concurrent map writes and process crashes

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Address review comment

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

---------

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2026-07-30 01:25:50 -07:00
Nitin Nizhawan
e073d1c05b plugin/cache: do not cache SOA-less NODATA responses (#8232)
* plugin/cache: do not cache SOA-less NODATA responses

An upstream may return NOERROR with a non-empty answer that still does not
resolve the question and without an SOA record to bound a negative TTL: a
CNAME chain that does not terminate in a record of the queried type at the
chain's terminal name (an incomplete recursion result from a forwarder).
Because the answer section is non-empty, response.Typify classifies it as
NoError (positive), so the cache plugin stores it keyed on <qname,qtype> and
replays the non-answer to clients until the TTL expires.

Per RFC 2308 section 5, negative responses without an SOA record SHOULD NOT be
cached. Following RFC 1034 section 3.6.2 and RFC 2308 sections 1 and 2.2, the
effective owner name is the target at the end of the CNAME chain, and the
response is NODATA unless it carries the queried type at that terminal name;
this holds for every query type, not just A/AAAA. Skip caching such a response
(mirroring the existing NameError && !hasSOA guard) and let the next query be
resolved upstream again.

An empty answer section is deliberately left cacheable: it is indistinguishable
from a legitimate NOERROR positive response that carries its data outside the
answer section (for example the whoami plugin).

Refs coredns#6958, coredns#5077, coredns#4987.

Signed-off-by: Nitin Nizhawan <nitin.nizhawan@gmail.com>

* plugin/cache: fail closed on malformed CNAME chains in isNODATA

canonicalName now returns a validity flag and rejects chains that are not a
single unambiguous path to a terminal name: an owner with more than one
distinct CNAME target (RFC 2181 section 10.1) and a revisited owner / CNAME
loop (RFC 1034 section 3.6.2). isNODATA treats an invalid chain as a
non-answer, so a SOA-less response with such a chain is not cached. This makes
the classification order-independent (previously the first CNAME per owner
won, so a two-target owner was cacheable or not depending on wire order) and
closes the loop-with-co-located-record case. Duplicate CNAME records naming
the same target are still tolerated.

Adds regression tests for the two-distinct-targets case in both orders, the
CNAME loop with a co-located A, and the tolerated duplicate-identical-CNAME
case.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d59b4564-a9df-425f-858e-aadee0f35581
Signed-off-by: Nitin Nizhawan <nitin.nizhawan@gmail.com>

* plugin/cache: split canonicalName into self-documenting helpers

Extract the per-owner CNAME lookup into uniqueCNAMETarget and loop detection
into a small case-insensitive nameSet type, leaving canonicalName as a short
driver. Signature and algorithm are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d59b4564-a9df-425f-858e-aadee0f35581
Signed-off-by: Nitin Nizhawan <nitin.nizhawan@gmail.com>

---------

Signed-off-by: Nitin Nizhawan <nitin.nizhawan@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d59b4564-a9df-425f-858e-aadee0f35581
2026-07-29 20:39:49 -07:00
houyuwushang
546fac83ea plugin/tls: manage certificates with ACME DNS-01 (#8310)
* plugin/tls: add automatic ACME certificates

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>

* chore: add houyuwushang to CODEOWNERS

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>

* chore: regenerate maintainer owners

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>

---------

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
2026-07-29 19:24:22 -07:00
Manuel Rüger
03260d5b67 plugin/kubernetes: short-circuit matchPortAndProtocol and fast-path string match (#8344)
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2026-07-29 18:38:04 -07:00
Manuel Rüger
88c558ad7c plugin/kubernetes: preallocate slice capacities in controller query lookups (#8343)
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2026-07-29 18:25:44 -07:00
houyuwushang
c0adbae99b plugin/cache: preserve monotonic time for TTL expiry (#8346)
Keep cache timestamps and TTL calculations on the time values returned by the cache clock. Converting them with UTC strips Go's monotonic clock reading and can extend cached entries when the wall clock moves backward.

Add a regression test that verifies new cache items retain the original monotonic timestamp.

Fixes #5478.

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
2026-07-29 18:12:56 -07:00
houyuwushang
3c2c33bb50 plugin/file: return referrals after alias resolution (#8341)
Detect zone cuts while following CNAME and DNAME targets so partial answers carry the child NS and glue records instead of returning SERVFAIL or apex authority. Keep AA set for authoritative alias partial answers while clearing it for referral-only responses.

Fixes #6405
Fixes #6627

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
2026-07-29 18:12:07 -07:00
houyuwushang
73cd1efe5b plugin/secondary: support catalog migration and member scoping (#8288)
* plugin/secondary: support catalog zone ownership migration

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>

* plugin/secondary: scope catalog member zones

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>

---------

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
2026-07-29 18:11:36 -07:00
rpb-ant
76056dd2e5 plugin/shed: add UDP overload protection plugin (#8312)
* plugin/shed: add UDP overload protection plugin

UDP responses written back through one listener socket serialize on the
Go runtime's internal fdMutex, which allows at most 2^20-1 concurrent
operations per file descriptor and panics the process when exceeded.
CoreDNS serves UDP with one goroutine per query, all writing through the
shared packet connection, so a sustained overload parks every excess
in-flight query in that wait queue until the process dies with
"too many concurrent operations on a single file or socket". Observed
in production: ~2.8M goroutines and 60GiB RSS before the panic.

The shed plugin makes the panic structurally unreachable. It installs,
via Config.UDPDecorateWriterFunc, a per-socket bounded evict-oldest
stack drained newest-first by a single writer goroutine, so the fd
never sees more than one writer and residual capacity under overload
always goes to the freshest response. While a socket's stack is full,
arriving queries are dropped before any plugin runs. Drops are silent
(the client's resolver retries elsewhere) and counted in
coredns_shed_dropped_total{server, reason}.

plugin/shed/fdmutex_test.go demonstrates the failure and the fix with
one shared flood harness. Two subprocess tests reproduce the exact
runtime panic without the plugin's write discipline - one deterministic
(a held write plus >2^20 queued writers), one with nothing held or
mocked; both exercise the Go runtime rather than the plugin, so they
are gated behind SHED_FLOOD_TEST=1. The counterfactual - the same load
through the plugin's stack, completing with every response accounted
for as written or dropped - runs in every test invocation, including
-race, at 50k responders, and at the full 1.5M with SHED_FLOOD_TEST=1:

    SHED_FLOOD_TEST=1 go test ./plugin/shed/

Signed-off-by: Ryan Brewster <rpb@anthropic.com>

* test: add shed e2e test

Query a shed-enabled server over UDP (the plugin's deferred
single-writer path) and TCP (which shed passes through), and check
that coredns_shed_dropped_total is exported with its reason label.

No-Verification-Needed: test-only change
Signed-off-by: Ryan Brewster <rpb@anthropic.com>

---------

Signed-off-by: Ryan Brewster <rpb@anthropic.com>
2026-07-27 12:13:25 +03:00
Baltasar Blanco
989bf4a9fd plugin/file: resolve each additional section target only once (#8286)
* plugin/file: resolve each additional section target only once

additionalProcessing walked the answer and appended each target's address records without keeping track of the targets it had already resolved. An answer holding several records that point at one target, two MX records differing only in preference for instance, therefore repeated that target's A, AAAA and RRSIGs once per record. SRV, SVCB and HTTPS take the same path and behaved the same way. plugin/backend_lookup.go already skips targets it has seen; the file plugin never did.

Targets are compared in canonical form because SRV targets are not lowercased on insert, so one target can reach additional processing spelled two ways while the zone's tree still matches it case-insensitively. The map is allocated on first use, as additionalProcessing runs for every answer and most carry no target at all.

Fixes #6626

Signed-off-by: baltasarblanco <baltablanco9008@gmail.com>

* plugin/file: move additional section tests to lookup_test.go

The cases exercise additionalProcessing, which lives in lookup.go, so they belong with the rest of the lookup tests. No test logic is changed.

Addresses review feedback.

Signed-off-by: baltasarblanco <baltablanco9008@gmail.com>

---------

Signed-off-by: baltasarblanco <baltablanco9008@gmail.com>
2026-07-24 15:10:04 -07:00
llucas
73d1eacf87 plugin/forward: Add http(2) host/authority header and TO server resolution (#8233) 2026-07-22 19:07:09 -07:00
liucongran
56f7c09311 fix(rewrite): preserve original request during rewrites (#8235) 2026-07-22 19:06:29 -07:00
Yong Tang
e0a8eb8a46 Add max conn limit to https3 (#8187)
* Add max conn limit to https3

This PR adds max conn limit to https3, similiar to https

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add Test to cover change

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Address review feedback

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Update README and setup

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Update plugin/https3/README.md

Co-authored-by: Ville Vesilehto <ville@vesilehto.fi>
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

---------

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Co-authored-by: Ville Vesilehto <ville@vesilehto.fi>
2026-07-21 15:52:31 -07:00
Yong Tang
989a188d13 plugin/forward: Fix UDP forwarding so a malformed upstream datagram wont block valid ones later (#8287)
* plugin/plugin: Fix UDP forwarding so a malformed upstream datagram wont block valid ones later

This PR fixes UDP forwarding so a malformed upstream datagram
does not prevent CoreDNS from accepting a subsequent valid response
before the existing read deadline.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Address review and add additonal tests

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Cover branch

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

---------

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2026-07-21 15:21:25 -07:00
maximilize
d1a6ab0eb9 plugin/auto: fix inverted arguments in duplicate-origin warning (#8317)
The warning added in #8216 passed the skipped file where the kept file
belongs and vice versa, so it logged "using <skipped> instead of <kept>"
— the reverse of what Walk actually does. Swap the arguments (and use
cleanPath for both) so the message names the file that is being used.
Strengthen TestWalkWarnsForDuplicateOrigin to assert the direction; it
only checked that both names appeared, so the inversion passed before.

Signed-off-by: maximilize <3752128+maximilize@users.noreply.github.com>
2026-07-21 12:55:47 +03:00
Ville Vesilehto
0410236577 test(file): stabilize mtime reload (#8318)
Make mtime reload tests tolerate slow scheduling and coarse filesystem
timestamp resolution. This keeps immediate rewrites observable and
avoids checking zone contents before the reload completes.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2026-07-20 14:54:13 -07:00
houyuwushang
98bdb44f4d plugin/hosts: make unsupported type fallthrough opt-in (#8282) 2026-07-19 19:59:12 -07:00
Ville Vesilehto
077774e0cd ci: run plugin tests on Windows (#8314)
Plugin package tests previously ran only on Linux, so Windows-
specific failures were never caught. Run them in CI and make the
affected tests portable across platforms.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2026-07-19 03:52:23 -07:00
Yong Tang
96ec17d5c6 plugin/forward: Fix incorrect retry of local DNS message serialization failures (#8313)
This PR fixes the forward plugin incorrectly retrying deterministic
local DNS message serialization failures as if they were upstream transport errors.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2026-07-19 03:48:00 -07:00
Ville Vesilehto
c1fe47bc3a test(tls): make keylog path test portable (#8311)
Directory permission checks can be bypassed by privileged users and may
behave differently on filesystems with nonstandard permission semantics.

Make the bad-path case deterministic so TLS keylog tests remain portable
across supported environments.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2026-07-18 20:11:48 -07:00
Ncesam
e1f4d0cb90 plugin/rewrite: normalize exact cname rewrite targets and preserve all records (#8285)
Signed-off-by: ncesam <rybushkin09@bk.ru>
2026-07-15 18:06:03 -07:00
Ncesam
99b683aa41 plugin/transfer: collect all notify errors instead of shadowing (#8283)
* plugin/transfer: collect all notify errors instead of shadowing

Signed-off-by: ncesam <rybushkin09@bk.ru>

* plugin/transfer: add regression test for notify multiple failures

Signed-off-by: ncesam <rybushkin09@bk.ru>

---------

Signed-off-by: ncesam <rybushkin09@bk.ru>
2026-07-15 18:05:01 -07:00
Ville Vesilehto
530b0a5ff2 Merge commit from fork
DoH, DoQ, and DNS-over-gRPC unpack messages without the acceptance
checks used by UDP and TCP. An unauthenticated request with a large
QDCOUNT can therefore force excessive allocations while names are
decoded and exhaust server memory.

Enforce the same request policy across all server transports.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2026-07-15 17:54:46 -07:00
houyuwushang
7cd99da013 plugin/secondary: reset catalog members on ID change (#8281)
Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
2026-07-14 18:51:12 -07:00
Yong Tang
5131b8f944 plugin/proxyproto: Apply an explicitly configured default policy evenwhen no allow list is present. (#8278)
* plugin/proxyproto: Apply an explicitly configured default policy even when no allow list is present.

This PR fix the issue where explicitly configured default reject policy
is ignoreed when no allo list is present

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* golint fix

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

---------

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2026-07-13 17:34:30 -07:00
Yong Tang
e16e829181 plugin/forward: Fix issue in DoH health checks used a default TLS instead of the configured CA (#8279)
This PR fixes issue in forward plugin where default TLS instead of
configured CA was used.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2026-07-13 17:34:18 -07:00
Yong Tang
4ebf66a74e plugin/forward: Fix incorrect failover counter reset (#8277)
* plugin/forward: Fix incorrect failover counter reset

This PR fixes the isseue where resetting the failover counter caused
retry the same upstreams until timeout instead of stopping after one pass.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* golint fix

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

---------

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2026-07-13 17:34:06 -07:00
Yong Tang
e5053d50ad plugin/file: Fix panic on zero-valued SOA refresh (#8276)
This PR fixes panic with zero-valued SOA refresh

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2026-07-13 17:33:51 -07:00
Omkhar Arasaratnam
38e26f25c4 plugin/file: do not expand wildcard across a closer empty non-terminal (#8223)
A query for a name that sits below a closer empty non-terminal was wrongly
answered with a shallower wildcard record instead of NXDOMAIN. Per RFC 4592
2.2.1 a wildcard is the source of synthesis only when the wildcard owner's
parent is the closest encloser of the queried name; if an empty non-terminal
exists between that parent and the queried name, it is the closer encloser and
the shallower wildcard must not be expanded.

Guard the wildcard expansion in Zone.Lookup with closerENTExists, which walks
the strict ancestors of the queried name between the wildcard parent and the
name and reports whether any of them is an empty non-terminal.

Adds TestLookupWildcardRespectsCloserEmptyNonTerminal, which asserts NXDOMAIN
for a name below a closer empty non-terminal and keeps a no-regression case
where a plain wildcard with no closer empty non-terminal still applies.

Signed-off-by: Omkhar Arasaratnam <omkhar@linkedin.com>
Co-authored-by: Omkhar Arasaratnam <omkhar@linkedin.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 03:03:52 -07:00
Nikolaus Schuetz
af1e34ebc8 test: poll instead of fixed sleeps across several tests (#8275)
Several tests slept a fixed duration then took a single snapshot of an
async result, racing whatever they waited on:
- forward health tests waited 20ms for the health-check goroutine to bump
  an atomic counter,
- the auto plugin tests (dns + metrics) waited 50-110ms for a file-watch
  reload to be picked up,
- the file ZoneReload test waited 30ms (self-described as could still be
  racy) for a reload,
- the overloaded health test slept 1s for its background goroutine to fire
  its first request.

Replace each with a bounded poll of the actual condition (the atomic
counter, a dns.Exchange response, a metrics scrape, z.ApexIfDefined, or a
channel signalled by the test's own handler) so they pass as soon as the
awaited state is reached and no longer flake when it is slower than the
fixed wait. Test-only.

Signed-off-by: Nikolaus Schuetz <nikolauspschuetz@gmail.com>
2026-07-10 15:20:57 -07:00
houyuwushang
6ec70a0603 request/cache: bind responses and entries to QCLASS (#8272)
Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
2026-07-10 15:18:27 -07:00
Immanuel Tikhonov
5cab9853cd fix(auto): keep first matching zone file for duplicate origins (#8216)
Signed-off-by: immanuwell <pchpr.00@list.ru>
2026-07-09 17:43:07 -07:00
houyuwushang
1e01c0ad7c plugin/secondary: serve catalog member zones (#8230)
Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
2026-07-09 17:42:30 -07:00
Filippo125
e4990abfa3 feat(forward): add source_address directive (#8011)
* fix(dnssec): avoid caching empty signing results (#7996)

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* save only

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* do #8008

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Fix Address used if tcp

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Fix bad using of dialer type

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* core: Add full TSIG verification in gRPC transport (#8006)

* core: Add full TSIG verification in gRPC transport

This PR add full TSIG verification in gRPC using dns.TsigVerify() so invalid signatures and timestamps are correctly detected instead of only checking key presence.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Fix

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Fix

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

---------

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* core: Add full TSIG verification in QUIC transport (#8007)

* core: Add full TSIG verification in QUIC transport

This PR add full TSIG verification in QUIC using dns.TsigVerify()

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Fix

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

---------

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* fix(test): deduplicate TSIG test helpers (#8009)

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* fix(dnssec): return nil sigs on sign error (#7999)

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* fix(dnssec): return nil from ParseKeyFile on error (#8000)

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* fix(dnsserver): allow view server blocks in any declaration order (#8001)

When using the view plugin, filtered and unfiltered server blocks can
share the same zone and port. The zone overlap validation rejected this
configuration when the unfiltered block was not declared last, because
filtered configs treated an already-registered zone as an error.

Skip the 'already defined' check for configs that have filter functions,
since they are expected to coexist with an unfiltered catch-all block on
the same zone/port.

Fixes #7733

Signed-off-by: umut-polat <52835619+umut-polat@users.noreply.github.com>
Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* fix(doh): use per-connection local address for PROXY protocol (#8005)

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* fix(transfer): batch AXFR records by message size instead of count (#8002)

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* fix(tls): use temp dir for keylog test path (#8010)

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Rename local_address option to source_address

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Rename local_address also in readme
Add test

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Resolve change request in pr

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* fix ci lint

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Improve doc on source_address routing needs

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Remove added timeout

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* add use of source address also for health check query

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* remove untrailing newline from health_test.go

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* fix file format

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Update plugin/forward/setup_test.go

Co-authored-by: Ville Vesilehto <ville@vesilehto.fi>
Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Remove dead code in TestHealthLocalAddress

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Fix misspelling

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* Try to set default timeout

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

* fix format in health.go

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>

---------

Signed-off-by: Filippo <filippo.ferrazini@gmail.com>
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Signed-off-by: umut-polat <52835619+umut-polat@users.noreply.github.com>
Co-authored-by: Ville Vesilehto <ville@vesilehto.fi>
Co-authored-by: Yong Tang <yong.tang.github@outlook.com>
Co-authored-by: Umut Polat <52835619+umut-polat@users.noreply.github.com>
Co-authored-by: Cedric Wang <wangzongqi@msn.com>
2026-07-09 17:38:22 -07:00
Ilya Kulakov
540e2f325f plugin/tsig: don't echo client's TSIG.Error if verification is successful (#8215) 2026-07-09 15:04:23 -07:00
Ville Vesilehto
0ebe4da2b0 docs(timeouts): document DoQ read timeout (#8263) 2026-07-09 15:01:59 -07:00
Pavel Lazureykis
974d693e6f plugin/dnstap: fix self-deadlock in listener broadcast on client flush error (#8260)
listener.Dnstap holds clientsMu.RLock() while iterating connected sink
clients. In the flush-error branch it called removeClient(c) synchronously,
but removeClient takes clientsMu.Lock(). A sync.RWMutex is not reentrant, so
the goroutine blocks forever waiting to acquire the write lock it can never
get while holding the read lock. The queued Lock() then blocks every
subsequent Dnstap broadcast and close(), and the goroutine leaks.

A flush error is the normal failure mode for a slow or disconnected sink
client (writeMsg buffers into framestream and succeeds; flush does the real
socket write and fails), so a single misbehaving client wedged the whole
listen path. Because Dnstap runs inline in the request-serving goroutine via
TapMessageWithMetadata, this could cascade into stalled request handling.

The write-error branch one line up already offloaded with `go removeClient(c)`.
Do the same in the flush-error branch and drop the early return so the
broadcast still reaches the remaining clients.

Assisted-by: Claude Opus 4.8

Signed-off-by: Pavel Lazureykis <pavel@lazureykis.dev>
2026-07-09 20:43:35 +03:00