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.
}
}
- ZoneFinder::FindNSEC3Result
- findNSEC3Helper(const Name& name, bool recursive);
-
const Name origin_;
// Names where we delegate somewhere else
const Name delegation_name_;
}
ZoneFinder::FindNSEC3Result
-MockZoneFinder::findNSEC3Helper(const Name& name, bool recursive) {
+MockZoneFinder::findNSEC3(const Name& name, bool recursive) {
ConstRRsetPtr covering_proof;
const int labels = name.getLabelCount();
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)
}
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,
// 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,
/// 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);
/// 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).
/// 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
///