BIND 10 trac2504, updated. 4a9ea530abdc7aff1f58f6c92c281e5ed35d6741 [2504] Fix getClosestNSEC() when tree.find() results in SUBDOMAIN

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Dec 6 10:29:55 UTC 2012


The branch, trac2504 has been updated
       via  4a9ea530abdc7aff1f58f6c92c281e5ed35d6741 (commit)
      from  cbf6d3808e596d35fc8c83a5f35e13dfb4c2449b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4a9ea530abdc7aff1f58f6c92c281e5ed35d6741
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Dec 6 15:58:25 2012 +0530

    [2504] Fix getClosestNSEC() when tree.find() results in SUBDOMAIN
    
    When tree.find() results in SUBDOMAIN, the node_path's top contains the
    previous node.  Calling previousNode() yet again will return its
    further previous node.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/memory/zone_finder.cc |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_finder.cc b/src/lib/datasrc/memory/zone_finder.cc
index 4240c21..7f57d8e 100644
--- a/src/lib/datasrc/memory/zone_finder.cc
+++ b/src/lib/datasrc/memory/zone_finder.cc
@@ -305,8 +305,16 @@ getClosestNSEC(const ZoneData& zone_data,
     }
 
     const ZoneNode* prev_node;
-    while ((prev_node = zone_data.getZoneTree().previousNode(node_path))
-           != NULL) {
+    if (node_path.getLastComparisonResult().getRelation() ==
+        NameComparisonResult::SUBDOMAIN) {
+         // In case the search ended as a sub-domain, the previous node
+         // is already at the top of node_path.
+         prev_node = node_path.getLastComparedNode();
+    } else {
+         prev_node = zone_data.getZoneTree().previousNode(node_path);
+    }
+
+    while (prev_node != NULL) {
         if (!prev_node->isEmpty()) {
             const RdataSet* found =
                 RdataSet::find(prev_node->getData(), RRType::NSEC());
@@ -314,6 +322,7 @@ getClosestNSEC(const ZoneData& zone_data,
                 return (ConstNodeRRset(prev_node, found));
             }
         }
+        prev_node = zone_data.getZoneTree().previousNode(node_path);
     }
     // This must be impossible and should be an internal bug.
     // See the description at the method declaration.



More information about the bind10-changes mailing list