DNSResourceRecord rr;
- if(j->first.d_type == i->second.qtype || j->first.d_type==QType::SOA) {
+ if(j->first.d_type == i->second.qtype || (i->second.qtype == QType::ANY && (j->first.d_type == QType::A || j->first.d_type == QType::AAAA))) {
rr.qname=i->second.aname;
rr.qtype = j->first.d_type;
rr.ttl=j->first.d_ttl;
if(rr.qtype.getCode() == QType::CNAME && p->qtype.getCode() != QType::CNAME)
weRedirected=1;
- if(DP && rr.qtype.getCode() == QType::ALIAS) {
+ if(DP && rr.qtype.getCode() == QType::ALIAS && (p->qtype.getCode() == QType::A || p->qtype.getCode() == QType::AAAA || p->qtype.getCode() == QType::ANY)) {
haveAlias=DNSName(rr.content);
}
goto sendit;
}
- if(!haveAlias.empty() && !weDone) {
+ if(!haveAlias.empty() && (!weDone || p->qtype.getCode() == QType::ANY)) {
DLOG(L<<Logger::Warning<<"Found nothing that matched for '"<<target<<"', but did get alias to '"<<haveAlias<<"', referring"<<endl);
DP->completePacket(r, haveAlias, target);
return 0;
else if(weDone) {
bool haveRecords = false;
for(const auto& rr: rrset) {
- if((p->qtype.getCode() == QType::ANY || rr.qtype == p->qtype) && rr.qtype.getCode() && rr.auth) {
+ if((p->qtype.getCode() == QType::ANY || rr.qtype == p->qtype) && rr.qtype.getCode() && rr.qtype != QType::ALIAS && rr.auth) {
r->addRecord(rr);
haveRecords = true;
}
-1 example.com. IN SOA 86400 ns1.example.com. ahu.example.com. 2847484160 28800 7200 604800 86400
+1 example.com. IN SOA 86400 ns1.example.com. ahu.example.com. 2847484148 28800 7200 604800 86400
Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
Reply to question for qname='google-alias.example.com.', qtype=MX