Pārlūkot izejas kodu

Do not log connection info before the connection exists

If the resolver encounters an error before it attempts to forward the
request to external DNS, do not try to log information about the
external connection, because at this point `extConn` is `nil`. This
makes sure `dockerd` won't panic and crash from a nil pointer
dereference when it sees an invalid DNS query.

fixes #44979

Signed-off-by: er0k <er0k@er0k.net>
er0k 2 gadi atpakaļ
vecāks
revīzija
6c2637be11
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      libnetwork/resolver.go

+ 1 - 1
libnetwork/resolver.go

@@ -396,7 +396,7 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
 	}
 	}
 
 
 	if err != nil {
 	if err != nil {
-		logrus.WithError(err).Errorf("[resolver] failed to handle query: %s (%s) from %s", queryName, dns.TypeToString[queryType], extConn.LocalAddr().String())
+		logrus.WithError(err).Errorf("[resolver] failed to handle query: %s (%s)", queryName, dns.TypeToString[queryType])
 		return
 		return
 	}
 	}