mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
core: add nil check (#1005)
Check if msg is nil in DefaultErrorFunc. If this is the case log this and short cut the function. Hoping to get more insight in #925
This commit is contained in:
@@ -289,6 +289,12 @@ func DefaultErrorFunc(w dns.ResponseWriter, r *dns.Msg, rc int) {
|
|||||||
answer := new(dns.Msg)
|
answer := new(dns.Msg)
|
||||||
answer.SetRcode(r, rc)
|
answer.SetRcode(r, rc)
|
||||||
|
|
||||||
|
if r == nil {
|
||||||
|
log.Printf("[WARNING] DefaultErrorFunc called with nil *dns.Msg (Remote: %s)", w.RemoteAddr().String())
|
||||||
|
w.WriteMsg(answer)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
state.SizeAndDo(answer)
|
state.SizeAndDo(answer)
|
||||||
|
|
||||||
vars.Report(state, vars.Dropped, rcode.ToString(rc), answer.Len(), time.Now())
|
vars.Report(state, vars.Dropped, rcode.ToString(rc), answer.Len(), time.Now())
|
||||||
|
|||||||
Reference in New Issue
Block a user