Return RcodeServerFailure when DNS64 has no next plugin (#6590)

If using a coredns config with only the dns64 plugin specified, the
`Next` plugin that dns64 will attempt to call will be nil, resulting in
a nil pointer dereference. We should return an error instead of
crashing.

Signed-off-by: Jared Baur <jaredbaur@fastmail.com>
This commit is contained in:
Jared Baur
2024-04-09 00:52:43 -07:00
committed by GitHub
parent 4db719ae35
commit 6706ee8419

View File

@@ -36,7 +36,7 @@ type DNS64 struct {
func (d *DNS64) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
// Don't proxy if we don't need to.
if !d.requestShouldIntercept(&request.Request{W: w, Req: r}) {
return d.Next.ServeDNS(ctx, w, r)
return plugin.NextOrFailure(d.Name(), d.Next, ctx, w, r)
}
// Pass the request to the next plugin in the chain, but intercept the response.