Parcourir la source

[2420] enable the RRSIG-only case in ZoneDataLoader.

JINMEI Tatuya il y a 12 ans
Parent
commit
371ad74bd7

+ 3 - 11
src/lib/datasrc/memory/zone_data_loader.cc

@@ -126,20 +126,12 @@ ZoneDataLoader::flushNodeRRsets() {
         updater_.add(val.second, sig_rrset);
     }
 
-#ifdef notyet
+    // Normally rrsigsets map should be empty at this point, but it's still
+    // possible that an RRSIG that don't has covered RRset is added; they
+    // still remain in the map.  We add them to the zone separately.
     BOOST_FOREACH(NodeRRsetsVal val, node_rrsigsets_) {
         updater_.add(ConstRRsetPtr(), val.second);
     }
-#else
-    // Right now, we don't accept RRSIG without covered RRsets (this
-    // should eventually allowed, but to do so we'll need to update the
-    // finder).
-    if (!node_rrsigsets_.empty()) {
-        isc_throw(ZoneDataUpdater::AddError,
-                  "RRSIG is added without covered RRset for "
-                  << getCurrentName());
-    }
-#endif
 
     node_rrsets_.clear();
     node_rrsigsets_.clear();

+ 6 - 2
src/lib/datasrc/tests/memory/zone_data_loader_unittest.cc

@@ -43,9 +43,10 @@ protected:
     ZoneData* zone_data_;
 };
 
-TEST_F(ZoneDataLoaderTest, DISABLED_loadRRSIGFollowsNothing) {
+TEST_F(ZoneDataLoaderTest, loadRRSIGFollowsNothing) {
     // This causes the situation where an RRSIG is added without a covered
-    // RRset.  Such cases are currently rejected.
+    // RRset.  It will be accepted, and corresponding "sig-only" rdata will
+    // be created.
     zone_data_ = loadZoneData(mem_sgmt_, zclass_, Name("example.org"),
                               TEST_DATA_DIR
                               "/example.org-rrsig-follows-nothing.zone");
@@ -54,6 +55,9 @@ TEST_F(ZoneDataLoaderTest, DISABLED_loadRRSIGFollowsNothing) {
     ASSERT_NE(static_cast<ZoneNode*>(NULL), node);
     const RdataSet* rdset = node->getData();
     ASSERT_NE(static_cast<RdataSet*>(NULL), rdset);
+    EXPECT_EQ(RRType::A(), rdset->type); // there should be only 1 data here
+    EXPECT_EQ(0, rdset->getRdataCount()); // no RDATA
+    EXPECT_EQ(1, rdset->getSigRdataCount()); // but 1 SIG
 
     // Teardown checks for memory segment leaks
 }