{"example.org. 300 IN NS ns.example.org.", &rr_ns_},
{"example.org. 300 IN A 192.0.2.1", &rr_a_},
{"ns.example.org. 300 IN A 192.0.2.2", &rr_ns_a_},
+ // This one will place rr_ns_a_ at a zone cut, making it a glue:
+ {"ns.example.org. 300 IN NS 192.0.2.2", &rr_ns_ns_},
{"ns.example.org. 300 IN AAAA 2001:db8::2", &rr_ns_aaaa_},
{"cname.example.org. 300 IN CNAME canonical.example.org",
&rr_cname_},
rr_ns_aaaa_,
// A of example.org
rr_a_;
+ RRsetPtr rr_ns_ns_; // used to make rr_ns_a_ a glue.
RRsetPtr rr_cname_; // CNAME in example.org (RDATA will be added)
RRsetPtr rr_cname_a_; // for mixed CNAME + A case
RRsetPtr rr_dname_; // DNAME in example.org (RDATA will be added)
EXPECT_NO_THROW(addZoneData(rr_grandchild_ns_));
// glue under the deeper zone cut
EXPECT_NO_THROW(addZoneData(rr_grandchild_glue_));
+ // glue 'at the' zone cut
+ EXPECT_NO_THROW(addZoneData(rr_ns_a_));
+ EXPECT_NO_THROW(addZoneData(rr_ns_ns_));
// by default glue is hidden due to the zone cut
findTest(rr_child_glue_->getName(), RRType::A(), ZoneFinder::DELEGATION,
findTest(Name("www.grand.child.example.org"), RRType::TXT(),
ZoneFinder::DELEGATION, true, rr_child_ns_,
ZoneFinder::RESULT_DEFAULT, NULL, ZoneFinder::FIND_GLUE_OK);
+
+ // Glue at a zone cut
+ findTest(Name("ns.example.org"), RRType::A(),
+ ZoneFinder::DELEGATION, true, rr_ns_ns_);
+ findTest(Name("ns.example.org"), RRType::A(), ZoneFinder::SUCCESS,
+ true, rr_ns_a_, ZoneFinder::RESULT_DEFAULT,
+ NULL, ZoneFinder::FIND_GLUE_OK);
}
/**
// 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.
- // There is one exception: the case for DS query, which should always
- // be considered in-zone lookup.
+ // There are two exceptions:
+ // - the case for DS query, which should always be considered in-zone
+ // lookup.
+ // - when we are looking for glue records (FIND_GLUE_OK)
if (node->getFlag(ZoneNode::FLAG_CALLBACK) &&
- node != zone_data_.getOriginNode() && type != RRType::DS()) {
+ (options & FIND_GLUE_OK) == 0 &&
+ node != zone_data_.getOriginNode() && type != RRType::DS()) {
found = RdataSet::find(node->getData(), RRType::NS());
if (found != NULL) {
LOG_DEBUG(logger, DBG_TRACE_DATA,