]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2282] allow getAbsoluteLabels() to use the node's labelseq if it's absolute.
authorJINMEI Tatuya <jinmei@isc.org>
Wed, 26 Sep 2012 00:57:47 +0000 (17:57 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Wed, 26 Sep 2012 00:57:47 +0000 (17:57 -0700)
this will help the case where it's the zone origin.  the additional
handling often needs the origin's label sequence.

src/lib/datasrc/memory/domaintree.h

index c0b74ebb47399dec711d077c4886f159c2402915..24599de2b618c22b0af58d380213190a7f044e53 100644 (file)
@@ -593,7 +593,17 @@ isc::dns::LabelSequence
 DomainTreeNode<T>::getAbsoluteLabels(
     uint8_t buf[isc::dns::LabelSequence::MAX_SERIALIZED_LENGTH]) const
 {
-    isc::dns::LabelSequence result(getLabels(), buf);
+    // If the current node already has absolute labels, just return it.
+    // This should normally be the case for the origin node if this tree
+    // is used to represent a single DNS zone.
+    const isc::dns::LabelSequence cur_labels(getLabels());
+    if (cur_labels.isAbsolute()) {
+        return (cur_labels);
+    }
+
+    // Otherwise, build the absolute sequence traversing the tree of tree
+    // toward the top root.
+    isc::dns::LabelSequence result(cur_labels, buf);
     const DomainTreeNode<T>* upper = getUpperNode();
     while (upper != NULL) {
         result.extend(upper->getLabels(), buf);