exit(99);
}
- SyncRes::s_doAAAAAdditionalProcessing = ::arg().mustDo("aaaa-additional-processing");
- SyncRes::s_doAdditionalProcessing = ::arg().mustDo("additional-processing") | SyncRes::s_doAAAAAdditionalProcessing;
-
SyncRes::s_noEDNSPing = true; // ::arg().mustDo("disable-edns-ping");
SyncRes::s_noEDNS = ::arg().mustDo("disable-edns");
if(!SyncRes::s_noEDNS) {
::arg().set("soa-minimum-ttl","Don't change")="0";
::arg().set("soa-serial-offset","Don't change")="0";
::arg().set("no-shuffle","Don't change")="off";
- ::arg().set("additional-processing","turn on to do additional processing")="off";
- ::arg().set("aaaa-additional-processing","turn on to do AAAA additional processing (slow)")="off";
::arg().set("local-port","port to listen on")="53";
::arg().set("local-address","IP addresses to listen on, separated by spaces or commas. Also accepts ports.")="127.0.0.1";
::arg().set("trace","if we should output heaps of logging. set to 'fail' to only log failing domains")="off";
bool SyncRes::s_noEDNSPing;
bool SyncRes::s_noEDNS;
-bool SyncRes::s_doAdditionalProcessing;
-bool SyncRes::s_doAAAAAdditionalProcessing;
SyncRes::SyncRes(const struct timeval& now) : d_outqueries(0), d_tcpoutqueries(0), d_throttledqueries(0), d_timeouts(0), d_unreachables(0),
d_now(now),
set<GetBestNSAnswer> beenthere;
int res=doResolve(qname, qtype, ret, 0, beenthere);
- if(!res && s_doAdditionalProcessing)
- addCruft(qname, ret);
return res;
}
return -1;
}
-static bool uniqueComp(const DNSResourceRecord& a, const DNSResourceRecord& b)
-{
- return(a.qtype==b.qtype && a.qname==b.qname && a.content==b.content);
-}
-
-void SyncRes::addCruft(const string &qname, vector<DNSResourceRecord>& ret)
-{
- for(vector<DNSResourceRecord>::const_iterator k=ret.begin();k!=ret.end();++k) // don't add stuff to an NXDOMAIN!
- if(k->d_place==DNSResourceRecord::AUTHORITY && k->qtype==QType(QType::SOA))
- return;
-
- // LOG(qname<<": Adding best authority records from cache"<<endl);
- // addAuthorityRecords(qname,ret,0);
- // LOG(qname<<": Done adding best authority records."<<endl);
-
- LOG(d_prefix<<qname<<": Starting additional processing"<<endl);
- vector<DNSResourceRecord> addit;
-
- for(vector<DNSResourceRecord>::const_iterator k=ret.begin();k!=ret.end();++k)
- if( (k->d_place==DNSResourceRecord::ANSWER && (k->qtype==QType(QType::MX) || k->qtype==QType(QType::SRV))) ||
- ((k->d_place==DNSResourceRecord::AUTHORITY || k->d_place==DNSResourceRecord::ANSWER) && k->qtype==QType(QType::NS))) {
- LOG(d_prefix<<qname<<": record '"<<k->content<<"|"<<k->qtype.getName()<<"' needs IP for additional processing"<<endl);
- set<GetBestNSAnswer> beenthere;
- vector<pair<string::size_type, string::size_type> > fields;
- vstringtok(fields, k->content, " ");
- string host;
- if(k->qtype==QType(QType::MX) && fields.size()==2)
- host=string(k->content.c_str() + fields[1].first, fields[1].second - fields[1].first);
- else if(k->qtype==QType(QType::NS))
- host=k->content;
- else if(k->qtype==QType(QType::SRV) && fields.size()==4)
- host=string(k->content.c_str() + fields[3].first, fields[3].second - fields[3].first);
- else
- continue;
- // we used to do additional processing here.. no more
- // doResolve(host, QType(QType::A), addit, 1, beenthere);
- }
-
- if(!addit.empty()) {
- sort(addit.begin(), addit.end());
- addit.erase(unique(addit.begin(), addit.end(), uniqueComp), addit.end());
- for(vector<DNSResourceRecord>::iterator k=addit.begin();k!=addit.end();++k) {
- if(k->qtype.getCode()==QType::A || k->qtype.getCode()==QType::AAAA) {
- k->d_place=DNSResourceRecord::ADDITIONAL;
- ret.push_back(*k);
- }
- }
- }
- LOG(d_prefix<<qname<<": Done with additional processing"<<endl);
-}
-
void SyncRes::addAuthorityRecords(const string& qname, vector<DNSResourceRecord>& ret, int depth)
{
set<DNSResourceRecord> bestns;
static uint64_t s_nodelegated;
static uint64_t s_unreachables;
static unsigned int s_minimumTTL;
- static bool s_doAAAAAdditionalProcessing;
- static bool s_doAdditionalProcessing;
static bool s_doIPv6;
unsigned int d_outqueries;
unsigned int d_tcpoutqueries;
bool doCNAMECacheCheck(const string &qname, const QType &qtype, vector<DNSResourceRecord>&ret, int depth, int &res);
bool doCacheCheck(const string &qname, const QType &qtype, vector<DNSResourceRecord>&ret, int depth, int &res);
void getBestNSFromCache(const string &qname, set<DNSResourceRecord>&bestns, bool* flawedNSSet, int depth, set<GetBestNSAnswer>& beenthere);
- void addCruft(const string &qname, vector<DNSResourceRecord>& ret);
string getBestNSNamesFromCache(const string &qname,set<string, CIStringCompare>& nsset, bool* flawedNSSet, int depth, set<GetBestNSAnswer>&beenthere);
void addAuthorityRecords(const string& qname, vector<DNSResourceRecord>& ret, int depth);