]> granicus.if.org Git - pdns/commitdiff
Improve trace messages for auth and forward zones
authorPieter Lexis <pieter.lexis@powerdns.com>
Mon, 21 Mar 2016 16:45:46 +0000 (17:45 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 21 Mar 2016 21:59:59 +0000 (22:59 +0100)
pdns/syncres.cc

index caaf1058c9fb83ebccff60b9fcddd4bc3e7b930d..79665b64da589d99c6b8392c231d29f2ef77d262 100644 (file)
@@ -1169,22 +1169,6 @@ int SyncRes::doResolveAt(NsSet &nameservers, DNSName auth, bool flawedNSSet, con
           continue;
         }
 
-        // Check if we are authoritative for a zone in this answer
-        if (!t_sstorage->domainmap->empty()) {
-          DNSName tmp_qname(rec.d_name);
-          auto auth_domain_iter=getBestAuthZone(&tmp_qname);
-          if(auth_domain_iter!=t_sstorage->domainmap->end()) {
-            if (auth_domain_iter->first != auth) {
-              LOG("NO! - we are authoritative for the zone "<<auth_domain_iter->first.toString()<<endl);
-              continue;
-            } else {
-              // ugly...
-              LOG("YES! - This answer was either retrieved from the local auth store or from a server we forward to."<<endl);
-            }
-          }
-        }
-
-
         if(rec.d_name.isPartOf(auth)) {
           if(lwr.d_aabit && lwr.d_rcode==RCode::NoError && rec.d_place==DNSResourceRecord::ANSWER && g_delegationOnly.check(auth)) {
             LOG("NO! Is from delegation-only zone"<<endl);
@@ -1195,7 +1179,30 @@ int SyncRes::doResolveAt(NsSet &nameservers, DNSName auth, bool flawedNSSet, con
            LOG("RRSIG - separate"<<endl);
          }
           else {
-            LOG("YES!"<<endl);
+            bool haveLogged = false;
+            if (!t_sstorage->domainmap->empty()) {
+              // Check if we are authoritative for a zone in this answer
+              DNSName tmp_qname(rec.d_name);
+              auto auth_domain_iter=getBestAuthZone(&tmp_qname);
+              if(auth_domain_iter!=t_sstorage->domainmap->end()) {
+                if (auth_domain_iter->first != auth) {
+                  LOG("NO! - we are authoritative for the zone "<<auth_domain_iter->first.toString()<<endl);
+                  continue;
+                } else {
+                  LOG("YES! - This answer was ");
+                  if (nameservers[*tns].first.empty()) {
+                    LOG("retrieved from the local auth store.");
+                  } else {
+                    LOG("received from a server we forward to.");
+                  }
+                  haveLogged = true;
+                  LOG(endl);
+                }
+              }
+            }
+            if (!haveLogged) {
+              LOG("YES!"<<endl);
+            }
 
             rec.d_ttl=min(s_maxcachettl, rec.d_ttl);