nsrr.qtype=QType::NS;
nsrr.ttl=time(0)+3600000;
- for(char c='A';c<='M';++c) {
+ for(char c='a';c<='m';++c) {
static char templ[40];
- strncpy(templ,"A.ROOT-SERVERS.NET", sizeof(templ) - 1);
+ strncpy(templ,"a.root-servers.net", sizeof(templ) - 1);
*templ=c;
arr.qname=nsrr.content=templ;
- arr.content=ips[c-'A'];
+ arr.content=ips[c-'a'];
set<DNSResourceRecord> aset;
aset.insert(arr);
RC.replace(string(templ), QType(QType::A), aset);
// reap all answers from this packet that are acceptable
for(LWRes::res_t::const_iterator i=result.begin();i!=result.end();++i) {
- if(i->qtype.getCode() < 1024) {
- LOG<<prefix<<qname<<": accept answer '"<<i->qname<<"|"<<i->qtype.getName()<<"|"<<i->content<<"' from '"<<auth<<"' nameservers? ";
- }
- else {
- LOG<<prefix<<qname<<": accept opaque answer '"<<i->qname<<"|"<<QType(i->qtype.getCode()-1024).getName()<<" from '"<<auth<<"' nameservers? ";
- }
+ LOG<<prefix<<qname<<": accept answer '"<<i->qname<<"|"<<i->qtype.getName()<<"|"<<i->content<<"' from '"<<auth<<"' nameservers? ";
if(endsOn(i->qname, auth)) {
if(d_lwr.d_aabit && d_lwr.d_rcode==RCode::NoError && i->d_place==DNSResourceRecord::ANSWER && ::arg().contains("delegation-only",auth)) {
DNSResourceRecord rr=*i;
rr.d_place=DNSResourceRecord::ANSWER;
rr.ttl+=d_now.tv_sec;
- // rr.ttl=time(0)+10+10*rr.qtype.getCode();
+ if(rr.qtype.getCode() == QType::NS) // people fiddle with the case
+ rr.content=toLower(rr.content);
tcache[make_pair(toLower(i->qname),i->qtype)].insert(rr);
}
}
// supplant
for(tcache_t::const_iterator i=tcache.begin();i!=tcache.end();++i) {
- RC.replace(i->first.first,i->first.second,i->second);
+ RC.replace(i->first.first, i->first.second, i->second);
}
set<string> nsset;
LOG<<prefix<<qname<<": determining status after receiving this packet"<<endl;
}
// for ANY answers we *must* have an authoritive answer
else if(i->d_place==DNSResourceRecord::ANSWER && !strcasecmp(i->qname.c_str(),qname.c_str()) &&
- (((i->qtype==qtype) || (i->qtype.getCode()>1024 && i->qtype.getCode()-1024==qtype.getCode()))
- || ( qtype==QType(QType::ANY) && d_lwr.d_aabit))) {
- if(i->qtype.getCode() < 1024) {
- LOG<<prefix<<qname<<": answer is in: resolved to '"<< i->content<<"|"<<i->qtype.getName()<<"'"<<endl;
- }
- else {
- LOG<<prefix<<qname<<": answer is in: resolved to opaque record of type '"<<QType(i->qtype.getCode()-1024).getName()<<"'"<<endl;
- }
+ ( (i->qtype==qtype) ||
+ ( qtype==QType(QType::ANY) && d_lwr.d_aabit))) {
+
+ LOG<<prefix<<qname<<": answer is in: resolved to '"<< i->content<<"|"<<i->qtype.getName()<<"'"<<endl;
+
done=true;
ret.push_back(*i);