]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2218] Work inside the subtree under the origin's node only
authorMukund Sivaraman <muks@isc.org>
Wed, 19 Sep 2012 07:29:57 +0000 (12:59 +0530)
committerMukund Sivaraman <muks@isc.org>
Wed, 19 Sep 2012 07:29:57 +0000 (12:59 +0530)
src/lib/datasrc/memory/zone_finder.cc

index 52b4ff6cbbdf5cbc719e1794fba51adb36b97396..9221c911b6f75f7a8b0cf1edca1732fbc79724e4 100644 (file)
@@ -699,19 +699,21 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) {
 
             return (FindNSEC3Result(true, labels, closest, next));
         } else {
-            const NameComparisonResult& cmp = chain.getLastComparisonResult();
-            assert(cmp.getOrder() != 0);
+            const NameComparisonResult& last_cmp =
+                chain.getLastComparisonResult();
+            const ZoneNode* last_node = chain.getLastComparedNode();
+            assert(last_cmp.getOrder() != 0);
 
-            // find() finished in between these two:
-            const ZoneNode* previous_node = tree.previousNode(chain);
-            const ZoneNode* next_node = tree.nextNode(chain);
+            // find() finished in between one of these and last_node:
+            const ZoneNode* previous_node = last_node->predecessor();
+            const ZoneNode* next_node = last_node->successor();
 
             // If the given hash is larger than the largest stored hash or
             // the first label doesn't match the target, identify the "previous"
             // hash value and remember it as the candidate next closer proof.
-            if (((cmp.getOrder() < 0) && (previous_node == NULL)) ||
-                ((cmp.getOrder() > 0) && (next_node == NULL))) {
-                covering_node = tree.getLargestNode();
+            if (((last_cmp.getOrder() < 0) && (previous_node == NULL)) ||
+                ((last_cmp.getOrder() > 0) && (next_node == NULL))) {
+                covering_node = last_node->getLargestInSubTree();
             } else {
                 // Otherwise, H(found_entry-1) < given_hash < H(found_entry).
                 // The covering proof is the first one (and it's valid