added one more test for that.
return;
}
- // Ignore data at a zone cut unless glue is allowed.
- // TODO: DNAME case consideration (with test)
+ // Ignore data at a zone cut (due to subdomain delegation) unless glue is
+ // allowed. Checking the node callback flag is a cheap way to detect
+ // zone cuts, but it includes DNAME delegation, in which case we should
+ // keep finding the additional records regardless of the 'GLUE_OK' flag.
+ // The last two conditions limit the case to delegation NS, i.e, the node
+ // has an NS and it's not the zone origin.
const ZoneNode* node = node_result.node;
if ((options & ZoneFinder::FIND_GLUE_OK) == 0 &&
node->getFlag(ZoneNode::FLAG_CALLBACK) &&
- node != zone_data_->getOriginNode()) {
+ node != zone_data_->getOriginNode() &&
+ RdataSet::find(node->getData(), RRType::NS()) != NULL) {
return;
}
;; test zone file used for ZoneFinderContext tests.
;; RRSIGs are (obviouslly) faked ones for testing.
-example.org. 3600 IN SOA ns1.example.org. bugs.x.w.example.org. 67 3600 300 3600000 3600
+example.org. 3600 IN SOA ns1.example.org. bugs.x.w.example.org. 71 3600 300 3600000 3600
example.org. 3600 IN NS ns1.example.org.
example.org. 3600 IN NS ns2.example.org.
example.org. 3600 IN MX 1 mx1.example.org.
;; expansion
*.wildmx.example.org. 3600 IN MX 1 mx1.example.org.
+;; the owner name of additional for an answer RRset (MX) has DNAME
+dnamemx.example.org. 3600 IN MX 1 dname.example.org.
+
;; CNAME
alias.example.org. 3600 IN CNAME cname.example.org.
result_sets_.begin(), result_sets_.end());
}
+TEST_P(ZoneFinderContextTest, getAdditionalOnDname) {
+ // The additional name has a DNAME as well as the additional record.
+ // The existence of DNAME shouldn't hide the additional record.
+ ZoneFinderContextPtr ctx = finder_->find(Name("dnamemx.example.org"),
+ RRType::MX());
+ EXPECT_EQ(ZoneFinder::SUCCESS, ctx->code);
+
+ ctx->getAdditional(REQUESTED_BOTH, result_sets_);
+ rrsetsCheck("dname.example.org. 3600 IN A 192.0.2.12\n",
+ result_sets_.begin(), result_sets_.end());
+}
+
TEST_P(ZoneFinderContextTest, getAdditionalDelegationWithEmptyName) {
// One of NS names is at an empty non terminal node. It shouldn't cause
// any disruption.