fix(forward): prevent busy loop on connection err (#7704)

Fixes a bug in the forward plugin where an immediate connection
failure (e.g., TCP RST) could trigger an infinite busy loop. The
retry logic failed to increment the "fails" counter when a
connection error occurred, causing the loop condition to
remain permanently true. This patch fixes it and adds a
regression test.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
Ville Vesilehto
2025-11-23 02:36:15 +02:00
committed by GitHub
parent de010910e2
commit dc381f79e5
2 changed files with 62 additions and 0 deletions

View File

@@ -191,6 +191,7 @@ func (f *Forward) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
proxy.Healthcheck()
}
fails++
if fails < len(f.proxies) {
continue
}