diff options
Diffstat (limited to 'core/dnsserver/server.go')
-rw-r--r-- | core/dnsserver/server.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/dnsserver/server.go b/core/dnsserver/server.go index dbc7bd5ce..2bbd8f8d3 100644 --- a/core/dnsserver/server.go +++ b/core/dnsserver/server.go @@ -197,7 +197,7 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) // The default dns.Mux checks the question section size, but we have our // own mux here. Check if we have a question section. If not drop them here. if r == nil || len(r.Question) == 0 { - DefaultErrorFunc(w, r, dns.RcodeServerFailure) + DefaultErrorFunc(ctx, w, r, dns.RcodeServerFailure) return } @@ -206,13 +206,13 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) // In case the user doesn't enable error plugin, we still // need to make sure that we stay alive up here if rec := recover(); rec != nil { - DefaultErrorFunc(w, r, dns.RcodeServerFailure) + DefaultErrorFunc(ctx, w, r, dns.RcodeServerFailure) } }() } if !s.classChaos && r.Question[0].Qclass != dns.ClassINET { - DefaultErrorFunc(w, r, dns.RcodeRefused) + DefaultErrorFunc(ctx, w, r, dns.RcodeRefused) return } @@ -223,7 +223,7 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ctx, err := incrementDepthAndCheck(ctx) if err != nil { - DefaultErrorFunc(w, r, dns.RcodeServerFailure) + DefaultErrorFunc(ctx, w, r, dns.RcodeServerFailure) return } @@ -254,7 +254,7 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) if h.FilterFunc == nil { rcode, _ := h.pluginChain.ServeDNS(ctx, w, r) if !plugin.ClientWrite(rcode) { - DefaultErrorFunc(w, r, rcode) + DefaultErrorFunc(ctx, w, r, rcode) } return } @@ -263,7 +263,7 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) if h.FilterFunc(q) { rcode, _ := h.pluginChain.ServeDNS(ctx, w, r) if !plugin.ClientWrite(rcode) { - DefaultErrorFunc(w, r, rcode) + DefaultErrorFunc(ctx, w, r, rcode) } return } @@ -285,7 +285,7 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) // DS request, and we found a zone, use the handler for the query. rcode, _ := dshandler.pluginChain.ServeDNS(ctx, w, r) if !plugin.ClientWrite(rcode) { - DefaultErrorFunc(w, r, rcode) + DefaultErrorFunc(ctx, w, r, rcode) } return } @@ -298,13 +298,13 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) rcode, _ := h.pluginChain.ServeDNS(ctx, w, r) if !plugin.ClientWrite(rcode) { - DefaultErrorFunc(w, r, rcode) + DefaultErrorFunc(ctx, w, r, rcode) } return } // Still here? Error out with REFUSED. - DefaultErrorFunc(w, r, dns.RcodeRefused) + DefaultErrorFunc(ctx, w, r, dns.RcodeRefused) } // OnStartupComplete lists the sites served by this server @@ -331,7 +331,7 @@ func (s *Server) Tracer() ot.Tracer { } // DefaultErrorFunc responds to an DNS request with an error. -func DefaultErrorFunc(w dns.ResponseWriter, r *dns.Msg, rc int) { +func DefaultErrorFunc(ctx context.Context, w dns.ResponseWriter, r *dns.Msg, rc int) { state := request.Request{W: w, Req: r} answer := new(dns.Msg) @@ -339,7 +339,7 @@ func DefaultErrorFunc(w dns.ResponseWriter, r *dns.Msg, rc int) { state.SizeAndDo(answer) - vars.Report(state, vars.Dropped, rcode.ToString(rc), answer.Len(), time.Now()) + vars.Report(ctx, state, vars.Dropped, rcode.ToString(rc), answer.Len(), time.Now()) w.WriteMsg(answer) } |