]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2750] Check that sub-tree roots have the flag set
authorMukund Sivaraman <muks@isc.org>
Fri, 6 Sep 2013 05:58:33 +0000 (11:28 +0530)
committerMukund Sivaraman <muks@isc.org>
Fri, 6 Sep 2013 05:58:33 +0000 (11:28 +0530)
This did not matter during the remove() so far, but in the future
we may not call exchange() even for some cases of non-leaf nodes.

src/lib/datasrc/memory/domaintree.h

index 7d5bc0e5424ca19dd68a9be1551cb819d46f439c..22f30b7367919d065c38ac077fcda2828d61dd5d 100644 (file)
@@ -2950,6 +2950,15 @@ DomainTree<T>::checkPropertiesHelper(const DomainTreeNode<T>* node) const {
         }
     }
 
+    // If node is assigned to the down_ pointer of its parent, it is a
+    // subtree root and must have the flag set.
+    if (node->getParent() &&
+        (node->getParent()->getDown() == node) &&
+        (!node->isSubTreeRoot()))
+    {
+        return (false);
+    }
+
     // Repeat tests with this node's children.
     return (checkPropertiesHelper(node->getLeft()) &&
             checkPropertiesHelper(node->getRight()) &&