BIND 10 trac2218_2, updated. f802f3ba317e49c1c1d16134855eb1b3c1aaeec8 [2218] Change DomainTreeNodeChain::getLevelCount()'s return type to size_t
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Sep 21 04:11:48 UTC 2012
The branch, trac2218_2 has been updated
via f802f3ba317e49c1c1d16134855eb1b3c1aaeec8 (commit)
via 1b10623a2bdc55e002defbd36eeba3f0d6f9d656 (commit)
via fa04b8777b196e3094f8b351c7f3d1ebf56fdd7e (commit)
via 3ef4699944709ab91f856396c76b90f3c97df3ac (commit)
from 950c72ccede294b7692bb7bdb20ef1bc28c3cc76 (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 f802f3ba317e49c1c1d16134855eb1b3c1aaeec8
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Sep 21 09:41:03 2012 +0530
[2218] Change DomainTreeNodeChain::getLevelCount()'s return type to size_t
... so that it's unsigned. Also rename node_count_ to level_count_
to avoid confusion with DomainTree::node_count_.
commit 1b10623a2bdc55e002defbd36eeba3f0d6f9d656
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Sep 21 09:39:25 2012 +0530
[2218] Change DomainTree::getNodeCount()'s return type to size_t
... so that it's unsigned.
commit fa04b8777b196e3094f8b351c7f3d1ebf56fdd7e
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Sep 21 09:29:55 2012 +0530
[2218] Fix comment
commit 3ef4699944709ab91f856396c76b90f3c97df3ac
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Sep 21 09:28:21 2012 +0530
[2218] Check that the NSEC3 tree has nodes before performing findNSEC3()
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory/domaintree.h | 30 +++++++++++++++---------------
src/lib/datasrc/memory/zone_finder.cc | 16 ++++++++++------
2 files changed, 25 insertions(+), 21 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/domaintree.h b/src/lib/datasrc/memory/domaintree.h
index c0b74eb..5d98d48 100644
--- a/src/lib/datasrc/memory/domaintree.h
+++ b/src/lib/datasrc/memory/domaintree.h
@@ -710,7 +710,7 @@ public:
/// The default constructor.
///
/// \exception None
- DomainTreeNodeChain() : node_count_(0), last_compared_(NULL),
+ DomainTreeNodeChain() : level_count_(0), last_compared_(NULL),
// XXX: meaningless initial values:
last_comparison_(0, 0,
isc::dns::NameComparisonResult::EQUAL)
@@ -729,7 +729,7 @@ public:
///
/// \exception None
void clear() {
- node_count_ = 0;
+ level_count_ = 0;
last_compared_ = NULL;
}
@@ -770,7 +770,7 @@ public:
/// chain, 0 will be returned.
///
/// \exception None
- unsigned int getLevelCount() const { return (node_count_); }
+ size_t getLevelCount() const { return (level_count_); }
/// \brief return the absolute name for the node which this
/// \c DomainTreeNodeChain currently refers to.
@@ -788,11 +788,11 @@ public:
const DomainTreeNode<T>* top_node = top();
isc::dns::Name absolute_name = top_node->getName();
- int node_count = node_count_ - 1;
- while (node_count > 0) {
- top_node = nodes_[node_count - 1];
+ size_t level = level_count_ - 1;
+ while (level > 0) {
+ top_node = nodes_[level - 1];
absolute_name = absolute_name.concatenate(top_node->getName());
- --node_count;
+ --level;
}
return (absolute_name);
}
@@ -806,7 +806,7 @@ private:
/// \brief return whether node chain has node in it.
///
/// \exception None
- bool isEmpty() const { return (node_count_ == 0); }
+ bool isEmpty() const { return (level_count_ == 0); }
/// \brief return the top node for the node chain
///
@@ -816,7 +816,7 @@ private:
/// \exception None
const DomainTreeNode<T>* top() const {
assert(!isEmpty());
- return (nodes_[node_count_ - 1]);
+ return (nodes_[level_count_ - 1]);
}
/// \brief pop the top node from the node chain
@@ -827,7 +827,7 @@ private:
/// \exception None
void pop() {
assert(!isEmpty());
- --node_count_;
+ --level_count_;
}
/// \brief add the node into the node chain
@@ -838,8 +838,8 @@ private:
///
/// \exception None
void push(const DomainTreeNode<T>* node) {
- assert(node_count_ < RBT_MAX_LEVEL);
- nodes_[node_count_++] = node;
+ assert(level_count_ < RBT_MAX_LEVEL);
+ nodes_[level_count_++] = node;
}
private:
@@ -848,7 +848,7 @@ private:
// it's also equal to the possible maximum level.
const static int RBT_MAX_LEVEL = isc::dns::Name::MAX_LABELS;
- int node_count_;
+ size_t level_count_;
const DomainTreeNode<T>* nodes_[RBT_MAX_LEVEL];
const DomainTreeNode<T>* last_compared_;
isc::dns::NameComparisonResult last_comparison_;
@@ -1308,7 +1308,7 @@ public:
/// It includes nodes internally created as a result of adding a domain
/// name that is a subdomain of an existing node of the tree.
/// This function is mainly intended to be used for debugging.
- int getNodeCount() const { return (node_count_); }
+ size_t getNodeCount() const { return (node_count_); }
/// \name Debug function
//@{
@@ -1441,7 +1441,7 @@ private:
typename DomainTreeNode<T>::DomainTreeNodePtr root_;
/// the node count of current tree
- unsigned int node_count_;
+ size_t node_count_;
/// search policy for domaintree
const bool needsReturnEmptyNode_;
};
diff --git a/src/lib/datasrc/memory/zone_finder.cc b/src/lib/datasrc/memory/zone_finder.cc
index a91ffe5..a778159 100644
--- a/src/lib/datasrc/memory/zone_finder.cc
+++ b/src/lib/datasrc/memory/zone_finder.cc
@@ -645,6 +645,14 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) {
getOrigin() << "/" << getClass());
}
+ const NSEC3Data* nsec3_data = zone_data_.getNSEC3Data();
+ const ZoneTree& tree = nsec3_data->getNSEC3Tree();
+ if (tree.getNodeCount() == 0) {
+ isc_throw(DataSourceError,
+ "findNSEC3 attempt but zone has no NSEC3 RR: " <<
+ getOrigin() << "/" << getClass());
+ }
+
const NameComparisonResult cmp_result = name.compare(getOrigin());
if (cmp_result.getRelation() != NameComparisonResult::EQUAL &&
cmp_result.getRelation() != NameComparisonResult::SUBDOMAIN) {
@@ -656,12 +664,10 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) {
// Convenient shortcuts
const unsigned int olabels = getOrigin().getLabelCount();
const unsigned int qlabels = name.getLabelCount();
- const NSEC3Data* nsec3_data = zone_data_.getNSEC3Data();
// placeholder of the next closer proof
const ZoneNode* covering_node(NULL);
- const ZoneTree& tree = nsec3_data->getNSEC3Tree();
ZoneChain chain;
// Examine all names from the query name to the origin name, stripping
@@ -717,12 +723,10 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) {
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 (((last_cmp.getOrder() < 0) && (previous_node == NULL)) ||
((last_cmp.getOrder() > 0) && (next_node == NULL))) {
+ // If the given hash is larger or smaller than everything,
+ // the covering proof is the NSEC3 that has the largest hash.
covering_node = last_node->getLargestInSubTree();
} else {
// Otherwise, H(found_entry-1) < given_hash < H(found_entry).
More information about the bind10-changes
mailing list