Commit Graph

1369 Commits

Author SHA1 Message Date
Ville Vesilehto
0dd76bd9b1 fix(transfer): goroutine leak on axfr err (#7516) 2025-09-05 13:13:11 -07:00
Ville Vesilehto
8c2cfb01e3 plugin/etcd: fix import order for ttl test (#7515) 2025-09-05 11:45:30 -07:00
Ville Vesilehto
e1768a5d27 Merge commit from fork
Instead of casting lease ID to uint32, fix the TTL() function
to use etcd time-to-live API for determining TTL. Add configurable
min-lease-ttl and max-lease-ttl options to prevent extreme TTL
values. By default, lease records now go through bounds checking
with 30s to 1d as the min/max.

Added unit tests for validation and docs.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-04 17:14:27 -07:00
Ville Vesilehto
066e51675c fix(grpc): check proxy list length in policies (#7512) 2025-09-03 16:24:44 -07:00
Ville Vesilehto
1ea6a7f682 fix(plugin): guard nil lookups across plugins (#7494) 2025-09-02 13:46:47 -07:00
Ville Vesilehto
ecdff70354 lint: add missing prealloc to backend lookup test (#7510) 2025-09-02 00:41:06 -07:00
Ville Vesilehto
21176fbf1a fix(grpc): span leak on error attempt (#7487) 2025-09-01 18:09:51 -07:00
Ville Vesilehto
5424d9dc58 test(plugin): improve backend lookup coverage (#7496) 2025-09-01 18:06:31 -07:00
Ville Vesilehto
359632a2f4 lint: enable prealloc (#7493) 2025-09-01 18:05:15 -07:00
Ville Vesilehto
4d3061a9c4 lint: enable durationcheck (#7492) 2025-09-01 18:04:35 -07:00
Ilya Kulakov
89fb5058d6 plugin: Use %w to wrap user error (#7489) 2025-08-29 05:27:11 -07:00
Ville Vesilehto
5a6700c39c fix(metrics): add timeouts to metrics HTTP server (#7469)
Add ReadTimeout, WriteTimeout, and IdleTimeout (5s each) to metrics HTTP
server and test to verify timeout behavior prevents hanging connections.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-28 20:03:55 -07:00
Ville Vesilehto
2f981ff797 fix(forward): use netip package for parsing (#7472)
Replace manual host:port parsing using net.SplitHostPort +
strconv.ParseUint with the standard library net/netip function
ParseAddrPort. This eliminates integer conversion warnings and
improves type safety.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-25 13:06:44 -07:00
Ville Vesilehto
f4ab4d9ed5 test(plugin): improve test coverage for pprof (#7473)
Add tests for Startup/Shutdown methods and HTTP endpoints.
Enhance setup tests with edge cases. Increases test coverage
from 58% to 100%.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-25 13:06:19 -07:00
wencyu
2c99f62acb plugin/file: fix label offset problem in ClosestEncloser (#7465)
Signed-off-by: yuwenchao <ywc689@163.com>
2025-08-20 16:02:41 -07:00
Ville Vesilehto
2b273d48ab feat(trace): migrate dd-trace-go v1 to v2 (#7466)
- Upgrade dd-trace-go dependency to v2.2.2
- Separate Zipkin and DataDog code paths for better maintainability
- Add proper tracer shutdown through OnShutdown()
- Replace deprecated opentracer.New() with direct tracer.Start()
- Added tests

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-20 16:00:21 -07:00
Qasim Sarfraz
712a5050bd plugin/header: Remove deprecated syntax (#7436)
Signed-off-by: Qasim Sarfraz <qasimsarfraz@microsoft.com>
2025-08-08 15:38:41 -07:00
Olli Janatuinen
52639bc66c plugin/loadbalance: support prefer option (#7433)
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2025-08-05 11:34:38 -07:00
Guillaume Jacquet
1025a199e9 Properly create hostname from IPv6 (#7431)
Generate valid hostname from IPv6 when the address ends with `::`.

Signed-off-by: Guillaume Jacquet <guillaume.jacquet@gmail.com>
2025-08-04 16:53:40 -07:00
harshith-2411-2002
6ba43927b6 fix: handle cached connection closure in forward plugin (#7427) 2025-07-28 12:06:26 -07:00
houpo-bob
2c2b075eaa refactor: use slices.Equal to simplify code (#7426) 2025-07-28 12:04:53 -07:00
Syed Azeez
1981f22170 plugin/test: fix TXT record comparison for multi-chunk vs multiple records (#7413) 2025-07-15 05:11:25 -07:00
dependabot[bot]
d5932041f7 build(deps): bump github.com/miekg/dns from 1.1.66 to 1.1.67 (#7406)
* build(deps): bump github.com/miekg/dns from 1.1.66 to 1.1.67

Bumps [github.com/miekg/dns](https://github.com/miekg/dns) from 1.1.66 to 1.1.67.
- [Changelog](https://github.com/miekg/dns/blob/master/Makefile.release)
- [Commits](https://github.com/miekg/dns/compare/v1.1.66...v1.1.67)

---
updated-dependencies:
- dependency-name: github.com/miekg/dns
  dependency-version: 1.1.67
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix build failure

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yong Tang <yong.tang.github@outlook.com>
2025-07-14 22:48:29 -07:00
Syed Azeez
d8906ce610 plugin/file: preserve case in SRV record names and targets per RFC 6763 (#7402) 2025-07-14 18:56:59 -07:00
Cameron Steel
0aee758833 fix(auto/file): return REFUSED when no next plugin is available (#7381) 2025-07-04 02:39:19 -07:00
Stephen Kitt
1449cb660e Port to AWS Go SDK v2 (#6588) 2025-07-03 02:19:21 -07:00
Sebastian Mayr
ae5e03a94d fix(cache): data race when refreshing cached messages (#7398) 2025-07-02 19:39:46 -07:00
Sebastian Mayr
06da7dcd98 fix(cache): data race when updating the TTL of cached messages (#7397) 2025-07-02 19:20:47 -07:00
Dennis Simmons
b2a2a5f648 plugin/rewrite: Add EDNS0 Unset Action (#7380)
* plugin/rewrite: EDNS0 unset action

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>

* plugin/rewrite: EDNS0 unset tests

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>

* plugin/rewrite: EDNS0 unset documentation

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>

* gofmt whitespace fixes

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>

* plugin/rewrite: improve edns0 test coverage

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>

---------

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>
2025-06-19 17:49:37 -04:00
Dave Brown
ab74d3acf2 add args: startup_timeout for kubernetes plugin (#7068)
Signed-off-by: mangoyhuang <mangoyhuang@tencent.com>
Co-authored-by: mangoyhuang <mangoyhuang@tencent.com>
2025-06-11 11:22:07 -07:00
Oleg Guba
27273a3a26 [plugin/cache] create a copy of a response to ensure original data is never modified (#7357)
Signed-off-by: Oleg Guba <oleg.guba@gmail.com>
2025-06-06 05:14:41 -07:00
blakebarnett
6cba588951 Add support for fallthrough to the grpc plugin (#7359)
Fixes: https://github.com/coredns/coredns/issues/7358

Signed-off-by: Blake Barnett <bbarnett@groq.com>
2025-06-06 04:58:17 -07:00
Ben Kochie
83afff1fec view: Add IPv6 example match (#7355)
Add an IPv6 source address matching example to the view plugin.

Fixes: https://github.com/coredns/coredns/issues/7354

Signed-off-by: SuperQ <superq@gmail.com>
2025-06-05 18:20:24 +02:00
Matthieu MOREL
186e4a1dbb chore: enable early-return and superfluous-else from revive (#7129)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-05 10:10:58 +03:00
Ville Vesilehto
ddb74cdcf4 test(plugin): improve tests for auto (#7348) 2025-06-04 14:37:52 -07:00
Ville Vesilehto
11774d9e98 fix(proxy): flaky dial tests (#7349) 2025-06-04 14:36:59 -07:00
Ville Vesilehto
9f9aed31cf test: add t.Helper() calls to test helper functions (#7351) 2025-06-04 14:36:04 -07:00
Ville Vesilehto
b4abdcacf0 fix(kubernetes): multicluster DNS race condition (#7350) 2025-06-04 06:31:41 +03:00
Ville Vesilehto
8cac83dfb5 lint: enable wastedassign linter (#7340) 2025-06-01 16:30:41 -07:00
Ville Vesilehto
bb33ab5301 test(plugin): add tests for any (#7341) 2025-06-01 16:30:01 -07:00
Ville Vesilehto
53e9681a39 lint: enable protogetter linter (#7336)
Enable protogetter in golangci config and update all protobuf field
access to use getter methods instead of direct field access.
Getter methods provide safer nil pointer handling and return
appropriate default values, following protobuf best practices.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-30 15:29:32 -07:00
Ville Vesilehto
a61d8b3143 lint: enable nolintlint linter (#7332) 2025-05-29 07:19:04 +03:00
Ville Vesilehto
384fa3285e fix: missing intrange lint fix (#7333)
Missed in #7323

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-29 04:41:27 +03:00
Ville Vesilehto
60227bd8d2 perf(kubernetes): optimize AutoPath slice allocation (#7323)
Pre-allocate slice capacity in AutoPath to eliminate unnecessary
memory reallocations. This avoids slice growth when appending
search domains and sentinel value.

Benchmark shows significant performance improvement:
- Before: 538.6 ns/op, 560 B/op, 13 allocs/op
- After:  436.8 ns/op, 336 B/op, 11 allocs/op
- Result: 19% faster, 40% less memory, 15% fewer allocations

The optimization benefits Kubernetes clusters using autopath for
server-side search path completion.

Adds benchmark test to measure AutoPath performance.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-28 17:58:01 -07:00
Ville Vesilehto
19a6ae4983 lint: enable intrange linter (#7331)
Enable intrange linter to enforce modern Go range syntax over
traditional for loops, by converting:

for i := 0; i < n; i++

to:

for i := range n

Adding type conversions where needed for compatibility
with existing uint64 parameters.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-28 17:50:55 -07:00
vdbe
b3acbe5046 feat(plugin/file): fallthrough (#7327)
* feat(plugin/file): fallthrough

implement and test fallthrough for the file plugin

Signed-off-by: vdbe <vdbewout@gmail.com>

* docs(plugin/file): fallthrough

Signed-off-by: vdbe <vdbewout@gmail.com>

* docs(plugin/file): regenerate man page

`make -f Makefile.doc man/coredns-file.7`

Signed-off-by: vdbe <vdbewout@gmail.com>

---------

Signed-off-by: vdbe <vdbewout@gmail.com>
2025-05-28 17:34:16 -07:00
Ville Vesilehto
bebb7bce43 lint: enable canonicalheader linter (#7330)
Enable canonicalheader linter to enforce proper HTTP header casing.
This ensures headers use Go's canonical format (e.g., "Content-Type"
instead of "content-type") for consistency.

Fixes header casing in DoH implementation.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-28 17:33:07 -07:00
Ville Vesilehto
0a48523083 fix(proxy): avoid Dial hang after Transport stopped (#7321)
Ensure Dial exits early or returns error when Transport has been
stopped, instead of blocking on the dial or ret channels. This removes
a potential goroutine leak where callers could pile up waiting
forever under heavy load.

Add select guards before send and receive, and propagate clear error
values so callers can handle shutdown gracefully.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-28 06:58:48 -07:00
Ville Vesilehto
8cd0c63595 test(plugin): add tests for pkg/rand (#7320)
Add test suite covering thread-safe random number generator with
tests for:

- Constructor with various seed values (positive, zero, negative)
- Deterministic behavior verification with same seeds
- Permutation generation and validation
- Concurrent access safety with multiple goroutines
- Mixed operations under concurrent load

Also clarify package documentation to explicitly state this is
for load balancing and server selection, not cryptographic use.
The math/rand usage is intentional for performance in non-security
contexts like upstream server selection and DNS record shuffling.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-27 17:49:13 -07:00
Ville Vesilehto
7bd43af427 fix: loop variable capture and linter (#7328)
Enable copyloopvar linter and remove redundant variable
shadowing in Kubernetes plugin metadata handling. This pattern is
no longer needed in Go 1.22+ where loop variables are automatically
captured correctly in closures.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-05-27 14:44:20 -07:00