From 6706ee84199337304d8bbc10ad570e0e045b3132 Mon Sep 17 00:00:00 2001 From: Jared Baur <45740526+jmbaur@users.noreply.github.com> Date: Tue, 9 Apr 2024 00:52:43 -0700 Subject: [PATCH] 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 --- plugin/dns64/dns64.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/dns64/dns64.go b/plugin/dns64/dns64.go index 9f426eb87..0a6176fcf 100644 --- a/plugin/dns64/dns64.go +++ b/plugin/dns64/dns64.go @@ -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.