@@ -3,7 +3,6 @@ package bdns
33import (
44 "context"
55 "crypto/tls"
6- "encoding/base64"
76 "errors"
87 "fmt"
98 "io"
@@ -48,10 +47,9 @@ type impl struct {
4847 clk clock.Clock
4948 log blog.Logger
5049
51- queryTime * prometheus.HistogramVec
52- totalLookupTime * prometheus.HistogramVec
53- timeoutCounter * prometheus.CounterVec
54- idMismatchCounter * prometheus.CounterVec
50+ queryTime * prometheus.HistogramVec
51+ totalLookupTime * prometheus.HistogramVec
52+ timeoutCounter * prometheus.CounterVec
5553}
5654
5755var _ Client = & impl {}
@@ -118,14 +116,6 @@ func New(
118116 },
119117 []string {"qtype" , "type" , "resolver" , "isTLD" },
120118 )
121- idMismatchCounter := prometheus .NewCounterVec (
122- prometheus.CounterOpts {
123- Name : "dns_id_mismatch" ,
124- Help : "Counter of DNS ErrId errors sliced by query type and resolver" ,
125- },
126- []string {"qtype" , "resolver" },
127- )
128- stats .MustRegister (queryTime , totalLookupTime , timeoutCounter , idMismatchCounter )
129119 return & impl {
130120 dnsClient : client ,
131121 servers : servers ,
@@ -135,7 +125,6 @@ func New(
135125 queryTime : queryTime ,
136126 totalLookupTime : totalLookupTime ,
137127 timeoutCounter : timeoutCounter ,
138- idMismatchCounter : idMismatchCounter ,
139128 log : log ,
140129 }
141130}
@@ -230,13 +219,11 @@ func (dnsClient *impl) exchangeOne(ctx context.Context, hostname string, qtype u
230219 result = dns .RcodeToString [rsp .Rcode ]
231220 }
232221 if err != nil {
233- logDNSError (dnsClient .log , chosenServer , hostname , m , rsp , err )
234- if err == dns .ErrId {
235- dnsClient .idMismatchCounter .With (prometheus.Labels {
236- "qtype" : qtypeStr ,
237- "resolver" : chosenServerIP ,
238- }).Inc ()
239- }
222+ dnsClient .log .Infof ("logDNSError chosenServer=[%s] hostname=[%s] queryType=[%s] err=[%s]" ,
223+ chosenServer ,
224+ hostname ,
225+ qtypeStr ,
226+ err )
240227 }
241228 dnsClient .queryTime .With (prometheus.Labels {
242229 "qtype" : qtypeStr ,
@@ -469,68 +456,6 @@ func (dnsClient *impl) LookupCAA(ctx context.Context, hostname string) ([]*dns.C
469456 return CAAs , response , ResolverAddrs {resolver }, nil
470457}
471458
472- // logDNSError logs the provided err result from making a query for hostname to
473- // the chosenServer. If the err is a `dns.ErrId` instance then the Base64
474- // encoded bytes of the query (and if not-nil, the response) in wire format
475- // is logged as well. This function is called from exchangeOne only for the case
476- // where an error occurs querying a hostname that indicates a problem between
477- // the VA and the chosenServer.
478- func logDNSError (
479- logger blog.Logger ,
480- chosenServer string ,
481- hostname string ,
482- msg , resp * dns.Msg ,
483- underlying error ) {
484- // We don't expect logDNSError to be called with a nil msg or err but
485- // if it happens return early. We allow resp to be nil.
486- if msg == nil || len (msg .Question ) == 0 || underlying == nil {
487- return
488- }
489- queryType := dns .TypeToString [msg .Question [0 ].Qtype ]
490-
491- // If the error indicates there was a query/response ID mismatch then we want
492- // to log more detail.
493- if underlying == dns .ErrId {
494- packedMsgBytes , err := msg .Pack ()
495- if err != nil {
496- logger .Errf ("logDNSError failed to pack msg: %v" , err )
497- return
498- }
499- encodedMsg := base64 .StdEncoding .EncodeToString (packedMsgBytes )
500-
501- var encodedResp string
502- var respQname string
503- if resp != nil {
504- packedRespBytes , err := resp .Pack ()
505- if err != nil {
506- logger .Errf ("logDNSError failed to pack resp: %v" , err )
507- return
508- }
509- encodedResp = base64 .StdEncoding .EncodeToString (packedRespBytes )
510- if len (resp .Answer ) > 0 && resp .Answer [0 ].Header () != nil {
511- respQname = resp .Answer [0 ].Header ().Name
512- }
513- }
514-
515- logger .Infof (
516- "logDNSError ID mismatch chosenServer=[%s] hostname=[%s] respHostname=[%s] queryType=[%s] msg=[%s] resp=[%s] err=[%s]" ,
517- chosenServer ,
518- hostname ,
519- respQname ,
520- queryType ,
521- encodedMsg ,
522- encodedResp ,
523- underlying )
524- } else {
525- // Otherwise log a general DNS error
526- logger .Infof ("logDNSError chosenServer=[%s] hostname=[%s] queryType=[%s] err=[%s]" ,
527- chosenServer ,
528- hostname ,
529- queryType ,
530- underlying )
531- }
532- }
533-
534459type dohExchanger struct {
535460 clk clock.Clock
536461 hc http.Client
0 commit comments