BIND 10 master, updated. 2463b96680bb3e9a76e50c38a4d7f1d38d810643 [master] Merge branch 'trac851'
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Apr 22 00:33:39 UTC 2011
The branch, master has been updated
via 2463b96680bb3e9a76e50c38a4d7f1d38d810643 (commit)
via a9f80cc455747b38115c5279bafde024e78b5f30 (commit)
from 912b79387bbbe16f5a97513dce140d31917e091e (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 2463b96680bb3e9a76e50c38a4d7f1d38d810643
Merge: 912b793 a9f80cc
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Thu Apr 21 17:17:11 2011 -0700
[master] Merge branch 'trac851'
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/data_source.cc | 21 +++++++++++++--------
src/lib/datasrc/tests/datasrc_unittest.cc | 16 ++++++++++++++++
2 files changed, 29 insertions(+), 8 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/data_source.cc b/src/lib/datasrc/data_source.cc
index 90e1dd7..548a811 100644
--- a/src/lib/datasrc/data_source.cc
+++ b/src/lib/datasrc/data_source.cc
@@ -354,7 +354,19 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
HotCache& cache = task.q.getCache();
RRsetPtr rrset;
- // First, check the cache for matching data
+ // First off, make sure at least we have a matching zone in some data
+ // source. We must do this before checking the cache, because it can
+ // happen that the matching zone has been removed after an RRset of that
+ // zone is cached. Such inconsistency will cause various problems,
+ // including a crash.
+ const DataSrc* ds = zoneinfo.getDataSource();
+ const Name* const zonename = zoneinfo.getEnclosingZone();
+ if (ds == NULL) {
+ task.flags |= DataSrc::NO_SUCH_ZONE;
+ return (DataSrc::SUCCESS);
+ }
+
+ // Then check the cache for matching data
if (checkCache(task, target)) {
return (DataSrc::SUCCESS);
}
@@ -362,13 +374,6 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
// Requested data weren't in the cache (or were, but had expired),
// so now we proceed with the low-level data source lookup, and cache
// whatever we find.
- const DataSrc* ds = zoneinfo.getDataSource();
- const Name* const zonename = zoneinfo.getEnclosingZone();
-
- if (ds == NULL) {
- task.flags |= DataSrc::NO_SUCH_ZONE;
- return (DataSrc::SUCCESS);
- }
DataSrc::Result result;
switch (task.op) {
diff --git a/src/lib/datasrc/tests/datasrc_unittest.cc b/src/lib/datasrc/tests/datasrc_unittest.cc
index 01de77a..cd1a40c 100644
--- a/src/lib/datasrc/tests/datasrc_unittest.cc
+++ b/src/lib/datasrc/tests/datasrc_unittest.cc
@@ -1092,6 +1092,22 @@ TEST_F(DataSrcTest, DISABLED_synthesizedCnameTooLong) {
RRClass::IN(), RRType::A());
}
+TEST_F(DataSrcTest, cacheDataInNonexistentZone) {
+ // This test emulates the situation where an RRset in some zone of some
+ // data source is cached and then the zone is removed from the data source.
+ // When there is such a substantial inconsistency between the cache and
+ // the real data source, we should honor the latter. More important,
+ // the inconsistency shouldn't cause any disruption such as a crash.
+
+ const Name qname("nosuchzone.example");
+ RRsetPtr rrset(new RRset(qname, RRClass::IN(), RRType::A(), RRTTL(0)));
+ cache.addPositive(rrset, DataSrc::REFERRAL);
+
+ createAndProcessQuery(qname, RRClass::IN(), RRType::A(), false);
+ headerCheck(msg, qid, Rcode::REFUSED(), opcodeval, QR_FLAG | RD_FLAG,
+ 1, 0, 0, 0);
+}
+
// Tests of the DataSrcMatch class start here
class DataSrcMatchTest : public ::testing::Test {
protected:
More information about the bind10-changes
mailing list