Browse Source

[1576] added log messages for findNSEC3

JINMEI Tatuya 13 years ago
parent
commit
5eaa333fe3
2 changed files with 35 additions and 0 deletions
  1. 24 0
      src/lib/datasrc/datasrc_messages.mes
  2. 11 0
      src/lib/datasrc/memory_datasrc.cc

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

@@ -332,6 +332,30 @@ should be followed. The requested domain is an apex of some zone.
 % DATASRC_MEM_FIND find '%1/%2'
 Debug information. A search for the requested RRset is being started.
 
+% DATASRC_MEM_FINDNSEC3 finding NSEC3 for %1, mode %2
+Debug information. A search in an in-memory data source for NSEC3 that
+matches or covers the given name is being started.
+
+% DATASRC_MEM_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_MEM_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_MEM_FINDNSEC3_TRYHASH).
+The found NSEC3 RRset is also displayed.
+
+% DATASRC_MEM_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_MEM_FIND_ZONE looking for zone '%1'
 Debug information. A zone object for this zone is being searched for in the
 in-memory data source.

+ 11 - 0
src/lib/datasrc/memory_datasrc.cc

@@ -882,6 +882,9 @@ InMemoryZoneFinder::findAll(const Name& name,
 
 ZoneFinder::FindNSEC3Result
 InMemoryZoneFinder::findNSEC3(const Name& name, bool recursive) {
+    LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_FINDNSEC3).arg(name).
+        arg(recursive ? "recursive" : "non-recursive");
+
     if (!impl_->zone_data_->nsec3_data_) {
         isc_throw(DataSourceError,
                   "findNSEC3 attempt for non NSEC3 signed zone: " <<
@@ -914,6 +917,8 @@ InMemoryZoneFinder::findNSEC3(const Name& name, bool recursive) {
         const string hlabel = nsec3hash.calculate(
             labels == qlabels ? name : name.split(qlabels - labels, labels));
         NSEC3Map::const_iterator found = map.lower_bound(hlabel);
+        LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_FINDNSEC3_TRYHASH).
+            arg(name).arg(labels).arg(hlabel);
 
         // If the given hash is larger than the largest stored hash or
         // the first label doesn't match the target, identify the "previous"
@@ -932,10 +937,16 @@ InMemoryZoneFinder::findNSEC3(const Name& name, bool recursive) {
                 covering_proof = (--found)->second;
             }
             if (!recursive) {   // in non recursive mode, we are done.
+                LOG_DEBUG(logger, DBG_TRACE_BASIC,
+                          DATASRC_MEM_FINDNSEC3_COVER).
+                    arg(name).arg(*covering_proof);
                 return (FindNSEC3Result(false, labels, covering_proof,
                                         ConstRRsetPtr()));
             }
         } else {                // found an exact match.
+                LOG_DEBUG(logger, DBG_TRACE_BASIC,
+                          DATASRC_MEM_FINDNSEC3_MATCH).arg(name).arg(labels).
+                    arg(*found->second);
             return (FindNSEC3Result(true, labels, found->second,
                                     covering_proof));
         }