aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2022-02-10 08:58:46 -0500
committerGravatar GitHub <noreply@github.com> 2022-02-10 08:58:46 -0500
commitd6743531ad9005051a9375eda80949a40606d5d0 (patch)
tree120fbed3bc5748321966a3850289cd64af806add /plugin
parent4064430f81208284888363cc259ca16338067659 (diff)
downloadcoredns-d6743531ad9005051a9375eda80949a40606d5d0.tar.gz
coredns-d6743531ad9005051a9375eda80949a40606d5d0.tar.zst
coredns-d6743531ad9005051a9375eda80949a40606d5d0.zip
fix healthy proxy error case (#5168)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
Diffstat (limited to 'plugin')
-rw-r--r--plugin/grpc/grpc.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugin/grpc/grpc.go b/plugin/grpc/grpc.go
index 2ecf29597..c2911edd5 100644
--- a/plugin/grpc/grpc.go
+++ b/plugin/grpc/grpc.go
@@ -37,10 +37,10 @@ func (g *GRPC) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
}
var (
- span, child ot.Span
- ret *dns.Msg
- upstreamErr, err error
- i int
+ span, child ot.Span
+ ret *dns.Msg
+ err error
+ i int
)
span = ot.SpanFromContext(ctx)
list := g.list()
@@ -74,8 +74,6 @@ func (g *GRPC) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
child.Finish()
}
- upstreamErr = err
-
// Check if the reply is correct; if not return FormErr.
if !state.Match(ret) {
debug.Hexdumpf(ret, "Wrong reply for id: %d, %s %d", ret.Id, state.QName(), state.QType())
@@ -90,8 +88,10 @@ func (g *GRPC) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
return 0, nil
}
- if upstreamErr != nil {
- return dns.RcodeServerFailure, upstreamErr
+ // SERVFAIL if all healthy proxys returned errors.
+ if err != nil {
+ // just return the last error received
+ return dns.RcodeServerFailure, err
}
return dns.RcodeServerFailure, ErrNoHealthy