]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/ueberbackend.cc
Fix warnings about dup/missing prototypes
[thirdparty/pdns.git] / pdns / ueberbackend.cc
1 /*
2 * This file is part of PowerDNS or dnsdist.
3 * Copyright -- PowerDNS.COM B.V. and its contributors
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * In addition, for the avoidance of any doubt, permission is granted to
10 * link this program with OpenSSL and to (re)distribute the binaries
11 * produced as the result of such linking.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25 #include <boost/archive/binary_iarchive.hpp>
26 #include <boost/archive/binary_oarchive.hpp>
27
28 #include "auth-querycache.hh"
29 #include "utility.hh"
30
31
32 #include <dlfcn.h>
33 #include <string>
34 #include <map>
35 #include <sys/types.h>
36 #include <sstream>
37 #include <errno.h>
38 #include <iostream>
39 #include <sstream>
40 #include <functional>
41
42 #include "dns.hh"
43 #include "arguments.hh"
44 #include "dnsbackend.hh"
45 #include "ueberbackend.hh"
46 #include "dnspacket.hh"
47 #include "logger.hh"
48 #include "statbag.hh"
49
50 extern StatBag S;
51
52 vector<UeberBackend *>UeberBackend::instances;
53 pthread_mutex_t UeberBackend::instances_lock=PTHREAD_MUTEX_INITIALIZER;
54
55 // initially we are blocked
56 bool UeberBackend::d_go=false;
57 pthread_mutex_t UeberBackend::d_mut = PTHREAD_MUTEX_INITIALIZER;
58 pthread_cond_t UeberBackend::d_cond = PTHREAD_COND_INITIALIZER;
59
60 //! Loads a module and reports it to all UeberBackend threads
61 bool UeberBackend::loadmodule(const string &name)
62 {
63 g_log<<Logger::Warning <<"Loading '"<<name<<"'" << endl;
64
65 void *dlib=dlopen(name.c_str(), RTLD_NOW);
66
67 if(dlib == NULL) {
68 g_log<<Logger::Error <<"Unable to load module '"<<name<<"': "<<dlerror() << endl;
69 return false;
70 }
71
72 return true;
73 }
74
75 bool UeberBackend::loadModules(const vector<string>& modules, const string& path)
76 {
77 for (const auto& module: modules) {
78 bool res;
79 if (module.find(".")==string::npos) {
80 res = UeberBackend::loadmodule(path+"/lib"+module+"backend.so");
81 } else if (module[0]=='/' || (module[0]=='.' && module[1]=='/') || (module[0]=='.' && module[1]=='.')) {
82 // absolute or current path
83 res = UeberBackend::loadmodule(module);
84 } else {
85 res = UeberBackend::loadmodule(path+"/"+module);
86 }
87
88 if (res == false) {
89 return false;
90 }
91 }
92 return true;
93 }
94
95 void UeberBackend::go(void)
96 {
97 pthread_mutex_lock(&d_mut);
98 d_go=true;
99 pthread_cond_broadcast(&d_cond);
100 pthread_mutex_unlock(&d_mut);
101 }
102
103 bool UeberBackend::getDomainInfo(const DNSName &domain, DomainInfo &di, bool getSerial)
104 {
105 for(vector<DNSBackend *>::const_iterator i=backends.begin();i!=backends.end();++i)
106 if((*i)->getDomainInfo(domain, di, getSerial))
107 return true;
108 return false;
109 }
110
111 bool UeberBackend::createDomain(const DNSName &domain)
112 {
113 for(DNSBackend* mydb : backends) {
114 if(mydb->createDomain(domain)) {
115 return true;
116 }
117 }
118 return false;
119 }
120
121 bool UeberBackend::doesDNSSEC()
122 {
123 for(auto* db : backends) {
124 if(db->doesDNSSEC())
125 return true;
126 }
127 return false;
128 }
129
130 bool UeberBackend::addDomainKey(const DNSName& name, const DNSBackend::KeyData& key, int64_t& id)
131 {
132 id = -1;
133 for(DNSBackend* db : backends) {
134 if(db->addDomainKey(name, key, id))
135 return true;
136 }
137 return false;
138 }
139 bool UeberBackend::getDomainKeys(const DNSName& name, std::vector<DNSBackend::KeyData>& keys)
140 {
141 for(DNSBackend* db : backends) {
142 if(db->getDomainKeys(name, keys))
143 return true;
144 }
145 return false;
146 }
147
148 bool UeberBackend::getAllDomainMetadata(const DNSName& name, std::map<std::string, std::vector<std::string> >& meta)
149 {
150 for(DNSBackend* db : backends) {
151 if(db->getAllDomainMetadata(name, meta))
152 return true;
153 }
154 return false;
155 }
156
157 bool UeberBackend::getDomainMetadata(const DNSName& name, const std::string& kind, std::vector<std::string>& meta)
158 {
159 for(DNSBackend* db : backends) {
160 if(db->getDomainMetadata(name, kind, meta))
161 return true;
162 }
163 return false;
164 }
165
166 bool UeberBackend::setDomainMetadata(const DNSName& name, const std::string& kind, const std::vector<std::string>& meta)
167 {
168 for(DNSBackend* db : backends) {
169 if(db->setDomainMetadata(name, kind, meta))
170 return true;
171 }
172 return false;
173 }
174
175 bool UeberBackend::activateDomainKey(const DNSName& name, unsigned int id)
176 {
177 for(DNSBackend* db : backends) {
178 if(db->activateDomainKey(name, id))
179 return true;
180 }
181 return false;
182 }
183
184 bool UeberBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
185 {
186 for(DNSBackend* db : backends) {
187 if(db->deactivateDomainKey(name, id))
188 return true;
189 }
190 return false;
191 }
192
193 bool UeberBackend::publishDomainKey(const DNSName& name, unsigned int id)
194 {
195 for(DNSBackend* db : backends) {
196 if(db->publishDomainKey(name, id))
197 return true;
198 }
199 return false;
200 }
201
202 bool UeberBackend::unpublishDomainKey(const DNSName& name, unsigned int id)
203 {
204 for(DNSBackend* db : backends) {
205 if(db->unpublishDomainKey(name, id))
206 return true;
207 }
208 return false;
209 }
210
211
212 bool UeberBackend::removeDomainKey(const DNSName& name, unsigned int id)
213 {
214 for(DNSBackend* db : backends) {
215 if(db->removeDomainKey(name, id))
216 return true;
217 }
218 return false;
219 }
220
221
222 bool UeberBackend::getTSIGKey(const DNSName& name, DNSName* algorithm, string* content)
223 {
224 for(DNSBackend* db : backends) {
225 if(db->getTSIGKey(name, algorithm, content))
226 return true;
227 }
228 return false;
229 }
230
231
232 bool UeberBackend::setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content)
233 {
234 for(DNSBackend* db : backends) {
235 if(db->setTSIGKey(name, algorithm, content))
236 return true;
237 }
238 return false;
239 }
240
241 bool UeberBackend::deleteTSIGKey(const DNSName& name)
242 {
243 for(DNSBackend* db : backends) {
244 if(db->deleteTSIGKey(name))
245 return true;
246 }
247 return false;
248 }
249
250 bool UeberBackend::getTSIGKeys(std::vector< struct TSIGKey > &keys)
251 {
252 for(DNSBackend* db : backends) {
253 db->getTSIGKeys(keys);
254 }
255 return true;
256 }
257
258 void UeberBackend::reload()
259 {
260 for ( vector< DNSBackend * >::iterator i = backends.begin(); i != backends.end(); ++i )
261 {
262 ( *i )->reload();
263 }
264 }
265
266 void UeberBackend::rediscover(string *status)
267 {
268
269 for ( vector< DNSBackend * >::iterator i = backends.begin(); i != backends.end(); ++i )
270 {
271 string tmpstr;
272 ( *i )->rediscover(&tmpstr);
273 if(status)
274 *status+=tmpstr + (i!=backends.begin() ? "\n" : "");
275 }
276 }
277
278
279 void UeberBackend::getUnfreshSlaveInfos(vector<DomainInfo>* domains)
280 {
281 for ( vector< DNSBackend * >::iterator i = backends.begin(); i != backends.end(); ++i )
282 {
283 ( *i )->getUnfreshSlaveInfos( domains );
284 }
285 }
286
287
288
289 void UeberBackend::getUpdatedMasters(vector<DomainInfo>* domains)
290 {
291 for ( vector< DNSBackend * >::iterator i = backends.begin(); i != backends.end(); ++i )
292 {
293 ( *i )->getUpdatedMasters( domains );
294 }
295 }
296
297 bool UeberBackend::getAuth(const DNSName &target, const QType& qtype, SOAData* sd, bool cachedOk)
298 {
299 // A backend can respond to our authority request with the 'best' match it
300 // has. For example, when asked for a.b.c.example.com. it might respond with
301 // com. We then store that and keep querying the other backends in case one
302 // of them has a more specific zone but don't bother asking this specific
303 // backend again for b.c.example.com., c.example.com. and example.com.
304 // If a backend has no match it may respond with an empty qname.
305
306 bool found = false;
307 int cstat;
308 DNSName shorter(target);
309 vector<pair<size_t, SOAData> > bestmatch (backends.size(), make_pair(target.wirelength()+1, SOAData()));
310 do {
311
312 // Check cache
313 if(cachedOk && (d_cache_ttl || d_negcache_ttl)) {
314 d_question.qtype = QType::SOA;
315 d_question.qname = shorter;
316 d_question.zoneId = -1;
317
318 cstat = cacheHas(d_question,d_answers);
319
320 if(cstat == 1 && !d_answers.empty() && d_cache_ttl) {
321 DLOG(g_log<<Logger::Error<<"has pos cache entry: "<<shorter<<endl);
322 fillSOAData(d_answers[0], *sd);
323
324 sd->db = 0;
325 sd->qname = shorter;
326 goto found;
327 } else if(cstat == 0 && d_negcache_ttl) {
328 DLOG(g_log<<Logger::Error<<"has neg cache entry: "<<shorter<<endl);
329 continue;
330 }
331 }
332
333 // Check backends
334 {
335 vector<DNSBackend *>::const_iterator i = backends.begin();
336 vector<pair<size_t, SOAData> >::iterator j = bestmatch.begin();
337 for(; i != backends.end() && j != bestmatch.end(); ++i, ++j) {
338
339 DLOG(g_log<<Logger::Error<<"backend: "<<i-backends.begin()<<", qname: "<<shorter<<endl);
340
341 if(j->first < shorter.wirelength()) {
342 DLOG(g_log<<Logger::Error<<"skipped, we already found a shorter best match in this backend: "<<j->second.qname<<endl);
343 continue;
344 } else if(j->first == shorter.wirelength()) {
345 DLOG(g_log<<Logger::Error<<"use shorter best match: "<<j->second.qname<<endl);
346 *sd = j->second;
347 break;
348 } else {
349 DLOG(g_log<<Logger::Error<<"lookup: "<<shorter<<endl);
350 if((*i)->getAuth(shorter, sd)) {
351 DLOG(g_log<<Logger::Error<<"got: "<<sd->qname<<endl);
352 if(!sd->qname.empty() && !shorter.isPartOf(sd->qname)) {
353 throw PDNSException("getAuth() returned an SOA for the wrong zone. Zone '"+sd->qname.toLogString()+"' is not part of '"+shorter.toLogString()+"'");
354 }
355 j->first = sd->qname.wirelength();
356 j->second = *sd;
357 if(sd->qname == shorter) {
358 break;
359 }
360 } else {
361 DLOG(g_log<<Logger::Error<<"no match for: "<<shorter<<endl);
362 }
363 }
364 }
365
366 // Add to cache
367 if(i == backends.end()) {
368 if(d_negcache_ttl) {
369 DLOG(g_log<<Logger::Error<<"add neg cache entry:"<<shorter<<endl);
370 d_question.qname=shorter;
371 addNegCache(d_question);
372 }
373 continue;
374 } else if(d_cache_ttl) {
375 DLOG(g_log<<Logger::Error<<"add pos cache entry: "<<sd->qname<<endl);
376 d_question.qtype = QType::SOA;
377 d_question.qname = sd->qname;
378 d_question.zoneId = -1;
379
380 DNSZoneRecord rr;
381 rr.dr.d_name = sd->qname;
382 rr.dr.d_type = QType::SOA;
383 rr.dr.d_content = makeSOAContent(*sd);
384 rr.dr.d_ttl = sd->ttl;
385 rr.domain_id = sd->domain_id;
386
387 addCache(d_question, {rr});
388 }
389 }
390
391 found:
392 if(found == (qtype == QType::DS) || target != shorter) {
393 DLOG(g_log<<Logger::Error<<"found: "<<sd->qname<<endl);
394 return true;
395 } else {
396 DLOG(g_log<<Logger::Error<<"chasing next: "<<sd->qname<<endl);
397 found = true;
398 }
399
400 } while(shorter.chopOff());
401 return found;
402 }
403
404 bool UeberBackend::getSOA(const DNSName &domain, SOAData &sd)
405 {
406 d_question.qtype=QType::SOA;
407 d_question.qname=domain;
408 d_question.zoneId=-1;
409
410 int cstat=cacheHas(d_question,d_answers);
411 if(cstat==0) { // negative
412 return false;
413 }
414 else if(cstat==1 && !d_answers.empty()) {
415 fillSOAData(d_answers[0],sd);
416 sd.domain_id=d_answers[0].domain_id;
417 sd.ttl=d_answers[0].dr.d_ttl;
418 sd.db=0;
419 return true;
420 }
421
422 // not found in neg. or pos. cache, look it up
423 return getSOAUncached(domain, sd);
424 }
425
426 bool UeberBackend::getSOAUncached(const DNSName &domain, SOAData &sd)
427 {
428 d_question.qtype=QType::SOA;
429 d_question.qname=domain;
430 d_question.zoneId=-1;
431
432 for(vector<DNSBackend *>::const_iterator i=backends.begin();i!=backends.end();++i)
433 if((*i)->getSOA(domain, sd)) {
434 if(domain != sd.qname) {
435 throw PDNSException("getSOA() returned an SOA for the wrong zone. Question: '"+domain.toLogString()+"', answer: '"+sd.qname.toLogString()+"'");
436 }
437 if(d_cache_ttl) {
438 DNSZoneRecord rr;
439 rr.dr.d_name = sd.qname;
440 rr.dr.d_type = QType::SOA;
441 rr.dr.d_content = makeSOAContent(sd);
442 rr.dr.d_ttl = sd.ttl;
443 rr.domain_id = sd.domain_id;
444
445 addCache(d_question, {rr});
446
447 }
448 return true;
449 }
450
451 if(d_negcache_ttl)
452 addNegCache(d_question);
453 return false;
454 }
455
456 bool UeberBackend::superMasterBackend(const string &ip, const DNSName &domain, const vector<DNSResourceRecord>&nsset, string *nameserver, string *account, DNSBackend **db)
457 {
458 for(vector<DNSBackend *>::const_iterator i=backends.begin();i!=backends.end();++i)
459 if((*i)->superMasterBackend(ip, domain, nsset, nameserver, account, db))
460 return true;
461 return false;
462 }
463
464 UeberBackend::UeberBackend(const string &pname)
465 {
466 pthread_mutex_lock(&instances_lock);
467 instances.push_back(this); // report to the static list of ourself
468 pthread_mutex_unlock(&instances_lock);
469
470 d_negcached=0;
471 d_ancount=0;
472 d_domain_id=-1;
473 d_cached=0;
474 d_cache_ttl = ::arg().asNum("query-cache-ttl");
475 d_negcache_ttl = ::arg().asNum("negquery-cache-ttl");
476
477 d_tid=pthread_self();
478 d_stale=false;
479
480 backends=BackendMakers().all(pname=="key-only");
481 }
482
483 static void del(DNSBackend* d)
484 {
485 delete d;
486 }
487
488 void UeberBackend::cleanup()
489 {
490 pthread_mutex_lock(&instances_lock);
491
492 remove(instances.begin(),instances.end(),this);
493 instances.resize(instances.size()-1);
494
495 pthread_mutex_unlock(&instances_lock);
496
497 for_each(backends.begin(),backends.end(),del);
498 }
499
500 // returns -1 for miss, 0 for negative match, 1 for hit
501 int UeberBackend::cacheHas(const Question &q, vector<DNSZoneRecord> &rrs)
502 {
503 extern AuthQueryCache QC;
504
505 if(!d_cache_ttl && ! d_negcache_ttl) {
506 return -1;
507 }
508
509 rrs.clear();
510 // g_log<<Logger::Warning<<"looking up: '"<<q.qname+"'|N|"+q.qtype.getName()+"|"+itoa(q.zoneId)<<endl;
511
512 bool ret=QC.getEntry(q.qname, q.qtype, rrs, q.zoneId); // think about lowercasing here
513 if(!ret) {
514 return -1;
515 }
516 if(rrs.empty()) // negatively cached
517 return 0;
518
519 return 1;
520 }
521
522 void UeberBackend::addNegCache(const Question &q)
523 {
524 extern AuthQueryCache QC;
525 if(!d_negcache_ttl)
526 return;
527 // we should also not be storing negative answers if a pipebackend does scopeMask, but we can't pass a negative scopeMask in an empty set!
528 QC.insert(q.qname, q.qtype, vector<DNSZoneRecord>(), d_negcache_ttl, q.zoneId);
529 }
530
531 void UeberBackend::addCache(const Question &q, vector<DNSZoneRecord> &&rrs)
532 {
533 extern AuthQueryCache QC;
534
535 if(!d_cache_ttl)
536 return;
537
538 unsigned int store_ttl = d_cache_ttl;
539 for(const auto& rr : rrs) {
540 if (rr.dr.d_ttl < d_cache_ttl)
541 store_ttl = rr.dr.d_ttl;
542 if (rr.scopeMask)
543 return;
544 }
545
546 QC.insert(q.qname, q.qtype, std::move(rrs), store_ttl, q.zoneId);
547 }
548
549 void UeberBackend::alsoNotifies(const DNSName &domain, set<string> *ips)
550 {
551 for ( vector< DNSBackend * >::iterator i = backends.begin(); i != backends.end(); ++i )
552 (*i)->alsoNotifies(domain,ips);
553 }
554
555 UeberBackend::~UeberBackend()
556 {
557 DLOG(g_log<<Logger::Error<<"UeberBackend destructor called, removing ourselves from instances, and deleting our backends"<<endl);
558 cleanup();
559 }
560
561 // this handle is more magic than most
562 void UeberBackend::lookup(const QType &qtype,const DNSName &qname, int zoneId, DNSPacket *pkt_p)
563 {
564 if(d_stale) {
565 g_log<<Logger::Error<<"Stale ueberbackend received question, signalling that we want to be recycled"<<endl;
566 throw PDNSException("We are stale, please recycle");
567 }
568
569 DLOG(g_log<<"UeberBackend received question for "<<qtype.getName()<<" of "<<qname<<endl);
570 if(!d_go) {
571 pthread_mutex_lock(&d_mut);
572 while (d_go==false) {
573 g_log<<Logger::Error<<"UeberBackend is blocked, waiting for 'go'"<<endl;
574 pthread_cond_wait(&d_cond, &d_mut);
575 g_log<<Logger::Error<<"Broadcast received, unblocked"<<endl;
576 }
577 pthread_mutex_unlock(&d_mut);
578 }
579
580 d_domain_id=zoneId;
581
582 d_handle.i=0;
583 d_handle.qtype=qtype;
584 d_handle.qname=qname;
585 d_handle.pkt_p=pkt_p;
586 d_ancount=0;
587
588 if(!backends.size()) {
589 g_log<<Logger::Error<<"No database backends available - unable to answer questions."<<endl;
590 d_stale=true; // please recycle us!
591 throw PDNSException("We are stale, please recycle");
592 }
593 else {
594 d_question.qtype=qtype;
595 d_question.qname=qname;
596 d_question.zoneId=zoneId;
597 int cstat=cacheHas(d_question, d_answers);
598 if(cstat<0) { // nothing
599 // cout<<"UeberBackend::lookup("<<qname<<"|"<<DNSRecordContent::NumberToType(qtype.getCode())<<"): uncached"<<endl;
600 d_negcached=d_cached=false;
601 d_answers.clear();
602 (d_handle.d_hinterBackend=backends[d_handle.i++])->lookup(qtype, qname,zoneId,pkt_p);
603 }
604 else if(cstat==0) {
605 // cout<<"UeberBackend::lookup("<<qname<<"|"<<DNSRecordContent::NumberToType(qtype.getCode())<<"): NEGcached"<<endl;
606 d_negcached=true;
607 d_cached=false;
608 d_answers.clear();
609 }
610 else {
611 // cout<<"UeberBackend::lookup("<<qname<<"|"<<DNSRecordContent::NumberToType(qtype.getCode())<<"): CACHED"<<endl;
612 d_negcached=false;
613 d_cached=true;
614 d_cachehandleiter = d_answers.begin();
615 }
616 }
617
618 d_handle.parent=this;
619 }
620
621 void UeberBackend::getAllDomains(vector<DomainInfo> *domains, bool include_disabled) {
622 for (vector<DNSBackend*>::iterator i = backends.begin(); i != backends.end(); ++i )
623 {
624 (*i)->getAllDomains(domains, include_disabled);
625 }
626 }
627
628 bool UeberBackend::get(DNSZoneRecord &rr)
629 {
630 // cout<<"UeberBackend::get(DNSZoneRecord) called"<<endl;
631 if(d_negcached) {
632 return false;
633 }
634
635 if(d_cached) {
636 if(d_cachehandleiter != d_answers.end()) {
637 rr=*d_cachehandleiter++;;
638 return true;
639 }
640 return false;
641 }
642 if(!d_handle.get(rr)) {
643 // cout<<"end of ueberbackend get, seeing if we should cache"<<endl;
644 if(!d_ancount && d_handle.qname.countLabels()) {// don't cache axfr
645 // cout<<"adding negcache"<<endl;
646 addNegCache(d_question);
647 }
648 else {
649 // cout<<"adding query cache"<<endl;
650 addCache(d_question, std::move(d_answers));
651 }
652 d_answers.clear();
653 return false;
654 }
655
656 rr.dr.d_place=DNSResourceRecord::ANSWER;
657
658 d_ancount++;
659 d_answers.push_back(rr);
660 return true;
661 }
662
663 bool UeberBackend::searchRecords(const string& pattern, int maxResults, vector<DNSResourceRecord>& result)
664 {
665 bool rc = false;
666 for ( vector< DNSBackend * >::iterator i = backends.begin(); result.size() < static_cast<vector<DNSResourceRecord>::size_type>(maxResults) && i != backends.end(); ++i )
667 if ((*i)->searchRecords(pattern, maxResults - result.size(), result)) rc = true;
668 return rc;
669 }
670
671 bool UeberBackend::searchComments(const string& pattern, int maxResults, vector<Comment>& result)
672 {
673 bool rc = false;
674 for ( vector< DNSBackend * >::iterator i = backends.begin(); result.size() < static_cast<vector<Comment>::size_type>(maxResults) && i != backends.end(); ++i )
675 if ((*i)->searchComments(pattern, maxResults - result.size(), result)) rc = true;
676 return rc;
677 }
678
679 AtomicCounter UeberBackend::handle::instances(0);
680
681 UeberBackend::handle::handle()
682 {
683 // g_log<<Logger::Warning<<"Handle instances: "<<instances<<endl;
684 ++instances;
685 parent=NULL;
686 d_hinterBackend=NULL;
687 pkt_p=NULL;
688 i=0;
689 }
690
691 UeberBackend::handle::~handle()
692 {
693 --instances;
694 }
695
696 bool UeberBackend::handle::get(DNSZoneRecord &r)
697 {
698 DLOG(g_log << "Ueber get() was called for a "<<qtype.getName()<<" record" << endl);
699 bool isMore=false;
700 while(d_hinterBackend && !(isMore=d_hinterBackend->get(r))) { // this backend out of answers
701 if(i<parent->backends.size()) {
702 DLOG(g_log<<"Backend #"<<i<<" of "<<parent->backends.size()
703 <<" out of answers, taking next"<<endl);
704
705 d_hinterBackend=parent->backends[i++];
706 d_hinterBackend->lookup(qtype,qname,parent->d_domain_id,pkt_p);
707 }
708 else
709 break;
710
711 DLOG(g_log<<"Now asking backend #"<<i<<endl);
712 }
713
714 if(!isMore && i==parent->backends.size()) {
715 DLOG(g_log<<"UeberBackend reached end of backends"<<endl);
716 return false;
717 }
718
719 DLOG(g_log<<"Found an answering backend - will not try another one"<<endl);
720 i=parent->backends.size(); // don't go on to the next backend
721 return true;
722 }