BIND 10 master, updated. 26e55ce110123f7557732ecaeaaad4816cd0375b Merge branch 'master' into trac2276
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Oct 2 13:42:53 UTC 2012
The branch, master has been updated
via 26e55ce110123f7557732ecaeaaad4816cd0375b (commit)
via ae20aca3d9324f9439baaf692f42db76ab15912f (commit)
via 0f0501530b755d42670e7e8d9a044027c20e1f27 (commit)
via eff1c6bcb840aa9a8736c6c29a1eeb68eef30279 (commit)
via 92daff7ee6bbd0a41b9a993a1d5d2b151984233a (commit)
via 003b2878529f02062656b84187edb800bc292c35 (commit)
from b9b899343170f79cd26929245180180c850d5594 (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 26e55ce110123f7557732ecaeaaad4816cd0375b
Merge: ae20aca b9b8993
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Oct 2 19:06:11 2012 +0530
Merge branch 'master' into trac2276
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory/zone_finder.cc | 124 +++++++++++++++++----------------
src/lib/datasrc/memory/zone_finder.h | 2 +-
2 files changed, 66 insertions(+), 60 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_finder.cc b/src/lib/datasrc/memory/zone_finder.cc
index 9403c4f..c318f70 100644
--- a/src/lib/datasrc/memory/zone_finder.cc
+++ b/src/lib/datasrc/memory/zone_finder.cc
@@ -33,6 +33,8 @@
#include <algorithm>
#include <vector>
+#include <utility>
+
using namespace isc::dns;
using namespace isc::datasrc::memory;
using namespace isc::datasrc;
@@ -73,6 +75,17 @@ public:
using internal::ZoneFinderResultContext;
namespace {
+/// Conceptual RRset in the form of a pair of zone node and RdataSet.
+///
+/// In this implementation, the owner name of an RRset is derived from the
+/// corresponding zone node, and the rest of the attributes come from
+/// an RdataSet. This shortcut type can be used when we want to refer to
+/// the conceptual RRset without knowing these details.
+///
+/// This is a read-only version of the pair (and at the moment we don't need
+/// a mutable version).
+typedef std::pair<const ZoneNode*, const RdataSet*> ConstNodeRRset;
+
/// Creates a TreeNodeRRsetPtr for the given RdataSet at the given Node, for
/// the given RRClass
///
@@ -117,7 +130,7 @@ struct FindState {
FindState(bool glue_ok) :
zonecut_node_(NULL),
dname_node_(NULL),
- rrset_(NULL),
+ rdataset_(NULL),
glue_ok_(glue_ok)
{}
@@ -129,7 +142,7 @@ struct FindState {
const ZoneNode* dname_node_;
// Delegation RRset (NS or DNAME), if found.
- const RdataSet* rrset_;
+ const RdataSet* rdataset_;
// Whether to continue search below a delegation point.
// Set at construction time.
@@ -149,7 +162,7 @@ bool cutCallback(const ZoneNode& node, FindState* state) {
if (found_dname != NULL) {
LOG_DEBUG(logger, DBG_TRACE_DETAILED, DATASRC_MEM_DNAME_ENCOUNTERED);
state->dname_node_ = &node;
- state->rrset_ = found_dname;
+ state->rdataset_ = found_dname;
return (true);
}
@@ -171,7 +184,7 @@ bool cutCallback(const ZoneNode& node, FindState* state) {
// It cannot happen for us (at least for now), so we don't do
// that check.
state->zonecut_node_ = &node;
- state->rrset_ = found_ns;
+ state->rdataset_ = found_ns;
// Unless glue is allowed the search stops here, so we return
// false; otherwise return true to continue the search.
@@ -225,8 +238,8 @@ ZoneFinderResultContext
createFindResult(const RRClass& rrclass,
const ZoneData& zone_data,
ZoneFinder::Result code,
- const RdataSet* rdset,
const ZoneNode* node,
+ const RdataSet* rdataset,
ZoneFinder::FindOptions options,
bool wild = false,
const Name* qname = NULL)
@@ -247,10 +260,10 @@ createFindResult(const RRClass& rrclass,
}
}
- return (ZoneFinderResultContext(code, createTreeNodeRRset(node, rdset,
+ return (ZoneFinderResultContext(code, createTreeNodeRRset(node, rdataset,
rrclass, options,
rename),
- flags, zone_data, node, rdset));
+ flags, zone_data, node, rdataset));
}
// A helper function for NSEC-signed zones. It searches the zone for
@@ -272,16 +285,15 @@ createFindResult(const RRClass& rrclass,
// method doesn't bother to find NSEC, and simply returns NULL. So, by
// definition of "NSEC-signed", when it really tries to find an NSEC it
// should succeed; there should be one at least at the zone origin.
-const RdataSet*
+ConstNodeRRset
getClosestNSEC(const ZoneData& zone_data,
ZoneChain& node_path,
- const ZoneNode** nsec_node,
ZoneFinder::FindOptions options)
{
if (!zone_data.isSigned() ||
(options & ZoneFinder::FIND_DNSSEC) == 0 ||
zone_data.isNSEC3Signed()) {
- return (NULL);
+ return (ConstNodeRRset(NULL, NULL));
}
const ZoneNode* prev_node;
@@ -291,8 +303,7 @@ getClosestNSEC(const ZoneData& zone_data,
const RdataSet* found =
RdataSet::find(prev_node->getData(), RRType::NSEC());
if (found != NULL) {
- *nsec_node = prev_node;
- return (found);
+ return (ConstNodeRRset(prev_node, found));
}
}
}
@@ -301,7 +312,7 @@ getClosestNSEC(const ZoneData& zone_data,
assert(false);
// Even though there is an assert here, strict compilers
// will still need some return value.
- return (NULL);
+ return (ConstNodeRRset(NULL, NULL));
}
// A helper function for the NXRRSET case in find(). If the zone is
@@ -338,16 +349,16 @@ public:
FindNodeResult(ZoneFinder::Result code_param,
const ZoneNode* node_param,
- const RdataSet* rrset_param,
+ const RdataSet* rdataset_param,
unsigned int flags_param = 0) :
code(code_param),
node(node_param),
- rrset(rrset_param),
+ rdataset(rdataset_param),
flags(flags_param)
{}
const ZoneFinder::Result code;
const ZoneNode* node;
- const RdataSet* rrset;
+ const RdataSet* rdataset;
const unsigned int flags;
};
@@ -426,7 +437,7 @@ FindNodeResult findNode(const ZoneData& zone_data,
const unsigned int zonecut_flag =
(state.zonecut_node_ != NULL) ? FindNodeResult::FIND_ZONECUT : 0;
if (result == ZoneTree::EXACTMATCH) {
- return (FindNodeResult(ZoneFinder::SUCCESS, node, state.rrset_,
+ return (FindNodeResult(ZoneFinder::SUCCESS, node, state.rdataset_,
zonecut_flag));
} else if (result == ZoneTree::PARTIALMATCH) {
assert(node != NULL);
@@ -434,26 +445,23 @@ FindNodeResult findNode(const ZoneData& zone_data,
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_DNAME_FOUND).
arg(state.dname_node_->getName());
return (FindNodeResult(ZoneFinder::DNAME, state.dname_node_,
- state.rrset_));
+ state.rdataset_));
}
if (state.zonecut_node_ != NULL) { // DELEGATION due to NS
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_DELEG_FOUND).
arg(state.zonecut_node_->getName());
return (FindNodeResult(ZoneFinder::DELEGATION,
state.zonecut_node_,
- state.rrset_));
+ state.rdataset_));
}
if (node_path.getLastComparisonResult().getRelation() ==
NameComparisonResult::SUPERDOMAIN) { // empty node, so NXRRSET
LOG_DEBUG(logger, DBG_TRACE_DATA,
DATASRC_MEM_SUPER_STOP).arg(name_labels);
- const ZoneNode* nsec_node;
- const RdataSet* nsec_rds = getClosestNSEC(zone_data,
- node_path,
- &nsec_node,
- options);
- return (FindNodeResult(ZoneFinder::NXRRSET, nsec_node,
- nsec_rds));
+ ConstNodeRRset nsec_rrset = getClosestNSEC(zone_data, node_path,
+ options);
+ return (FindNodeResult(ZoneFinder::NXRRSET, nsec_rrset.first,
+ nsec_rrset.second));
}
// Nothing really matched.
@@ -468,13 +476,11 @@ FindNodeResult findNode(const ZoneData& zone_data,
// should cancel wildcard. Treat it as NXDOMAIN.
LOG_DEBUG(logger, DBG_TRACE_DATA,
DATASRC_MEM_WILDCARD_CANCEL).arg(name_labels);
- const ZoneNode* nsec_node;
- const RdataSet* nsec_rds = getClosestNSEC(zone_data,
- node_path,
- &nsec_node,
- options);
- return (FindNodeResult(ZoneFinder::NXDOMAIN, nsec_node,
- nsec_rds));
+ ConstNodeRRset nsec_rrset = getClosestNSEC(zone_data,
+ node_path,
+ options);
+ return (FindNodeResult(ZoneFinder::NXDOMAIN, nsec_rrset.first,
+ nsec_rrset.second));
}
uint8_t ls_buf[LabelSequence::MAX_SERIALIZED_LENGTH];
@@ -495,16 +501,16 @@ FindNodeResult findNode(const ZoneData& zone_data,
// Otherwise, why would the domain_flag::WILD be there if
// there was no wildcard under it?
assert(result == ZoneTree::EXACTMATCH);
- return (FindNodeResult(ZoneFinder::SUCCESS, node, state.rrset_,
+ return (FindNodeResult(ZoneFinder::SUCCESS, node, state.rdataset_,
FindNodeResult::FIND_WILDCARD | zonecut_flag));
}
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_NOT_FOUND).
arg(name_labels);
- const ZoneNode* nsec_node;
- const RdataSet* nsec_rds = getClosestNSEC(zone_data, node_path,
- &nsec_node, options);
- return (FindNodeResult(ZoneFinder::NXDOMAIN, nsec_node, nsec_rds));
+ ConstNodeRRset nsec_rrset = getClosestNSEC(zone_data, node_path,
+ options);
+ return (FindNodeResult(ZoneFinder::NXDOMAIN, nsec_rrset.first,
+ nsec_rrset.second));
} else {
// If the name is neither an exact or partial match, it is
// out of bailiwick, which is considered an error, unless the caller
@@ -689,8 +695,8 @@ InMemoryZoneFinder::find(const isc::dns::Name& name,
const FindOptions options)
{
return (ZoneFinderContextPtr(new Context(*this, options, rrclass_,
- find_internal(name, type,
- NULL, options))));
+ findInternal(name, type,
+ NULL, options))));
}
boost::shared_ptr<ZoneFinder::Context>
@@ -699,17 +705,17 @@ InMemoryZoneFinder::findAll(const isc::dns::Name& name,
const FindOptions options)
{
return (ZoneFinderContextPtr(new Context(*this, options, rrclass_,
- find_internal(name,
- RRType::ANY(),
- &target,
- options))));
+ findInternal(name,
+ RRType::ANY(),
+ &target,
+ options))));
}
ZoneFinderResultContext
-InMemoryZoneFinder::find_internal(const isc::dns::Name& name,
- const isc::dns::RRType& type,
- std::vector<ConstRRsetPtr>* target,
- const FindOptions options)
+InMemoryZoneFinder::findInternal(const isc::dns::Name& name,
+ const isc::dns::RRType& type,
+ std::vector<ConstRRsetPtr>* target,
+ const FindOptions options)
{
// Get the node. All other cases than an exact match are handled
// in findNode(). We simply construct a result structure and return.
@@ -718,7 +724,7 @@ InMemoryZoneFinder::find_internal(const isc::dns::Name& name,
findNode(zone_data_, LabelSequence(name), node_path, options);
if (node_result.code != SUCCESS) {
return (createFindResult(rrclass_, zone_data_, node_result.code,
- node_result.rrset, node_result.node,
+ node_result.node, node_result.rdataset,
options));
}
@@ -734,11 +740,11 @@ InMemoryZoneFinder::find_internal(const isc::dns::Name& name,
if (node->isEmpty()) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_DOMAIN_EMPTY).
arg(name);
- const ZoneNode* nsec_node;
- const RdataSet* nsec_rds = getClosestNSEC(zone_data_, node_path,
- &nsec_node, options);
+ ConstNodeRRset nsec_rrset = getClosestNSEC(zone_data_, node_path,
+ options);
return (createFindResult(rrclass_, zone_data_, NXRRSET,
- nsec_rds, nsec_node, options, wild));
+ nsec_rrset.first, nsec_rrset.second,
+ options, wild));
}
const RdataSet* found;
@@ -757,7 +763,7 @@ InMemoryZoneFinder::find_internal(const isc::dns::Name& name,
LOG_DEBUG(logger, DBG_TRACE_DATA,
DATASRC_MEM_EXACT_DELEGATION).arg(name);
return (createFindResult(rrclass_, zone_data_, DELEGATION,
- found, node, options, wild, &name));
+ node, found, options, wild, &name));
}
}
@@ -772,7 +778,7 @@ InMemoryZoneFinder::find_internal(const isc::dns::Name& name,
}
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_ANY_SUCCESS).
arg(name);
- return (createFindResult(rrclass_, zone_data_, SUCCESS, NULL, node,
+ return (createFindResult(rrclass_, zone_data_, SUCCESS, node, NULL,
options, wild, &name));
}
@@ -781,7 +787,7 @@ InMemoryZoneFinder::find_internal(const isc::dns::Name& name,
// Good, it is here
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_SUCCESS).arg(name).
arg(type);
- return (createFindResult(rrclass_, zone_data_, SUCCESS, found, node,
+ return (createFindResult(rrclass_, zone_data_, SUCCESS, node, found,
options, wild, &name));
} else {
// Next, try CNAME.
@@ -789,14 +795,14 @@ InMemoryZoneFinder::find_internal(const isc::dns::Name& name,
if (found != NULL) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_CNAME).arg(name);
- return (createFindResult(rrclass_, zone_data_, CNAME, found, node,
+ return (createFindResult(rrclass_, zone_data_, CNAME, node, found,
options, wild, &name));
}
}
// No exact match or CNAME. Get NSEC if necessary and return NXRRSET.
- return (createFindResult(rrclass_, zone_data_, NXRRSET,
+ return (createFindResult(rrclass_, zone_data_, NXRRSET, node,
getNSECForNXRRSET(zone_data_, options, node),
- node, options, wild, &name));
+ options, wild, &name));
}
isc::datasrc::ZoneFinder::FindNSEC3Result
diff --git a/src/lib/datasrc/memory/zone_finder.h b/src/lib/datasrc/memory/zone_finder.h
index 85e21c3..c95b5bc 100644
--- a/src/lib/datasrc/memory/zone_finder.h
+++ b/src/lib/datasrc/memory/zone_finder.h
@@ -92,7 +92,7 @@ private:
class Context;
/// Actual implementation for both find() and findAll()
- internal::ZoneFinderResultContext find_internal(
+ internal::ZoneFinderResultContext findInternal(
const isc::dns::Name& name,
const isc::dns::RRType& type,
std::vector<isc::dns::ConstRRsetPtr>* target,
More information about the bind10-changes
mailing list