Commit d22e90b5 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[master] Merge branch 'trac1571'

parents d66a6761 c6c8a84b
...@@ -557,7 +557,10 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl { ...@@ -557,7 +557,10 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
// If the node callback is enabled, this may be a zone cut. If it // If the node callback is enabled, this may be a zone cut. If it
// has a NS RR, we should return a delegation, but not in the apex. // has a NS RR, we should return a delegation, but not in the apex.
if (node->getFlag(DomainNode::FLAG_CALLBACK) && node != origin_data_) { // There is one exception: the case for DS query, which should always
// be considered in-zone lookup.
if (node->getFlag(DomainNode::FLAG_CALLBACK) && node != origin_data_ &&
type != RRType::DS()) {
found = node->getData()->find(RRType::NS()); found = node->getData()->find(RRType::NS());
if (found != node->getData()->end()) { if (found != node->getData()->end()) {
LOG_DEBUG(logger, DBG_TRACE_DATA, LOG_DEBUG(logger, DBG_TRACE_DATA,
......
...@@ -291,6 +291,8 @@ public: ...@@ -291,6 +291,8 @@ public:
{"example.org. 300 IN DNAME example.com.", &rr_dname_apex_}, {"example.org. 300 IN DNAME example.com.", &rr_dname_apex_},
{"child.example.org. 300 IN NS ns.child.example.org.", {"child.example.org. 300 IN NS ns.child.example.org.",
&rr_child_ns_}, &rr_child_ns_},
{"child.example.org. 300 IN DS 12345 5 1 DEADBEEF",
&rr_child_ds_},
{"ns.child.example.org. 300 IN A 192.0.2.153", {"ns.child.example.org. 300 IN A 192.0.2.153",
&rr_child_glue_}, &rr_child_glue_},
{"grand.child.example.org. 300 IN NS ns.grand.child.example.org.", {"grand.child.example.org. 300 IN NS ns.grand.child.example.org.",
...@@ -353,6 +355,7 @@ public: ...@@ -353,6 +355,7 @@ public:
RRsetPtr rr_dname_ns_; // for mixed DNAME + NS case RRsetPtr rr_dname_ns_; // for mixed DNAME + NS case
RRsetPtr rr_dname_apex_; // for mixed DNAME + NS case in the apex RRsetPtr rr_dname_apex_; // for mixed DNAME + NS case in the apex
RRsetPtr rr_child_ns_; // NS of a child domain (for delegation) RRsetPtr rr_child_ns_; // NS of a child domain (for delegation)
RRsetPtr rr_child_ds_; // DS of a child domain (for delegation, auth data)
RRsetPtr rr_child_glue_; // glue RR of the child domain RRsetPtr rr_child_glue_; // glue RR of the child domain
RRsetPtr rr_grandchild_ns_; // NS below a zone cut (unusual) RRsetPtr rr_grandchild_ns_; // NS below a zone cut (unusual)
RRsetPtr rr_grandchild_glue_; // glue RR below a deeper zone cut RRsetPtr rr_grandchild_glue_; // glue RR below a deeper zone cut
...@@ -656,6 +659,26 @@ TEST_F(InMemoryZoneFinderTest, delegationNS) { ...@@ -656,6 +659,26 @@ TEST_F(InMemoryZoneFinderTest, delegationNS) {
ZoneFinder::DELEGATION, true, rr_child_ns_); ZoneFinder::DELEGATION, true, rr_child_ns_);
} }
TEST_F(InMemoryZoneFinderTest, delegationWithDS) {
// Similar setup to the previous one, but with DS RR at the delegation
// point.
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_));
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_child_ns_));
EXPECT_EQ(SUCCESS, zone_finder_.add(rr_child_ds_));
// Normal types of query should result in delegation, but DS query
// should be considered in-zone.
findTest(Name("child.example.org"), RRType::A(), ZoneFinder::DELEGATION,
true, rr_child_ns_);
findTest(Name("child.example.org"), RRType::DS(), ZoneFinder::SUCCESS,
true, rr_child_ds_);
// There's nothing special for DS query at the zone apex. It would
// normally result in NXRRSET.
findTest(Name("example.org"), RRType::DS(), ZoneFinder::NXRRSET,
true, ConstRRsetPtr());
}
TEST_F(InMemoryZoneFinderTest, findAny) { TEST_F(InMemoryZoneFinderTest, findAny) {
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_a_))); EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_a_)));
EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_))); EXPECT_NO_THROW(EXPECT_EQ(SUCCESS, zone_finder_.add(rr_ns_)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment