Browse Source

[1577] Logging for findNSEC3

Michal 'vorner' Vaner 13 years ago
parent
commit
7130e28820
2 changed files with 43 additions and 1 deletions
  1. 14 1
      src/lib/datasrc/database.cc
  2. 29 0
      src/lib/datasrc/datasrc_messages.mes

+ 14 - 1
src/lib/datasrc/database.cc

@@ -941,7 +941,9 @@ DatabaseClient::Finder::findInternal(const Name& name, const RRType& type,
 
 
 ZoneFinder::FindNSEC3Result
 ZoneFinder::FindNSEC3Result
 DatabaseClient::Finder::findNSEC3(const Name& name, bool recursive) {
 DatabaseClient::Finder::findNSEC3(const Name& name, bool recursive) {
-    // TODO: Some logging.
+    LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_DATABASE_FINDNSEC3).arg(name).
+        arg(recursive ? "recursive" : "non-recursive");
+
 
 
     // First, validate the input
     // First, validate the input
     const NameComparisonResult cmp_result(name.compare(getOrigin()));
     const NameComparisonResult cmp_result(name.compare(getOrigin()));
@@ -980,6 +982,8 @@ DatabaseClient::Finder::findNSEC3(const Name& name, bool recursive) {
         const string hash(calculator->calculate(labels == qlabels ? name :
         const string hash(calculator->calculate(labels == qlabels ? name :
                                                 name.split(qlabels - labels,
                                                 name.split(qlabels - labels,
                                                            labels)));
                                                            labels)));
+        LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_DATABASE_FINDNSEC3_TRYHASH).
+            arg(name).arg(labels).arg(hash);
 
 
         DatabaseAccessor::IteratorContextPtr
         DatabaseAccessor::IteratorContextPtr
             context(accessor_->getNSEC3Records(hash, zone_id_));
             context(accessor_->getNSEC3Records(hash, zone_id_));
@@ -999,10 +1003,16 @@ DatabaseClient::Finder::findNSEC3(const Name& name, bool recursive) {
                           "exists, but no NSEC3 there");
                           "exists, but no NSEC3 there");
             }
             }
 
 
+            LOG_DEBUG(logger, DBG_TRACE_BASIC,
+                      DATASRC_DATABASE_FINDNSEC3_MATCH).arg(name).arg(labels).
+                arg(*it->second);
             return (FindNSEC3Result(true, labels, it->second, covering_proof));
             return (FindNSEC3Result(true, labels, it->second, covering_proof));
         } else {
         } else {
             const string prevHash(accessor_->findPreviousNSEC3Hash(zone_id_,
             const string prevHash(accessor_->findPreviousNSEC3Hash(zone_id_,
                                                                    hash));
                                                                    hash));
+            LOG_DEBUG(logger, DBG_TRACE_BASIC,
+                      DATASRC_DATABASE_FINDNSEC3_TRYHASH_PREV).arg(name).
+                arg(labels).arg(prevHash);
             context = accessor_->getNSEC3Records(prevHash, zone_id_);
             context = accessor_->getNSEC3Records(prevHash, zone_id_);
             const FoundRRsets prev_nsec3(getRRsets(prevHash + "." + otext,
             const FoundRRsets prev_nsec3(getRRsets(prevHash + "." + otext,
                                                    NSEC3_TYPES(), false, NULL,
                                                    NSEC3_TYPES(), false, NULL,
@@ -1021,6 +1031,9 @@ DatabaseClient::Finder::findNSEC3(const Name& name, bool recursive) {
 
 
             covering_proof = prev_it->second;
             covering_proof = prev_it->second;
             if (!recursive) {
             if (!recursive) {
+                LOG_DEBUG(logger, DBG_TRACE_BASIC,
+                          DATASRC_DATABASE_FINDNSEC3_COVER).arg(name).
+                    arg(labels).arg(*covering_proof);
                 return (FindNSEC3Result(false, labels, covering_proof,
                 return (FindNSEC3Result(false, labels, covering_proof,
                                         ConstRRsetPtr()));
                                         ConstRRsetPtr()));
             }
             }

+ 29 - 0
src/lib/datasrc/datasrc_messages.mes

@@ -75,6 +75,35 @@ The datasource tried to provide an NSEC proof that the named domain does not
 exist, but the database backend doesn't support DNSSEC. No proof is included
 exist, but the database backend doesn't support DNSSEC. No proof is included
 in the answer as a result.
 in the answer as a result.
 
 
+% DATASRC_DATABASE_FINDNSEC3 Looking for NSEC3 for %1 in % mode
+Debug information. A search in an database data source for NSEC3 that
+matches or covers the given name is being started.
+
+% DATASRC_DATABASE_FINDNSEC3_COVER found a covering NSEC3 for %1: %2
+Debug information. An NSEC3 that covers the given name is found and
+being returned.  The found NSEC3 RRset is also displayed.
+
+% DATASRC_DATABASE_FINDNSEC3_MATCH found a matching NSEC3 for %1 at label count %2: %3
+Debug information. An NSEC3 that matches (a possibly superdomain of)
+the given name is found and being returned.  When the shown label
+count is smaller than that of the given name, the matching NSEC3 is
+for a superdomain of the given name (see DATASRC_DATABSE_FINDNSEC3_TRYHASH).
+The found NSEC3 RRset is also displayed.
+
+% DATASRC_DATABASE_FINDNSEC3_TRYHASH looking for NSEC3 for %1 at label count %2 (hash %3)
+Debug information. In an attempt of finding an NSEC3 for the give name,
+(a possibly superdomain of) the name is hashed and searched for in the
+NSEC3 name space.  When the shown label count is smaller than that of the
+shown name, the search tries the superdomain name that share the shown
+(higher) label count of the shown name (e.g., for
+www.example.com. with shown label count of 3, example.com. is being
+tried).
+
+% DATASRC_DATABASE_FINDNSEC3_TRYHASH_PREV looking for previous NSEC3 for %1 at label count %2 (hash %3)
+Debug information. An exact match on hash (see
+DATASRC_DATABASE_FINDNSEC3_TRYHASH) was unsuccessful. We get the previous hash
+to that one instead.
+
 % DATASRC_DATABASE_FIND_RECORDS looking in datasource %1 for record %2/%3/%4
 % DATASRC_DATABASE_FIND_RECORDS looking in datasource %1 for record %2/%3/%4
 Debug information. The database data source is looking up records with the given
 Debug information. The database data source is looking up records with the given
 name and type in the database.
 name and type in the database.