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>
This commit is contained in:
Yong Tang
2026-07-19 03:48:00 -07:00
committed by GitHub
parent 57f73b4a43
commit 96ec17d5c6
3 changed files with 70 additions and 8 deletions

View File

@@ -206,6 +206,10 @@ func (f *Forward) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
upstreamErr = err
if err != nil {
if errors.Is(err, proxyPkg.ErrInvalidRequest) {
return dns.RcodeFormatError, err
}
// Kick off health check to see if *our* upstream is broken.
if f.maxfails != 0 {
proxy.Healthcheck()