From: JINMEI Tatuya Date: Fri, 20 Jan 2012 23:34:28 +0000 (-0800) Subject: [1431] canceled the idea of passing RRsetPtr as a hint for findNSEC3() for now. X-Git-Tag: trac2351_base~275^2~10^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3dabb15d73f757c4e30ab8dfbfbb84a94eea8a86;p=thirdparty%2Fkea.git [1431] canceled the idea of passing RRsetPtr as a hint for findNSEC3() for now. --- diff --git a/src/bin/auth/tests/query_unittest.cc b/src/bin/auth/tests/query_unittest.cc index ab3dace0a9..2b643d4fc8 100644 --- a/src/bin/auth/tests/query_unittest.cc +++ b/src/bin/auth/tests/query_unittest.cc @@ -244,8 +244,7 @@ public: const FindOptions options = FIND_DEFAULT); virtual ZoneFinder::FindNSEC3Result - findNSEC3(const Name& name, bool recursive, - ConstRRsetPtr known_encloser = ConstRRsetPtr()); + findNSEC3(const Name& name, bool recursive); // If false is passed, it makes the zone broken as if it didn't have the // SOA. @@ -321,9 +320,6 @@ private: } } - ZoneFinder::FindNSEC3Result - findNSEC3Helper(const Name& name, bool recursive); - const Name origin_; // Names where we delegate somewhere else const Name delegation_name_; @@ -380,7 +376,7 @@ MockZoneFinder::findAll(const Name& name, std::vector& target, } ZoneFinder::FindNSEC3Result -MockZoneFinder::findNSEC3Helper(const Name& name, bool recursive) { +MockZoneFinder::findNSEC3(const Name& name, bool recursive) { ConstRRsetPtr covering_proof; const int labels = name.getLabelCount(); @@ -422,28 +418,6 @@ MockZoneFinder::findNSEC3Helper(const Name& name, bool recursive) { isc_throw(isc::Unexpected, "findNSEC3() isn't expected to fail"); } -ZoneFinder::FindNSEC3Result -MockZoneFinder::findNSEC3(const Name& name, bool recursive, - ConstRRsetPtr known_encloser) -{ - if (!known_encloser || known_encloser->getName() == name) { - return (findNSEC3Helper(name, recursive)); - } - - // If it's recursive mode and we are given a know encloser that is a - // real ancestor of name, we may possibly be able to skip some intermediate - // level. The split below returns the immediate child of the owner name - // of the known ancestor toward the query name. - if (!recursive) { - isc_throw(isc::InvalidParameter, "Encloser cannot be an ancestor " - "in non recursive mode"); - } - return (findNSEC3Helper(name.split( - name.getLabelCount() - - known_encloser->getName().getLabelCount() - - 1), true)); -} - ZoneFinder::FindResult MockZoneFinder::find(const Name& name, const RRType& type, const FindOptions options) @@ -1495,18 +1469,9 @@ nsec3Check(bool expected_matched, const string& expected_rrsets_txt, } TEST_F(QueryTest, findNSEC3) { - ConstRRsetPtr apex_nsec3 = ConstRRsetPtr(new RRset(Name("example.com"), - RRClass::IN(), - RRType::NSEC3(), - RRTTL(0))); - // Apex name. It should have a matching NSEC3 nsec3Check(true, nsec3_apex_txt, mock_finder->findNSEC3(Name("example.com"), false)); - // giving an RRset as a hint shouldn't change the result. - nsec3Check(true, nsec3_apex_txt, - mock_finder->findNSEC3(Name("example.com"), false, - apex_nsec3)); // Recursive mode doesn't change the result in this case. nsec3Check(true, nsec3_apex_txt, @@ -1516,27 +1481,16 @@ TEST_F(QueryTest, findNSEC3) { // returned. nsec3Check(false, nsec3_www_txt, mock_finder->findNSEC3(Name("nxdomain.example.com"), false)); - // In non recursion mode we cannot give a higher level hint - EXPECT_THROW(mock_finder->findNSEC3(Name("nxdomain.example.com"), false, - apex_nsec3), - isc::InvalidParameter); // Non existent name. The closest provable encloser is the apex, // and next closer is the query name. nsec3Check(true, string(nsec3_apex_txt) + string(nsec3_www_txt), mock_finder->findNSEC3(Name("nxdomain.example.com"), true)); - // Giving the hint should produce the same result - nsec3Check(true, string(nsec3_apex_txt) + string(nsec3_www_txt), - mock_finder->findNSEC3(Name("nxdomain.example.com"), true, - apex_nsec3)); // Similar to the previous case, but next closer name is different // (is the parent) of the non existent name. nsec3Check(true, string(nsec3_apex_txt) + string(nsec3_www_txt), mock_finder->findNSEC3(Name("nx.domain.example.com"), true)); - nsec3Check(true, string(nsec3_apex_txt) + string(nsec3_www_txt), - mock_finder->findNSEC3(Name("nx.domain.example.com"), true, - apex_nsec3)); // In the rest of test we check hash comparison for wrap around cases. nsec3Check(false, nsec3_apex_txt, diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc index 8ff78ffe18..0f24cff2f6 100644 --- a/src/lib/datasrc/database.cc +++ b/src/lib/datasrc/database.cc @@ -893,7 +893,7 @@ DatabaseClient::Finder::findInternal(const isc::dns::Name& name, } ZoneFinder::FindNSEC3Result -DatabaseClient::Finder::findNSEC3(const Name&, bool, ConstRRsetPtr) { +DatabaseClient::Finder::findNSEC3(const Name&, bool) { isc_throw(NotImplemented, "findNSEC3 is not yet implemented for database " "data source"); } diff --git a/src/lib/datasrc/database.h b/src/lib/datasrc/database.h index 84217e1e30..c897b7782a 100644 --- a/src/lib/datasrc/database.h +++ b/src/lib/datasrc/database.h @@ -758,8 +758,7 @@ public: /// /// See documentation in \c Zone. virtual FindNSEC3Result - findNSEC3(const isc::dns::Name& name, bool recursive, - const isc::dns::ConstRRsetPtr known_encloser); + findNSEC3(const isc::dns::Name& name, bool recursive); /// \brief The zone ID /// diff --git a/src/lib/datasrc/memory_datasrc.cc b/src/lib/datasrc/memory_datasrc.cc index f90e75c3d2..b019ba3040 100644 --- a/src/lib/datasrc/memory_datasrc.cc +++ b/src/lib/datasrc/memory_datasrc.cc @@ -642,7 +642,7 @@ InMemoryZoneFinder::findAll(const Name& name, } ZoneFinder::FindNSEC3Result -InMemoryZoneFinder::findNSEC3(const Name&, bool, ConstRRsetPtr) { +InMemoryZoneFinder::findNSEC3(const Name&, bool) { isc_throw(NotImplemented, "findNSEC3 is not yet implemented for in memory " "data source"); } diff --git a/src/lib/datasrc/memory_datasrc.h b/src/lib/datasrc/memory_datasrc.h index 68de40d4ad..fcd9c8b669 100644 --- a/src/lib/datasrc/memory_datasrc.h +++ b/src/lib/datasrc/memory_datasrc.h @@ -87,8 +87,7 @@ public: /// /// See documentation in \c Zone. virtual FindNSEC3Result - findNSEC3(const isc::dns::Name& name, bool recursive, - const isc::dns::ConstRRsetPtr known_encloser); + findNSEC3(const isc::dns::Name& name, bool recursive); /// \brief Imelementation of the ZoneFinder::findPreviousName method /// diff --git a/src/lib/datasrc/zone.h b/src/lib/datasrc/zone.h index 9e832865c8..9e51ce9889 100644 --- a/src/lib/datasrc/zone.h +++ b/src/lib/datasrc/zone.h @@ -387,24 +387,6 @@ public: /// extend this method so that, e.g., the caller can specify the parameter /// set. /// - /// This method takes an optional parameter \c known_encloser. If it's - /// non NULL, its owner name must be the closest encloser of \c name. - /// Its RR type is expected to be NSEC3, but other attributes other than - /// the owner name is not important for this method and will generally be - /// ignored. When this parameter is provided, the actual implementation - /// of the derived class can use it as a hint for identifying the closest - /// provable encloser (it can be helpful if \c name is known to be non - /// existent and possibly contains many labels below the closest encloser). - /// The underlying data source may also specialize the RRset to hold - /// some information specific to the data source implementation to allow - /// further optimization. Whether or not this parameter is non NULL, - /// the result of this method should be the same; this parameter is only - /// provided to possibly enable some implementation specific optimization. - /// When it's non NULL, however, its owner name must be equal to \c name - /// when \c recursive is false and must be a real (non equal) super domain - /// of \c name when \c recursive is true; otherwise - /// \c isc::InvalidParameter exception will be thrown. - /// /// In general, this method expects the zone is properly signed with NSEC3 /// RRs. Specifically, it assumes at least the apex node has a matching /// NSEC3 RR (so the search in the recursive mode must always succeed); @@ -412,8 +394,7 @@ public: /// algorithm, and salt) from the zone as noted above. If these /// assumptions aren't met, \c DataSourceError exception will be thrown. /// - /// \exception InvalidParameter name is not a subdomain of the zone origin; - /// known_encloser does not meet the requirement (see above) + /// \exception InvalidParameter name is not a subdomain of the zone origin /// \exception DataSourceError Low-level or internal datasource errors /// happened, or the zone isn't properly signed with NSEC3 /// (NSEC3 parameters cannot be found, no NSEC3s are available, etc). @@ -424,15 +405,11 @@ public: /// be a subdomain of the zone. /// \param recursive Whether or not search should continue until it finds /// a provable encloser (see above). - /// \param known_encloser If non NULL, specifies the closest encloser - /// (may or may not be provable) of \c name via its owner name. /// /// \return The search result and whether or not the closest_proof is /// a matching NSEC3, in the form of \c FindNSEC3Result object. virtual FindNSEC3Result - findNSEC3(const isc::dns::Name& name, bool recursive, - const isc::dns::ConstRRsetPtr known_encloser = - isc::dns::ConstRRsetPtr()) = 0; + findNSEC3(const isc::dns::Name& name, bool recursive) = 0; /// \brief Get previous name in the zone ///