/** This function explicitly goes out for A or AAAA addresses
*/
-vector<ComboAddress> SyncRes::getAddrs(const string &qname, int type, int depth, set<GetBestNSAnswer>& beenthere)
+vector<ComboAddress> SyncRes::getAddrs(const string &qname, int depth, set<GetBestNSAnswer>& beenthere)
{
typedef vector<DNSResourceRecord> res_t;
res_t res;
typedef vector<ComboAddress> ret_t;
ret_t ret;
- if(!doResolve(qname, QType(type), res,depth+1,beenthere) && !res.empty()) { // this consults cache, OR goes out
- for(res_t::const_iterator i=res.begin(); i!= res.end(); ++i) {
- if(i->qtype.getCode()==QType::A || i->qtype.getCode()==QType::AAAA) {
- ret.push_back(ComboAddress(i->content, 53));
+ QType type;
+ for(int j=0; j<1+s_doIPv6; j++)
+ {
+ type = j ? QType::AAAA : QType::A;
+
+ if(!doResolve(qname, type, res,depth+1,beenthere) && !res.empty()) { // this consults cache, OR goes out
+ for(res_t::const_iterator i=res.begin(); i!= res.end(); ++i) {
+ if(i->qtype.getCode()==QType::A || i->qtype.getCode()==QType::AAAA) {
+ ret.push_back(ComboAddress(i->content, 53));
+ }
}
}
}
pierceDontQuery=true;
}
else {
- remoteIPs=getAddrs(*tns, QType::A, depth+1, beenthere);
+ remoteIPs=getAddrs(*tns, depth+1, beenthere);
pierceDontQuery=false;
}
inline vector<string> shuffleInSpeedOrder(set<string, CIStringCompare> &nameservers, const string &prefix);
bool moreSpecificThan(const string& a, const string &b);
- vector<ComboAddress> getAddrs(const string &qname, int type, int depth, set<GetBestNSAnswer>& beenthere);
+ vector<ComboAddress> getAddrs(const string &qname, int depth, set<GetBestNSAnswer>& beenthere);
private:
ostringstream d_trace;