[svn] commit: r2792 - in /branches/trac307/src/lib/datasrc: data_source.cc tests/datasrc_unittest.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Aug 24 16:52:55 UTC 2010
Author: jinmei
Date: Tue Aug 24 16:52:55 2010
New Revision: 2792
Log:
committed a proposed fix to trac #307
Modified:
branches/trac307/src/lib/datasrc/data_source.cc
branches/trac307/src/lib/datasrc/tests/datasrc_unittest.cc
Modified: branches/trac307/src/lib/datasrc/data_source.cc
==============================================================================
--- branches/trac307/src/lib/datasrc/data_source.cc (original)
+++ branches/trac307/src/lib/datasrc/data_source.cc Tue Aug 24 16:52:55 2010
@@ -206,6 +206,11 @@
if (!hit || !rrset || (flags & DataSrc::CNAME_FOUND) != 0) {
hit = cache.retrieve(task.qname, task.qclass, RRType::CNAME(),
rrset, flags);
+ if (!rrset) {
+ // If we don't have a positive cache, forget it; otherwise the
+ // intermediate result may confuse the subsequent processing.
+ hit = false;
+ }
}
if (hit) {
Modified: branches/trac307/src/lib/datasrc/tests/datasrc_unittest.cc
==============================================================================
--- branches/trac307/src/lib/datasrc/tests/datasrc_unittest.cc (original)
+++ branches/trac307/src/lib/datasrc/tests/datasrc_unittest.cc Tue Aug 24 16:52:55 2010
@@ -915,6 +915,24 @@
headerCheck(msg, Rcode::REFUSED(), true, false, true, 0, 0, 0);
}
+TEST_F(DataSrcTest, DSQueryFromCache) {
+ // explicitly enable hot spot cache
+ cache.setEnabled(true);
+
+ // The first query will create a negative cache for example.org/CNAME
+ createAndProcessQuery(Name("example.org"), RRClass::IN(), RRType::SOA());
+
+ // the cached CNAME shouldn't confuse subsequent query.
+ // there may be several different possible cases that could trigger a bug,
+ // but DS query is the only known example.
+ msg.clear(Message::PARSE);
+ createAndProcessQuery(Name("example.org"), RRClass::IN(), RRType::DS());
+
+ // returning refused is probably a bad behavior, but it's a different
+ // issue.
+ headerCheck(msg, Rcode::REFUSED(), true, false, true, 0, 0, 0);
+}
+
// Non-existent name in the "static" data source. The purpose of this test
// is to check a corner case behavior when atypical RRClass (CH in this case)
// is specified.
More information about the bind10-changes
mailing list