From: JINMEI Tatuya Date: Wed, 26 Sep 2012 00:57:47 +0000 (-0700) Subject: [2282] allow getAbsoluteLabels() to use the node's labelseq if it's absolute. X-Git-Tag: trac2351_base~37^2~1^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=00bbd50bb77e798708891f177003ad1d01bf9dbe;p=thirdparty%2Fkea.git [2282] allow getAbsoluteLabels() to use the node's labelseq if it's absolute. this will help the case where it's the zone origin. the additional handling often needs the origin's label sequence. --- diff --git a/src/lib/datasrc/memory/domaintree.h b/src/lib/datasrc/memory/domaintree.h index c0b74ebb47..24599de2b6 100644 --- a/src/lib/datasrc/memory/domaintree.h +++ b/src/lib/datasrc/memory/domaintree.h @@ -593,7 +593,17 @@ isc::dns::LabelSequence DomainTreeNode::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* upper = getUpperNode(); while (upper != NULL) { result.extend(upper->getLabels(), buf);