]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] reduce EDNS logging noise
authorEvan Hunt <each@isc.org>
Wed, 30 Apr 2014 00:06:19 +0000 (17:06 -0700)
committerEvan Hunt <each@isc.org>
Wed, 30 Apr 2014 00:06:19 +0000 (17:06 -0700)
3831. [cleanup] Reduce logging noise when EDNS state changes occur.
[RT #35843]

CHANGES
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index fc2d1f50188846d9654a9ea09df48a1e5c86cabb..9248edd7a7683fc8bc94f22802d67ceb52b48e75 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3831.  [cleanup]       Reduce logging noise when EDNS state changes occur.
+                       [RT #35843]
+
 3830.  [func]          When query logging is enabled, log query errors at
                        the same level ('info') as the queries themselves.
                        [RT #35844]
index cb05e69c2cd4941af17d522ae2bdc38298f9933f..debfc7eb92bddc52b4134e58449787810d06234d 100644 (file)
@@ -7330,18 +7330,18 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
             message->rcode == dns_rcode_refused ||
             message->rcode == dns_rcode_yxdomain) &&
             bad_edns(fctx, &query->addrinfo->sockaddr)) {
-/*
- * XXXMPA  We need to drop/remove the logging here when we have more
- * experience.
- */
-               char buf[4096], addrbuf[ISC_SOCKADDR_FORMATSIZE];
-               isc_sockaddr_format(&query->addrinfo->sockaddr, addrbuf,
-                                   sizeof(addrbuf));
-               snprintf(buf, sizeof(buf), "received packet from %s "
-                        "(bad edns):\n", addrbuf);
-               dns_message_logpacket(message, buf,
-                             DNS_LOGCATEGORY_RESOLVER, DNS_LOGMODULE_RESOLVER,
-                             ISC_LOG_NOTICE, fctx->res->mctx);
+               if (isc_log_wouldlog(dns_lctx, ISC_LOG_DEBUG(3))) {
+                       char buf[4096], addrbuf[ISC_SOCKADDR_FORMATSIZE];
+                       isc_sockaddr_format(&query->addrinfo->sockaddr,
+                                           addrbuf, sizeof(addrbuf));
+                       snprintf(buf, sizeof(buf),
+                                "received packet from %s (bad edns):\n",
+                                addrbuf);
+                       dns_message_logpacket(message, buf,
+                                     DNS_LOGCATEGORY_RESOLVER,
+                                     DNS_LOGMODULE_RESOLVER,
+                                     ISC_LOG_DEBUG(3), fctx->res->mctx);
+               }
                dns_adb_changeflags(fctx->adb, query->addrinfo,
                                    DNS_FETCHOPT_NOEDNS0,
                                    DNS_FETCHOPT_NOEDNS0);
@@ -7349,29 +7349,29 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
                   (message->rcode == dns_rcode_noerror ||
                    message->rcode == dns_rcode_nxdomain) &&
                   (query->options & DNS_FETCHOPT_NOEDNS0) == 0) {
-               /*
-                * Old versions of named incorrectly drop the OPT record
-                * when there is a signed, truncated response so check that
-                * TC is not set.
-                */
-/*
- * XXXMPA  We need to drop/remove the logging here when we have more
- * experience.
- */
-               char buf[4096], addrbuf[ISC_SOCKADDR_FORMATSIZE];
                /*
                 * We didn't get a OPT record in response to a EDNS query.
+                *
+                * Old versions of named incorrectly drop the OPT record
+                * when there is a signed, truncated response so we check
+                * that TC is not set.
+                *
                 * Record that the server is not talking EDNS.  While this
                 * should be safe to do for any rcode we limit it to NOERROR
                 * and NXDOMAIN.
                 */
-               isc_sockaddr_format(&query->addrinfo->sockaddr, addrbuf,
-                                   sizeof(addrbuf));
-               snprintf(buf, sizeof(buf), "received packet from %s (no opt):\n",
-                        addrbuf);
-               dns_message_logpacket(message, buf,
-                             DNS_LOGCATEGORY_RESOLVER, DNS_LOGMODULE_RESOLVER,
-                             ISC_LOG_NOTICE, fctx->res->mctx);
+               if (isc_log_wouldlog(dns_lctx, ISC_LOG_DEBUG(3))) {
+                       char buf[4096], addrbuf[ISC_SOCKADDR_FORMATSIZE];
+                       isc_sockaddr_format(&query->addrinfo->sockaddr,
+                                           addrbuf, sizeof(addrbuf));
+                       snprintf(buf, sizeof(buf),
+                                "received packet from %s (no opt):\n",
+                                addrbuf);
+                       dns_message_logpacket(message, buf,
+                                     DNS_LOGCATEGORY_RESOLVER,
+                                     DNS_LOGMODULE_RESOLVER,
+                                     ISC_LOG_DEBUG(3), fctx->res->mctx);
+               }
                dns_adb_changeflags(fctx->adb, query->addrinfo,
                                    DNS_FETCHOPT_NOEDNS0,
                                    DNS_FETCHOPT_NOEDNS0);