BIND 10 trac1064, updated. b9f87e9332895be6915e2f2960a2e921375e8e7f [1064] Implement GLUE_OK mode
BIND 10 source code commits
bind10-changes at lists.isc.org
Sat Aug 13 12:57:38 UTC 2011
The branch, trac1064 has been updated
via b9f87e9332895be6915e2f2960a2e921375e8e7f (commit)
via 978ae99ac4aa211ba4ba960f56bb6cdd84b648ae (commit)
from e021b84f7fc20b3e3927093ed87e9c873d33a443 (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 b9f87e9332895be6915e2f2960a2e921375e8e7f
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Sat Aug 13 14:54:57 2011 +0200
[1064] Implement GLUE_OK mode
It just turns off the flag for the getRRset method when the mode is on,
to ignore it on the way.
commit 978ae99ac4aa211ba4ba960f56bb6cdd84b648ae
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Sat Aug 13 14:37:14 2011 +0200
[1064] Tests for GLUE_OK mode
It should just go trough NS delegation points (but not trough DNAME
ones).
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/database.cc | 10 +++--
src/lib/datasrc/tests/database_unittest.cc | 64 +++++++++++++++++++++++++++-
2 files changed, 68 insertions(+), 6 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index 6afd3dc..8ed4976 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -284,11 +284,12 @@ ZoneFinder::FindResult
DatabaseClient::Finder::find(const isc::dns::Name& name,
const isc::dns::RRType& type,
isc::dns::RRsetList*,
- const FindOptions)
+ const FindOptions options)
{
// This variable is used to determine the difference between
// NXDOMAIN and NXRRSET
bool records_found = false;
+ bool glue_ok(options & FIND_GLUE_OK);
isc::dns::RRsetPtr result_rrset;
ZoneFinder::Result result_status = SUCCESS;
std::pair<bool, isc::dns::RRsetPtr> found;
@@ -307,7 +308,7 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
Name superdomain(name.split(i));
// Look if there's NS or DNAME (but ignore the NS in origin)
found = getRRset(superdomain, NULL, false, true,
- i != removeLabels);
+ i != removeLabels && !glue_ok);
if (found.second) {
// We found something redirecting somewhere else
// (it can be only NS or DNAME here)
@@ -326,10 +327,11 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
// Try getting the final result and extract it
// It is special if there's a CNAME or NS, DNAME is ignored here
// And we don't consider the NS in origin
- found = getRRset(name, &type, true, false, name != origin);
+ found = getRRset(name, &type, true, false,
+ name != origin && !glue_ok);
records_found = found.first;
result_rrset = found.second;
- if (result_rrset && name != origin &&
+ if (result_rrset && name != origin && !glue_ok &&
result_rrset->getType() == isc::dns::RRType::NS()) {
result_status = DELEGATION;
} else if (result_rrset && type != isc::dns::RRType::CNAME() &&
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index f4b5d09..2a1cb3c 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -390,11 +390,12 @@ doFindTest(shared_ptr<DatabaseClient::Finder> finder,
ZoneFinder::Result expected_result,
const std::vector<std::string>& expected_rdatas,
const std::vector<std::string>& expected_sig_rdatas,
- const isc::dns::Name& expected_name = isc::dns::Name::ROOT_NAME())
+ const isc::dns::Name& expected_name = isc::dns::Name::ROOT_NAME(),
+ const ZoneFinder::FindOptions options = ZoneFinder::FIND_DEFAULT)
{
SCOPED_TRACE("doFindTest " + name.toText() + " " + type.toText());
ZoneFinder::FindResult result =
- finder->find(name, type, NULL, ZoneFinder::FIND_DEFAULT);
+ finder->find(name, type, NULL, options);
ASSERT_EQ(expected_result, result.code) << name << " " << type;
if (expected_rdatas.size() > 0) {
checkRRset(result.rrset, expected_name != Name(".") ? expected_name :
@@ -839,6 +840,65 @@ TEST_F(DatabaseClientTest, find) {
ZoneFinder::FIND_DEFAULT),
DataSourceError);
EXPECT_FALSE(current_database_->searchRunning());
+
+ // Glue-OK mode. Just go trough NS delegations down (but not trough
+ // DNAME) and pretend it is not there.
+ {
+ SCOPED_TRACE("Glue OK");
+ expected_rdatas.clear();
+ expected_sig_rdatas.clear();
+ doFindTest(finder, isc::dns::Name("ns.delegation.example.org."),
+ isc::dns::RRType::AAAA(), isc::dns::RRType::AAAA(),
+ isc::dns::RRTTL(3600), ZoneFinder::NXRRSET, expected_rdatas,
+ expected_sig_rdatas,
+ isc::dns::Name("ns.delegation.example.org."),
+ ZoneFinder::FIND_GLUE_OK);
+ doFindTest(finder, isc::dns::Name("nothere.delegation.example.org."),
+ isc::dns::RRType::AAAA(), isc::dns::RRType::AAAA(),
+ isc::dns::RRTTL(3600), ZoneFinder::NXDOMAIN,
+ expected_rdatas, expected_sig_rdatas,
+ isc::dns::Name("nothere.delegation.example.org."),
+ ZoneFinder::FIND_GLUE_OK);
+ expected_rdatas.push_back("192.0.2.1");
+ doFindTest(finder, isc::dns::Name("ns.delegation.example.org."),
+ isc::dns::RRType::A(), isc::dns::RRType::A(),
+ isc::dns::RRTTL(3600), ZoneFinder::SUCCESS, expected_rdatas,
+ expected_sig_rdatas,
+ isc::dns::Name("ns.delegation.example.org."),
+ ZoneFinder::FIND_GLUE_OK);
+ expected_rdatas.clear();
+ expected_rdatas.push_back("ns.example.com.");
+ expected_rdatas.push_back("ns.delegation.example.org.");
+ expected_sig_rdatas.clear();
+ expected_sig_rdatas.push_back("NS 5 3 3600 20000101000000 "
+ "20000201000000 12345 example.org. "
+ "FAKEFAKEFAKE");
+ // When we request the NS, it should be SUCCESS, not DELEGATION
+ // (different in GLUE_OK)
+ doFindTest(finder, isc::dns::Name("delegation.example.org."),
+ isc::dns::RRType::NS(), isc::dns::RRType::NS(),
+ isc::dns::RRTTL(3600), ZoneFinder::SUCCESS, expected_rdatas,
+ expected_sig_rdatas, isc::dns::Name("delegation.example.org."),
+ ZoneFinder::FIND_GLUE_OK);
+ expected_rdatas.clear();
+ expected_rdatas.push_back("dname.example.com.");
+ expected_sig_rdatas.clear();
+ expected_sig_rdatas.push_back("DNAME 5 3 3600 20000101000000 "
+ "20000201000000 12345 example.org. "
+ "FAKEFAKEFAKE");
+ doFindTest(finder, isc::dns::Name("below.dname.example.org."),
+ isc::dns::RRType::A(), isc::dns::RRType::DNAME(),
+ isc::dns::RRTTL(3600), ZoneFinder::DNAME, expected_rdatas,
+ expected_sig_rdatas, isc::dns::Name("dname.example.org."),
+ ZoneFinder::FIND_GLUE_OK);
+ EXPECT_FALSE(current_database_->searchRunning());
+ doFindTest(finder, isc::dns::Name("below.dname.example.org."),
+ isc::dns::RRType::AAAA(), isc::dns::RRType::DNAME(),
+ isc::dns::RRTTL(3600), ZoneFinder::DNAME, expected_rdatas,
+ expected_sig_rdatas, isc::dns::Name("dname.example.org."),
+ ZoneFinder::FIND_GLUE_OK);
+ EXPECT_FALSE(current_database_->searchRunning());
+ } // End of GLUE_OK
}
TEST_F(DatabaseClientTest, getOrigin) {
More information about the bind10-changes
mailing list