BIND 10 trac1177, updated. b6406b3e8c8e6edede8e840c8e128e944f4cff07 [1077] Tests for NXRRSET matches

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Sep 7 13:04:24 UTC 2011


The branch, trac1177 has been updated
       via  b6406b3e8c8e6edede8e840c8e128e944f4cff07 (commit)
      from  30ade643ceb25a67bd2c27df2dd4eb4001fc60c8 (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 b6406b3e8c8e6edede8e840c8e128e944f4cff07
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Wed Sep 7 15:02:07 2011 +0200

    [1077] Tests for NXRRSET matches
    
    Normal one and wildcard one. Empty-nonterminal is not included here.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/tests/database_unittest.cc |   63 ++++++++++++++++++++++++++--
 src/lib/datasrc/zone.h                     |    2 +
 2 files changed, 61 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index bd0c584..51397b4 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -327,6 +327,10 @@ private:
         addRecord("A", "3600", "", "192.0.2.1");
         addRecord("AAAA", "3600", "", "2001:db8::1");
         addRecord("AAAA", "3600", "", "2001:db8::2");
+        addRecord("NSEC", "3600", "", "www2.example.org. A AAAA NSEC RRSIG");
+        addRecord("RRSIG", "3600", "", "A 5 3 3600 20000101000000 20000201000000 12345 example.org. FAKEFAKEFAKE");
+        addRecord("RRSIG", "3600", "", "AAAA 5 3 3600 20000101000000 20000201000000 12345 example.org. FAKEFAKEFAKE");
+        addRecord("RRSIG", "3600", "", "NSEC 5 3 3600 20000101000000 20000201000000 12345 example.org. FAKEFAKEFAKE");
         addCurName("www.example.org.");
 
         addRecord("A", "3600", "", "192.0.2.1");
@@ -461,7 +465,10 @@ private:
 
         // Something for wildcards
         addRecord("A", "3600", "", "192.0.2.5");
+        addRecord("NSEC", "3600", "", "cancel.here.wild.example.org. A NSEC "
+                  "RRSIG");
         addRecord("RRSIG", "3600", "", "A 5 3 3600 20000101000000 20000201000000 12345 example.org. FAKEFAKEFAKE");
+        addRecord("RRSIG", "3600", "", "NSEC 5 3 3600 20000101000000 20000201000000 12345 example.org. FAKEFAKEFAKE");
         addCurName("*.wild.example.org.");
         addRecord("AAAA", "3600", "", "2001:db8::5");
         addCurName("cancel.here.wild.example.org.");
@@ -685,21 +692,25 @@ doFindTest(shared_ptr<DatabaseClient::Finder> finder,
     ZoneFinder::FindResult result =
         finder->find(name, type, NULL, options);
     ASSERT_EQ(expected_result, result.code) << name << " " << type;
-    if (!expected_rdatas.empty()) {
+    if (!expected_rdatas.empty() && result.rrset) {
         checkRRset(result.rrset, expected_name != Name(".") ? expected_name :
                    name, finder->getClass(), expected_type, expected_ttl,
                    expected_rdatas);
 
-        if (!expected_sig_rdatas.empty()) {
+        if (!expected_sig_rdatas.empty() && result.rrset->getRRsig()) {
             checkRRset(result.rrset->getRRsig(), expected_name != Name(".") ?
                        expected_name : name, finder->getClass(),
                        isc::dns::RRType::RRSIG(), expected_ttl,
                        expected_sig_rdatas);
-        } else {
+        } else if (expected_sig_rdatas.empty()) {
             EXPECT_EQ(isc::dns::RRsetPtr(), result.rrset->getRRsig());
+        } else {
+            ADD_FAILURE() << "Missing RRSIG";
         }
-    } else {
+    } else if (expected_rdatas.empty()) {
         EXPECT_EQ(isc::dns::RRsetPtr(), result.rrset);
+    } else {
+        ADD_FAILURE() << "Missing result";
     }
 }
 
@@ -709,6 +720,8 @@ TEST_F(DatabaseClientTest, find) {
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
     expected_rdatas_.push_back("192.0.2.1");
+    expected_sig_rdatas_.push_back("A 5 3 3600 20000101000000 20000201000000 "
+                                   "12345 example.org. FAKEFAKEFAKE");
     doFindTest(finder, isc::dns::Name("www.example.org."),
                isc::dns::RRType::A(), isc::dns::RRType::A(),
                isc::dns::RRTTL(3600),
@@ -729,6 +742,9 @@ TEST_F(DatabaseClientTest, find) {
     expected_sig_rdatas_.clear();
     expected_rdatas_.push_back("2001:db8::1");
     expected_rdatas_.push_back("2001:db8::2");
+    expected_sig_rdatas_.push_back("AAAA 5 3 3600 20000101000000 "
+                                   "20000201000000 12345 example.org. "
+                                   "FAKEFAKEFAKE");
     doFindTest(finder, isc::dns::Name("www.example.org."),
                isc::dns::RRType::AAAA(), isc::dns::RRType::AAAA(),
                isc::dns::RRTTL(3600),
@@ -1288,6 +1304,45 @@ TEST_F(DatabaseClientTest, wildcard) {
     }
 }
 
+TEST_F(DatabaseClientTest, NXRRSET_NSEC) {
+    // The domain exists, but doesn't have this RRType
+    // So we should get it's NSEC
+    shared_ptr<DatabaseClient::Finder> finder(getFinder());
+
+    expected_rdatas_.push_back("www2.example.org. A AAAA NSEC RRSIG");
+    expected_sig_rdatas_.push_back("NSEC 5 3 3600 20000101000000 "
+                                   "20000201000000 12345 example.org. "
+                                   "FAKEFAKEFAKE");
+    doFindTest(finder, isc::dns::Name("www.example.org."),
+               isc::dns::RRType::TXT(), isc::dns::RRType::TXT(),
+               isc::dns::RRTTL(3600),
+               ZoneFinder::NXRRSET,
+               expected_rdatas_, expected_sig_rdatas_, Name::ROOT_NAME(),
+               ZoneFinder::FIND_DNSSEC);
+}
+
+TEST_F(DatabaseClientTest, wildcardNXRRSET_NSEC) {
+    // The domain exists, but doesn't have this RRType
+    // So we should get it's NSEC
+    //
+    // The user will have to query us again to get the correct
+    // answer (eg. prove there's not an exact match)
+    shared_ptr<DatabaseClient::Finder> finder(getFinder());
+
+    expected_rdatas_.push_back("cancel.here.wild.example.org. A NSEC RRSIG");
+    expected_sig_rdatas_.push_back("NSEC 5 3 3600 20000101000000 "
+                                   "20000201000000 12345 example.org. "
+                                   "FAKEFAKEFAKE");
+    // Note that the NSEC name should NOT be synthesized.
+    doFindTest(finder, isc::dns::Name("a.wild.example.org."),
+               isc::dns::RRType::TXT(), isc::dns::RRType::TXT(),
+               isc::dns::RRTTL(3600),
+               ZoneFinder::NXRRSET,
+               expected_rdatas_, expected_sig_rdatas_,
+               Name("*.wild.example.org"), ZoneFinder::FIND_DNSSEC);
+}
+
+
 TEST_F(DatabaseClientTest, getOrigin) {
     DataSourceClient::FindResult zone(client_->findZone(Name("example.org")));
     ASSERT_EQ(result::SUCCESS, zone.code);
diff --git a/src/lib/datasrc/zone.h b/src/lib/datasrc/zone.h
index 989b250..e65ea23 100644
--- a/src/lib/datasrc/zone.h
+++ b/src/lib/datasrc/zone.h
@@ -68,6 +68,8 @@ public:
         NXRRSET,  ///< There is a matching name but no RRset of the search type
         CNAME,    ///< The search encounters and returns a CNAME RR
         DNAME     ///< The search encounters and returns a DNAME RR
+        // TODO: Add WILDCARD here so we can request covering NSEC
+        // TODO: Add WILDCARD_NXRRSET for the same reason
     };
 
     /// A helper structure to represent the search result of \c find().




More information about the bind10-changes mailing list