Commit 94b0beeb authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac526] Implement returning CNAME

No chaining is implemented. While RFC 1024 indicates we should do it at
last inside the same zone, we don't now and leave it out for later.

The CNAME is handled in the same way as as SUCCESS with slight
modification about additional data (which probably never happen in real
life anyway).
parent 424bb3df
......@@ -143,6 +143,16 @@ Query::process() const {
keep_doing = false;
Zone::FindResult db_result = result.zone->find(qname_, qtype_);
switch (db_result.code) {
case Zone::CNAME:
/*
* We don't do chaining yet. Therefore handling a CNAME is
* mostly the same as handling SUCCESS, but we didn't get
* what we expected. It means no exceptions in ANY or NS
* on the origin (though CNAME in origin is probably
* forbidden anyway).
*
*/
// No break; here, fall trough.
case Zone::SUCCESS:
response_.setRcode(Rcode::NOERROR());
response_.addRRset(Message::SECTION_ANSWER,
......@@ -154,6 +164,7 @@ Query::process() const {
// and AAAA/A RRS of each of the NS RDATA into the additional
// section.
if (qname_ != result.zone->getOrigin() ||
db_result.code != Zone::SUCCESS ||
(qtype_ != RRType::NS() && qtype_ != RRType::ANY()))
{
getAuthAdditional(*result.zone);
......@@ -176,7 +187,6 @@ Query::process() const {
response_.setRcode(Rcode::NOERROR());
putSOA(*result.zone);
break;
case Zone::CNAME:
case Zone::DNAME:
// TODO : replace qname, continue lookup
break;
......
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