Commit f0a09daf authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac534] Handle insert of DNAME

The tests fail on assert in zonecutCallback currently.
parent a1e26d97
......@@ -74,10 +74,12 @@ struct MemoryZone::MemoryZoneImpl {
if (!rrset) {
isc_throw(NullRRset, "The rrset provided is NULL");
}
if (rrset->getType() == RRType::CNAME() &&
rrset->getRdataCount() > 1) {
// XXX: this is not only for CNAME. We should generalize this
// code for all other "singleton RR types" (such as SOA) in a
if ((rrset->getType() == RRType::CNAME() ||
rrset->getType() == RRType::DNAME()) &&
rrset->getRdataCount() > 1)
{
// XXX: this is not only for CNAME or DNAME. We should generalize
// this code for all other "singleton RR types" (such as SOA) in a
// separate task.
isc_throw(AddError, "multiple RRs of singleton type for "
<< rrset->getName());
......@@ -133,16 +135,34 @@ struct MemoryZone::MemoryZoneImpl {
" can't coexist for " << rrset->getName());
}
/*
* Similar with DNAME, but it must not coexist only with NS and only in
* non-apex domains.
*/
if (rrset->getName() != origin_ &&
// Adding DNAME, NS already there
((rrset->getType() == RRType::DNAME() &&
domain->find(RRType::NS()) != domain->end()) ||
// Adding NS, DNAME already there
(rrset->getType() == RRType::NS() &&
domain->find(RRType::DNAME()) != domain->end())))
{
isc_throw(AddError, "DNAME can't coexist with NS in non-apex "
"domain " << rrset->getName());
}
// Try inserting the rrset there
if (domain->insert(DomainPair(rrset->getType(), rrset)).second) {
// Ok, we just put it in
// If this RRset creates a zone cut at this node, mark the node
// indicating the need for callback in find().
// TBD: handle DNAME, too
if (rrset->getType() == RRType::NS() &&
rrset->getName() != origin_) {
node->enableCallback();
// If it is DNAME, we have a callback as well here
} else if (rrset->getType() == RRType::DNAME()) {
node->enableCallback();
}
return (result::SUCCESS);
......
Supports Markdown
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