fix healthy proxy error case (#5168)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
parent
4064430f81
commit
d6743531ad
1 changed files with 8 additions and 8 deletions
|
@ -37,10 +37,10 @@ func (g *GRPC) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
span, child ot.Span
|
span, child ot.Span
|
||||||
ret *dns.Msg
|
ret *dns.Msg
|
||||||
upstreamErr, err error
|
err error
|
||||||
i int
|
i int
|
||||||
)
|
)
|
||||||
span = ot.SpanFromContext(ctx)
|
span = ot.SpanFromContext(ctx)
|
||||||
list := g.list()
|
list := g.list()
|
||||||
|
@ -74,8 +74,6 @@ func (g *GRPC) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
|
||||||
child.Finish()
|
child.Finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
upstreamErr = err
|
|
||||||
|
|
||||||
// Check if the reply is correct; if not return FormErr.
|
// Check if the reply is correct; if not return FormErr.
|
||||||
if !state.Match(ret) {
|
if !state.Match(ret) {
|
||||||
debug.Hexdumpf(ret, "Wrong reply for id: %d, %s %d", ret.Id, state.QName(), state.QType())
|
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
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if upstreamErr != nil {
|
// SERVFAIL if all healthy proxys returned errors.
|
||||||
return dns.RcodeServerFailure, upstreamErr
|
if err != nil {
|
||||||
|
// just return the last error received
|
||||||
|
return dns.RcodeServerFailure, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return dns.RcodeServerFailure, ErrNoHealthy
|
return dns.RcodeServerFailure, ErrNoHealthy
|
||||||
|
|
Loading…
Add table
Reference in a new issue