data_source.cc 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311
  1. // Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. // $Id$
  15. #include <config.h>
  16. #include <cassert>
  17. #include <iomanip>
  18. #include <iostream>
  19. #include <vector>
  20. #include <boost/shared_ptr.hpp>
  21. #include <boost/foreach.hpp>
  22. #include <datasrc/cache.h>
  23. #include <datasrc/data_source.h>
  24. #include <datasrc/query.h>
  25. #include <dns/util/base32hex.h>
  26. #include <dns/buffer.h>
  27. #include <dns/message.h>
  28. #include <dns/name.h>
  29. #include <dns/rdataclass.h>
  30. #include <dns/rrset.h>
  31. #include <dns/rrsetlist.h>
  32. #include <dns/util/sha1.h>
  33. #include <cc/data.h>
  34. #define RETERR(x) do { \
  35. DataSrc::Result r = (x); \
  36. if (r != DataSrc::SUCCESS) \
  37. return (r); \
  38. } while (0)
  39. using namespace std;
  40. using namespace isc::dns;
  41. using namespace isc::dns::rdata;
  42. namespace isc {
  43. namespace datasrc {
  44. typedef boost::shared_ptr<const Nsec3Param> ConstNsec3ParamPtr;
  45. class ZoneInfo {
  46. public:
  47. ZoneInfo(DataSrc* ts,
  48. const isc::dns::Name& n,
  49. const isc::dns::RRClass& c,
  50. const isc::dns::RRType& t = isc::dns::RRType::ANY()) :
  51. top_source_(ts),
  52. dsm_(((t == RRType::DS() && n.getLabelCount() != 1)
  53. ? n.split(1, n.getLabelCount() - 1) : n),
  54. c)
  55. {}
  56. const Name* getEnclosingZone() {
  57. if (dsm_.getEnclosingZone() == NULL) {
  58. top_source_->findClosestEnclosure(dsm_);
  59. }
  60. return (dsm_.getEnclosingZone());
  61. }
  62. const DataSrc* getDataSource() {
  63. if (dsm_.getDataSource() == NULL) {
  64. top_source_->findClosestEnclosure(dsm_);
  65. }
  66. return (dsm_.getDataSource());
  67. }
  68. private:
  69. const DataSrc* top_source_;
  70. DataSrcMatch dsm_;
  71. };
  72. // Add a task to the query task queue to look up additional data
  73. // (i.e., address records for the names included in NS or MX records)
  74. void
  75. getAdditional(Query& q, ConstRRsetPtr rrset) {
  76. if (!q.wantAdditional()) {
  77. return;
  78. }
  79. RdataIteratorPtr it = rrset->getRdataIterator();
  80. for (it->first(); !it->isLast(); it->next()) {
  81. const Rdata& rd(it->getCurrent());
  82. if (rrset->getType() == RRType::NS()) {
  83. const generic::NS& ns = dynamic_cast<const generic::NS&>(rd);
  84. q.tasks().push(QueryTaskPtr(
  85. new QueryTask(q, ns.getNSName(),
  86. Section::ADDITIONAL(),
  87. QueryTask::GLUE_QUERY,
  88. QueryTask::GETADDITIONAL)));
  89. } else if (rrset->getType() == RRType::MX()) {
  90. const generic::MX& mx = dynamic_cast<const generic::MX&>(rd);
  91. q.tasks().push(QueryTaskPtr(
  92. new QueryTask(q, mx.getMXName(),
  93. Section::ADDITIONAL(),
  94. QueryTask::NOGLUE_QUERY,
  95. QueryTask::GETADDITIONAL)));
  96. }
  97. }
  98. }
  99. // Synthesize a CNAME answer, for the benefit of clients that don't
  100. // understand DNAME
  101. void
  102. synthesizeCname(QueryTaskPtr task, RRsetPtr rrset, RRsetList& target) {
  103. RdataIteratorPtr it = rrset->getRdataIterator();
  104. // More than one DNAME RR in the RRset is illegal, so we only have
  105. // to process the first one.
  106. it->first();
  107. if (it->isLast()) {
  108. return;
  109. }
  110. const Rdata& rd(it->getCurrent());
  111. const generic::DNAME& dname = dynamic_cast<const generic::DNAME&>(rd);
  112. const Name& dname_target(dname.getDname());
  113. RRsetPtr cname(new RRset(task->qname, task->qclass, RRType::CNAME(),
  114. rrset->getTTL()));
  115. const int qnlen = task->qname.getLabelCount();
  116. const int dnlen = rrset->getName().getLabelCount();
  117. assert(qnlen > dnlen);
  118. const Name& prefix(task->qname.split(0, qnlen - dnlen));
  119. cname->addRdata(generic::CNAME(prefix.concatenate(dname_target)));
  120. target.addRRset(cname);
  121. }
  122. // Add a task to the query task queue to look up the data pointed
  123. // to by a CNAME record
  124. void
  125. chaseCname(Query& q, QueryTaskPtr task, RRsetPtr rrset) {
  126. RdataIteratorPtr it = rrset->getRdataIterator();
  127. // More than one CNAME RR in the RRset is illegal, so we only have
  128. // to process the first one.
  129. it->first();
  130. if (it->isLast()) {
  131. return;
  132. }
  133. // Stop chasing CNAMES after 16 lookups, to prevent loops
  134. if (q.tooMany()) {
  135. return;
  136. }
  137. q.tasks().push(QueryTaskPtr(
  138. new QueryTask(q, dynamic_cast<const generic::CNAME&>
  139. (it->getCurrent()).getCname(),
  140. task->qtype, Section::ANSWER(),
  141. QueryTask::FOLLOWCNAME)));
  142. }
  143. // Check the cache for data which can answer the current query task.
  144. bool
  145. checkCache(QueryTask& task, RRsetList& target) {
  146. HotCache& cache = task.q.getCache();
  147. RRsetList rrsets;
  148. RRsetPtr rrset;
  149. int count = 0;
  150. uint32_t flags = 0, cflags = 0;
  151. bool hit = false, found = false;
  152. switch (task.op) {
  153. case QueryTask::SIMPLE_QUERY: // Find exact RRset
  154. // ANY queries must be handled by the low-level data source,
  155. // or the results won't be guaranteed to be complete
  156. if (task.qtype == RRType::ANY() || task.qclass == RRClass::ANY()) {
  157. break;
  158. }
  159. hit = cache.retrieve(task.qname, task.qclass, task.qtype, rrset, flags);
  160. if (hit) {
  161. if (rrset) {
  162. rrsets.addRRset(rrset);
  163. target.append(rrsets);
  164. }
  165. task.flags = flags;
  166. return (true);
  167. }
  168. break;
  169. case QueryTask::AUTH_QUERY: // Find exact RRset or CNAME
  170. if (task.qtype == RRType::ANY() || task.qclass == RRClass::ANY()) {
  171. break;
  172. }
  173. hit = cache.retrieve(task.qname, task.qclass, task.qtype, rrset, flags);
  174. if (!hit || !rrset || (flags & DataSrc::CNAME_FOUND) != 0) {
  175. hit = cache.retrieve(task.qname, task.qclass, RRType::CNAME(),
  176. rrset, flags);
  177. }
  178. if (hit) {
  179. if (rrset) {
  180. rrsets.addRRset(rrset);
  181. target.append(rrsets);
  182. }
  183. task.flags = flags;
  184. return (true);
  185. }
  186. break;
  187. case QueryTask::GLUE_QUERY: // Find addresses
  188. case QueryTask::NOGLUE_QUERY:
  189. // (XXX: need to figure out how to deal with noglue case)
  190. flags = 0;
  191. hit = cache.retrieve(task.qname, task.qclass, RRType::A(),
  192. rrset, cflags);
  193. if (hit) {
  194. flags |= cflags;
  195. ++count;
  196. if (rrset) {
  197. rrsets.addRRset(rrset);
  198. found = true;
  199. }
  200. }
  201. hit = cache.retrieve(task.qname, task.qclass, RRType::AAAA(),
  202. rrset, flags);
  203. if (hit) {
  204. flags |= cflags;
  205. ++count;
  206. if (rrset) {
  207. rrsets.addRRset(rrset);
  208. found = true;
  209. }
  210. }
  211. if (count == 2) {
  212. if (found) {
  213. flags &= ~DataSrc::TYPE_NOT_FOUND;
  214. target.append(rrsets);
  215. }
  216. task.flags = flags;
  217. return (true);
  218. }
  219. break;
  220. case QueryTask::REF_QUERY: // Find NS, DS and/or DNAME
  221. flags = count = 0;
  222. hit = cache.retrieve(task.qname, task.qclass, RRType::NS(),
  223. rrset, cflags);
  224. if (hit) {
  225. flags |= cflags;
  226. ++count;
  227. if (rrset) {
  228. rrsets.addRRset(rrset);
  229. found = true;
  230. }
  231. }
  232. hit = cache.retrieve(task.qname, task.qclass, RRType::DS(),
  233. rrset, flags);
  234. if (hit) {
  235. flags |= cflags;
  236. ++count;
  237. if (rrset) {
  238. rrsets.addRRset(rrset);
  239. found = true;
  240. }
  241. }
  242. hit = cache.retrieve(task.qname, task.qclass, RRType::DNAME(),
  243. rrset, flags);
  244. if (hit) {
  245. flags |= cflags;
  246. ++count;
  247. if (rrset) {
  248. rrsets.addRRset(rrset);
  249. found = true;
  250. }
  251. }
  252. if (count == 3) {
  253. if (found) {
  254. flags &= ~DataSrc::TYPE_NOT_FOUND;
  255. flags &= DataSrc::REFERRAL;
  256. target.append(rrsets);
  257. }
  258. task.flags = flags;
  259. return (true);
  260. }
  261. break;
  262. }
  263. return (false);
  264. }
  265. // Carry out the query specified in a QueryTask object
  266. DataSrc::Result
  267. doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
  268. HotCache& cache = task.q.getCache();
  269. RRsetPtr rrset;
  270. // First, check the cache for matching data
  271. if (checkCache(task, target)) {
  272. return (DataSrc::SUCCESS);
  273. }
  274. // Requested data weren't in the cache (or were, but had expired),
  275. // so now we proceed with the low-level data source lookup, and cache
  276. // whatever we find.
  277. const DataSrc* ds = zoneinfo.getDataSource();
  278. const Name* const zonename = zoneinfo.getEnclosingZone();
  279. if (ds == NULL) {
  280. task.flags |= DataSrc::NO_SUCH_ZONE;
  281. return (DataSrc::SUCCESS);
  282. }
  283. DataSrc::Result result;
  284. switch (task.op) {
  285. case QueryTask::SIMPLE_QUERY:
  286. result = ds->findExactRRset(task.qname, task.qclass, task.qtype,
  287. target, task.flags, zonename);
  288. if (result != DataSrc::SUCCESS) {
  289. return (result);
  290. }
  291. if (task.qclass == RRClass::ANY()) {
  292. // XXX: Currently, RRsetList::findRRset() doesn't handle
  293. // ANY queries, and without that we can't cache the results,
  294. // so we just return in that case.
  295. return (result);
  296. }
  297. if (task.flags == 0) {
  298. rrset = target.findRRset(task.qtype, task.qclass);
  299. assert(rrset);
  300. cache.addPositive(rrset, task.flags);
  301. } else {
  302. cache.addNegative(task.qname, task.qclass, task.qtype, task.flags);
  303. }
  304. return (result);
  305. case QueryTask::AUTH_QUERY:
  306. result = ds->findRRset(task.qname, task.qclass, task.qtype,
  307. target, task.flags, zonename);
  308. if (result != DataSrc::SUCCESS) {
  309. return (result);
  310. }
  311. if (task.qclass == RRClass::ANY()) {
  312. return (result);
  313. }
  314. if (task.qtype == RRType::ANY()) {
  315. BOOST_FOREACH(RRsetPtr rr, target) {
  316. cache.addPositive(rr, task.flags);
  317. }
  318. } else if ((task.flags & DataSrc::CNAME_FOUND) != 0) {
  319. cache.addNegative(task.qname, task.qclass, task.qtype, task.flags);
  320. rrset = target.findRRset(RRType::CNAME(), task.qclass);
  321. assert(rrset);
  322. cache.addPositive(rrset, task.flags);
  323. } else if ((task.flags & DataSrc::DATA_NOT_FOUND) == 0) {
  324. if (task.qtype != RRType::CNAME()) {
  325. cache.addNegative(task.qname, task.qclass, RRType::CNAME(),
  326. task.flags);
  327. }
  328. rrset = target.findRRset(task.qtype, task.qclass);
  329. assert(rrset);
  330. cache.addPositive(rrset, task.flags);
  331. } else {
  332. cache.addNegative(task.qname, task.qclass, task.qtype, task.flags);
  333. }
  334. return (result);
  335. case QueryTask::GLUE_QUERY:
  336. case QueryTask::NOGLUE_QUERY:
  337. result = ds->findAddrs(task.qname, task.qclass, target,
  338. task.flags, zonename);
  339. if (result != DataSrc::SUCCESS) {
  340. return (result);
  341. }
  342. if (task.qclass == RRClass::ANY()) {
  343. return (result);
  344. }
  345. rrset = target.findRRset(RRType::A(), task.qclass);
  346. if (rrset) {
  347. cache.addPositive(rrset, task.flags);
  348. } else {
  349. cache.addNegative(task.qname, task.qclass, RRType::A(), task.flags);
  350. }
  351. rrset = target.findRRset(RRType::AAAA(), task.qclass);
  352. if (rrset) {
  353. cache.addPositive(rrset, task.flags);
  354. } else {
  355. cache.addNegative(task.qname, task.qclass, RRType::AAAA(),
  356. task.flags);
  357. }
  358. return (result);
  359. case QueryTask::REF_QUERY:
  360. result = ds->findReferral(task.qname, task.qclass, target,
  361. task.flags, zonename);
  362. if (result != DataSrc::SUCCESS) {
  363. return (result);
  364. }
  365. if (task.qclass == RRClass::ANY()) {
  366. return (result);
  367. }
  368. rrset = target.findRRset(RRType::NS(), task.qclass);
  369. if (rrset) {
  370. cache.addPositive(rrset, task.flags);
  371. } else {
  372. cache.addNegative(task.qname, task.qclass, RRType::NS(),
  373. task.flags);
  374. }
  375. rrset = target.findRRset(RRType::DS(), task.qclass);
  376. if (rrset) {
  377. cache.addPositive(rrset, task.flags);
  378. } else {
  379. cache.addNegative(task.qname, task.qclass, RRType::DS(),
  380. task.flags);
  381. }
  382. rrset = target.findRRset(RRType::DNAME(), task.qclass);
  383. if (rrset) {
  384. cache.addPositive(rrset, task.flags);
  385. } else {
  386. cache.addNegative(task.qname, task.qclass, RRType::DNAME(),
  387. task.flags);
  388. }
  389. return (result);
  390. }
  391. // Not reached
  392. return (DataSrc::ERROR);
  393. }
  394. // Add an RRset (and its associated RRSIG) to a message section,
  395. // checking first to ensure that there isn't already an RRset with
  396. // the same name and type.
  397. inline void
  398. addToMessage(Query& q, const Section& sect, RRsetPtr rrset,
  399. bool no_dnssec = false)
  400. {
  401. Message& m = q.message();
  402. if (no_dnssec) {
  403. if (rrset->getType() == RRType::RRSIG() || !m.hasRRset(sect, rrset)) {
  404. m.addRRset(sect, rrset, false);
  405. }
  406. } else {
  407. if (!m.hasRRset(sect, rrset)) {
  408. m.addRRset(sect, rrset, q.wantDnssec());
  409. }
  410. }
  411. }
  412. // Copy referral information into the authority section of a message
  413. inline void
  414. copyAuth(Query& q, RRsetList& auth) {
  415. BOOST_FOREACH(RRsetPtr rrset, auth) {
  416. if (rrset->getType() == RRType::DNAME()) {
  417. continue;
  418. }
  419. if (rrset->getType() == RRType::DS() && !q.wantDnssec()) {
  420. continue;
  421. }
  422. addToMessage(q, Section::AUTHORITY(), rrset);
  423. getAdditional(q, rrset);
  424. }
  425. }
  426. // Query for referrals (i.e., NS/DS or DNAME) at a given name
  427. inline bool
  428. refQuery(const Query& q, const Name& name, ZoneInfo& zoneinfo,
  429. RRsetList& target)
  430. {
  431. QueryTask newtask(q, name, QueryTask::REF_QUERY);
  432. if (doQueryTask(newtask, zoneinfo, target) != DataSrc::SUCCESS) {
  433. // Lookup failed
  434. return (false);
  435. }
  436. // Referral bit is expected, so clear it when checking flags
  437. if ((newtask.flags & ~DataSrc::REFERRAL) != 0) {
  438. return (false);
  439. }
  440. return (true);
  441. }
  442. // Match downward, from the zone apex to the query name, looking for
  443. // referrals. Note that we exclude the apex name and query name themselves;
  444. // they'll be handled in a normal lookup in the zone.
  445. inline bool
  446. hasDelegation(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo) {
  447. const Name* const zonename = zoneinfo.getEnclosingZone();
  448. if (zonename == NULL) {
  449. if (task->state == QueryTask::GETANSWER) {
  450. q.message().setRcode(Rcode::REFUSED());
  451. }
  452. return (false);
  453. }
  454. const int diff = task->qname.getLabelCount() - zonename->getLabelCount();
  455. if (diff > 1) {
  456. bool found = false;
  457. RRsetList ref;
  458. for (int i = diff - 1; i > 0; --i) {
  459. const Name sub(task->qname.split(i));
  460. if (refQuery(q, sub, zoneinfo, ref)) {
  461. found = true;
  462. break;
  463. }
  464. }
  465. // Found a referral while getting additional data
  466. // for something other than NS; we skip it.
  467. if (found && task->op == QueryTask::NOGLUE_QUERY) {
  468. return (true);
  469. }
  470. // Found a referral while getting answer data;
  471. // send a delegation.
  472. if (found) {
  473. RRsetPtr r = ref.findRRset(RRType::DNAME(), q.qclass());
  474. if (r != NULL) {
  475. RRsetList syn;
  476. addToMessage(q, Section::ANSWER(), r);
  477. q.message().setHeaderFlag(MessageFlag::AA());
  478. synthesizeCname(task, r, syn);
  479. if (syn.size() == 1) {
  480. addToMessage(q, Section::ANSWER(),
  481. syn.findRRset(RRType::CNAME(), q.qclass()));
  482. chaseCname(q, task, syn.findRRset(RRType::CNAME(),
  483. q.qclass()));
  484. return (true);
  485. }
  486. }
  487. copyAuth(q, ref);
  488. return (true);
  489. }
  490. }
  491. // We appear to have authoritative data; set the header
  492. // flag. (We may clear it later if we find a referral
  493. // at the actual qname node.)
  494. if (task->op == QueryTask::AUTH_QUERY &&
  495. task->state == QueryTask::GETANSWER) {
  496. q.message().setHeaderFlag(MessageFlag::AA());
  497. }
  498. return (false);
  499. }
  500. inline DataSrc::Result
  501. addSOA(Query& q, ZoneInfo& zoneinfo) {
  502. RRsetList soa;
  503. const Name* const zonename = zoneinfo.getEnclosingZone();
  504. QueryTask newtask(q, *zonename, RRType::SOA(), QueryTask::SIMPLE_QUERY);
  505. RETERR(doQueryTask(newtask, zoneinfo, soa));
  506. if (newtask.flags != 0) {
  507. return (DataSrc::ERROR);
  508. }
  509. addToMessage(q, Section::AUTHORITY(),
  510. soa.findRRset(RRType::SOA(), q.qclass()));
  511. return (DataSrc::SUCCESS);
  512. }
  513. inline DataSrc::Result
  514. addNSEC(Query& q, const Name& name, ZoneInfo& zoneinfo) {
  515. RRsetList nsec;
  516. QueryTask newtask(q, name, RRType::NSEC(), QueryTask::SIMPLE_QUERY);
  517. RETERR(doQueryTask(newtask, zoneinfo, nsec));
  518. if (newtask.flags == 0) {
  519. addToMessage(q, Section::AUTHORITY(),
  520. nsec.findRRset(RRType::NSEC(), q.qclass()));
  521. }
  522. return (DataSrc::SUCCESS);
  523. }
  524. inline DataSrc::Result
  525. getNsec3(Query& q, ZoneInfo& zoneinfo, string& hash, RRsetPtr& target) {
  526. const DataSrc* ds = zoneinfo.getDataSource();
  527. const Name* const zonename = zoneinfo.getEnclosingZone();
  528. if (ds == NULL) {
  529. q.message().setRcode(Rcode::SERVFAIL());
  530. return (DataSrc::ERROR);
  531. }
  532. RRsetList rl;
  533. RETERR(ds->findCoveringNSEC3(*zonename, hash, rl));
  534. target = rl.findRRset(RRType::NSEC3(), q.qclass());
  535. return (DataSrc::SUCCESS);
  536. }
  537. ConstNsec3ParamPtr
  538. getNsec3Param(Query& q, ZoneInfo& zoneinfo) {
  539. DataSrc::Result result;
  540. RRsetList nsec3param;
  541. const Name* const zonename = zoneinfo.getEnclosingZone();
  542. QueryTask newtask(q, *zonename, RRType::NSEC3PARAM(),
  543. QueryTask::SIMPLE_QUERY);
  544. result = doQueryTask(newtask, zoneinfo, nsec3param);
  545. newtask.flags &= ~DataSrc::REFERRAL;
  546. if (result != DataSrc::SUCCESS || newtask.flags != 0) {
  547. return (ConstNsec3ParamPtr());
  548. }
  549. RRsetPtr rrset = nsec3param.findRRset(RRType::NSEC3PARAM(), q.qclass());
  550. if (!rrset) {
  551. return (ConstNsec3ParamPtr());
  552. }
  553. // XXX: currently only one NSEC3 chain per zone is supported;
  554. // we will need to revisit this.
  555. RdataIteratorPtr it = rrset->getRdataIterator();
  556. it->first();
  557. if (it->isLast()) {
  558. return (ConstNsec3ParamPtr());
  559. }
  560. const generic::NSEC3PARAM& np =
  561. dynamic_cast<const generic::NSEC3PARAM&>(it->getCurrent());
  562. return (ConstNsec3ParamPtr(new Nsec3Param(np.getHashalg(), np.getFlags(),
  563. np.getIterations(),
  564. np.getSalt())));
  565. }
  566. inline DataSrc::Result
  567. proveNX(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo, const bool wildcard) {
  568. Message& m = q.message();
  569. const Name* const zonename = zoneinfo.getEnclosingZone();
  570. ConstNsec3ParamPtr nsec3 = getNsec3Param(q, zoneinfo);
  571. if (nsec3 != NULL) {
  572. // Attach the NSEC3 record covering the QNAME
  573. RRsetPtr rrset;
  574. string hash1(nsec3->getHash(task->qname));
  575. RETERR(getNsec3(q, zoneinfo, hash1, rrset));
  576. addToMessage(q, Section::AUTHORITY(), rrset);
  577. // If this is an NXRRSET or NOERROR/NODATA, we're done
  578. if ((task->flags & DataSrc::TYPE_NOT_FOUND) != 0) {
  579. return (DataSrc::SUCCESS);
  580. }
  581. // Find the closest provable enclosing name for QNAME
  582. Name enclosure(*zonename);
  583. const int diff = task->qname.getLabelCount() -
  584. enclosure.getLabelCount();
  585. string hash2;
  586. for (int i = 1; i <= diff; ++i) {
  587. enclosure = task->qname.split(i);
  588. string nodehash(nsec3->getHash(enclosure));
  589. if (nodehash == hash1) {
  590. break;
  591. }
  592. hash2 = nodehash;
  593. RRsetList rl;
  594. // hash2 will be overwritten with the actual hash found;
  595. // we don't want to use one until we find an exact match
  596. RETERR(getNsec3(q, zoneinfo, hash2, rrset));
  597. if (hash2 == nodehash) {
  598. addToMessage(q, Section::AUTHORITY(), rrset);
  599. break;
  600. }
  601. }
  602. // If we are processing a wildcard answer, we're done.
  603. if (wildcard) {
  604. return (DataSrc::SUCCESS);
  605. }
  606. // Otherwise, there is no wildcard record, so we must add a
  607. // covering NSEC3 to prove that it doesn't exist.
  608. string hash3(nsec3->getHash(Name("*").concatenate(enclosure)));
  609. RETERR(getNsec3(q, zoneinfo, hash3, rrset));
  610. if (hash3 != hash1 && hash3 != hash2) {
  611. addToMessage(q, Section::AUTHORITY(), rrset);
  612. }
  613. } else {
  614. Name nsecname(task->qname);
  615. if ((task->flags & DataSrc::NAME_NOT_FOUND) != 0 || wildcard) {
  616. const DataSrc* ds = zoneinfo.getDataSource();
  617. if (ds == NULL) {
  618. m.setRcode(Rcode::SERVFAIL());
  619. return (DataSrc::ERROR);
  620. }
  621. ds->findPreviousName(task->qname, nsecname, zonename);
  622. }
  623. RETERR(addNSEC(q, nsecname, zoneinfo));
  624. if ((task->flags & DataSrc::TYPE_NOT_FOUND) != 0 ||
  625. nsecname == *zonename)
  626. {
  627. return (DataSrc::SUCCESS);
  628. }
  629. // If we are processing a wildcard answer, we're done.
  630. if (wildcard) {
  631. return (DataSrc::SUCCESS);
  632. }
  633. // Otherwise, there is no wildcard record, so we must add an
  634. // NSEC for the zone to prove the wildcard doesn't exist.
  635. RETERR(addNSEC(q, *zonename, zoneinfo));
  636. }
  637. return (DataSrc::SUCCESS);
  638. }
  639. // Attempt a wildcard lookup
  640. inline DataSrc::Result
  641. tryWildcard(Query& q, QueryTaskPtr task, ZoneInfo& zoneinfo, bool& found) {
  642. Message& m = q.message();
  643. DataSrc::Result result;
  644. found = false;
  645. if ((task->flags & DataSrc::NAME_NOT_FOUND) == 0 ||
  646. (task->state != QueryTask::GETANSWER &&
  647. task->state != QueryTask::FOLLOWCNAME)) {
  648. return (DataSrc::SUCCESS);
  649. }
  650. const Name* const zonename = zoneinfo.getEnclosingZone();
  651. const int diff = task->qname.getLabelCount() - zonename->getLabelCount();
  652. if (diff < 1) {
  653. return (DataSrc::SUCCESS);
  654. }
  655. RRsetList wild;
  656. const Name star("*");
  657. bool cname = false;
  658. for (int i = 1; i <= diff; ++i) {
  659. const Name& wname(star.concatenate(task->qname.split(i)));
  660. QueryTask newtask(q, wname, task->qtype, Section::ANSWER(),
  661. QueryTask::AUTH_QUERY);
  662. result = doQueryTask(newtask, zoneinfo, wild);
  663. if (result == DataSrc::SUCCESS) {
  664. if (newtask.flags == 0) {
  665. task->flags &= ~DataSrc::NAME_NOT_FOUND;
  666. task->flags &= ~DataSrc::TYPE_NOT_FOUND;
  667. found = true;
  668. break;
  669. } else if ((newtask.flags & DataSrc::CNAME_FOUND) != 0) {
  670. task->flags &= ~DataSrc::NAME_NOT_FOUND;
  671. task->flags &= ~DataSrc::TYPE_NOT_FOUND;
  672. task->flags |= DataSrc::CNAME_FOUND;
  673. found = true;
  674. cname = true;
  675. break;
  676. } else if ((newtask.flags & DataSrc::TYPE_NOT_FOUND) != 0) {
  677. task->flags &= ~DataSrc::NAME_NOT_FOUND;
  678. task->flags |= DataSrc::TYPE_NOT_FOUND;
  679. break;
  680. }
  681. }
  682. }
  683. // A wildcard was found.
  684. if (found) {
  685. // Prove the nonexistence of the name we were looking for
  686. if (q.wantDnssec()) {
  687. result = proveNX(q, task, zoneinfo, true);
  688. if (result != DataSrc::SUCCESS) {
  689. m.setRcode(Rcode::SERVFAIL());
  690. return (DataSrc::ERROR);
  691. }
  692. }
  693. // Add the data to the answer section (but with the name changed to
  694. // match the qname), and then continue as if this were a normal
  695. // answer: if a CNAME, chase the target, otherwise add authority.
  696. if (cname) {
  697. RRsetPtr rrset = wild.findRRset(RRType::CNAME(), q.qclass());
  698. if (rrset != NULL) {
  699. rrset->setName(task->qname);
  700. addToMessage(q, Section::ANSWER(), rrset);
  701. chaseCname(q, task, rrset);
  702. }
  703. } else {
  704. BOOST_FOREACH (RRsetPtr rrset, wild) {
  705. rrset->setName(task->qname);
  706. addToMessage(q, Section::ANSWER(), rrset);
  707. }
  708. RRsetList auth;
  709. if (!refQuery(q, *zonename, zoneinfo, auth)) {
  710. return (DataSrc::ERROR);
  711. }
  712. copyAuth(q, auth);
  713. }
  714. }
  715. return (DataSrc::SUCCESS);
  716. }
  717. //
  718. // doQuery: Processes a query.
  719. //
  720. void
  721. DataSrc::doQuery(Query& q) {
  722. Message& m = q.message();
  723. vector<RRsetPtr> additional;
  724. // Record the fact that the query is being processed by the
  725. // current data source.
  726. q.setDatasrc(this);
  727. // Process the query task queue. (The queue is initialized
  728. // and the first task placed on it by the Query constructor.)
  729. m.clearHeaderFlag(MessageFlag::AA());
  730. while (!q.tasks().empty()) {
  731. QueryTaskPtr task = q.tasks().front();
  732. q.tasks().pop();
  733. // Can't query directly for RRSIG.
  734. if (task->qtype == RRType::RRSIG()) {
  735. m.setRcode(Rcode::REFUSED());
  736. return;
  737. }
  738. // These task types should never be on the task queue.
  739. if (task->op == QueryTask::SIMPLE_QUERY ||
  740. task->op == QueryTask::REF_QUERY) {
  741. m.setRcode(Rcode::SERVFAIL());
  742. return;
  743. }
  744. ZoneInfo zoneinfo(this, task->qname, task->qclass, task->qtype);
  745. RRsetList data;
  746. Result result = SUCCESS;
  747. // For these query task types, if there is more than
  748. // one level between the zone name and qname, we need to
  749. // check the intermediate nodes for referrals.
  750. if ((task->op == QueryTask::AUTH_QUERY ||
  751. task->op == QueryTask::NOGLUE_QUERY) &&
  752. hasDelegation(q, task, zoneinfo)) {
  753. continue;
  754. }
  755. result = doQueryTask(*task, zoneinfo, data);
  756. if (result != SUCCESS) {
  757. m.setRcode(Rcode::SERVFAIL());
  758. return;
  759. }
  760. // No such zone. If we're chasing cnames or adding additional
  761. // data, that's okay, but if doing an original query, return
  762. // REFUSED.
  763. if (task->flags == NO_SUCH_ZONE) {
  764. if (task->state == QueryTask::GETANSWER) {
  765. m.setRcode(Rcode::REFUSED());
  766. return;
  767. }
  768. continue;
  769. }
  770. // Query found a referral; let's find out if that was expected--
  771. // i.e., if an NS was at the zone apex, or if we were querying
  772. // specifically for, and found, a DS, NSEC, or DNAME record.
  773. const Name* const zonename = zoneinfo.getEnclosingZone();
  774. if ((task->flags & REFERRAL) != 0 &&
  775. (zonename->getLabelCount() == task->qname.getLabelCount() ||
  776. ((task->qtype == RRType::NSEC() ||
  777. task->qtype == RRType::DS() ||
  778. task->qtype == RRType::DNAME()) &&
  779. data.findRRset(task->qtype, task->qclass)))) {
  780. task->flags &= ~REFERRAL;
  781. }
  782. if (result == SUCCESS && task->flags == 0) {
  783. bool have_ns = false, need_auth = false;
  784. switch (task->state) {
  785. case QueryTask::GETANSWER:
  786. case QueryTask::FOLLOWCNAME:
  787. BOOST_FOREACH(RRsetPtr rrset, data) {
  788. addToMessage(q, task->section, rrset);
  789. if (q.tasks().empty()) {
  790. need_auth = true;
  791. }
  792. getAdditional(q, rrset);
  793. if (rrset->getType() == RRType::NS()) {
  794. have_ns = true;
  795. }
  796. }
  797. q.setStatus(Query::ANSWERED);
  798. if (need_auth && !have_ns) {
  799. // Data found, no additional processing needed.
  800. // Add the NS records for the enclosing zone to
  801. // the authority section.
  802. RRsetList auth;
  803. const DataSrc* ds = zoneinfo.getDataSource();
  804. if (!refQuery(q, Name(*zonename), zoneinfo, auth) ||
  805. !auth.findRRset(RRType::NS(), ds->getClass())) {
  806. isc_throw(DataSourceError,
  807. "NS RR not found in " << *zonename << "/" <<
  808. q.qclass());
  809. }
  810. copyAuth(q, auth);
  811. }
  812. continue;
  813. case QueryTask::GETADDITIONAL:
  814. // Got additional data. Do not add it to the message
  815. // yet; instead store it and copy it in at the end
  816. // (this allow RRSIGs to be omitted if necessary).
  817. BOOST_FOREACH(RRsetPtr rrset, data) {
  818. if (q.status() == Query::ANSWERED &&
  819. rrset->getName() == q.qname() &&
  820. rrset->getType() == q.qtype()) {
  821. continue;
  822. }
  823. additional.push_back(rrset);
  824. }
  825. continue;
  826. default:
  827. isc_throw (Unexpected, "unexpected query state");
  828. }
  829. } else if (result == ERROR || result == NOT_IMPLEMENTED) {
  830. m.setRcode(Rcode::SERVFAIL());
  831. return;
  832. } else if ((task->flags & CNAME_FOUND) != 0) {
  833. // The qname node contains a CNAME. Add a new task to the
  834. // queue to look up its target.
  835. RRsetPtr rrset = data.findRRset(RRType::CNAME(), q.qclass());
  836. if (rrset != NULL) {
  837. addToMessage(q, task->section, rrset);
  838. chaseCname(q, task, rrset);
  839. }
  840. continue;
  841. } else if ((task->flags & REFERRAL) != 0) {
  842. // The qname node contains an out-of-zone referral.
  843. if (task->state == QueryTask::GETANSWER) {
  844. RRsetList auth;
  845. m.clearHeaderFlag(MessageFlag::AA());
  846. if (!refQuery(q, task->qname, zoneinfo, auth)) {
  847. m.setRcode(Rcode::SERVFAIL());
  848. return;
  849. }
  850. BOOST_FOREACH (RRsetPtr rrset, auth) {
  851. if (rrset->getType() == RRType::NS()) {
  852. addToMessage(q, Section::AUTHORITY(), rrset);
  853. } else if (rrset->getType() == task->qtype) {
  854. addToMessage(q, Section::ANSWER(), rrset);
  855. } else if (rrset->getType() == RRType::DS() &&
  856. q.wantDnssec()) {
  857. addToMessage(q, Section::AUTHORITY(), rrset);
  858. }
  859. getAdditional(q, rrset);
  860. }
  861. }
  862. continue;
  863. } else if ((task->flags & (NAME_NOT_FOUND|TYPE_NOT_FOUND)) != 0) {
  864. // No data found at this qname/qtype.
  865. // If we were looking for answer data, not additional,
  866. // and the name was not found, we need to find out whether
  867. // there are any relevant wildcards.
  868. bool wildcard_found = false;
  869. result = tryWildcard(q, task, zoneinfo, wildcard_found);
  870. if (result != SUCCESS) {
  871. m.setRcode(Rcode::SERVFAIL());
  872. return;
  873. }
  874. if (wildcard_found) {
  875. continue;
  876. }
  877. // If we've reached this point, there is definitely no answer.
  878. // If we were chasing cnames or adding additional data, that's
  879. // okay, but if we were doing an original query, reply with the
  880. // SOA in the authority section. For NAME_NOT_FOUND, set
  881. // NXDOMAIN, and also add the previous NSEC to the authority
  882. // section. For TYPE_NOT_FOUND, do not set an error rcode,
  883. // and send the current NSEC in the authority section.
  884. if (task->state == QueryTask::GETANSWER) {
  885. if ((task->flags & NAME_NOT_FOUND) != 0) {
  886. m.setRcode(Rcode::NXDOMAIN());
  887. }
  888. result = addSOA(q, zoneinfo);
  889. if (result != SUCCESS) {
  890. isc_throw(DataSourceError,
  891. "SOA RR not found in " << *zonename <<
  892. "/" << q.qclass());
  893. }
  894. }
  895. Name nsecname(task->qname);
  896. if ((task->flags & NAME_NOT_FOUND) != 0) {
  897. const DataSrc* ds = zoneinfo.getDataSource();
  898. ds->findPreviousName(task->qname, nsecname, zonename);
  899. }
  900. if (q.wantDnssec()) {
  901. result = proveNX(q, task, zoneinfo, false);
  902. if (result != DataSrc::SUCCESS) {
  903. m.setRcode(Rcode::SERVFAIL());
  904. return;
  905. }
  906. }
  907. return;
  908. } else {
  909. // Should never be reached!
  910. m.setRcode(Rcode::SERVFAIL());
  911. return;
  912. }
  913. }
  914. // We're done, so now copy in the additional data:
  915. // data first, then signatures. (If we run out of
  916. // space, signatures in additional section are
  917. // optional.)
  918. BOOST_FOREACH(RRsetPtr rrset, additional) {
  919. addToMessage(q, Section::ADDITIONAL(), rrset, true);
  920. }
  921. if (q.wantDnssec()) {
  922. BOOST_FOREACH(RRsetPtr rrset, additional) {
  923. if (rrset->getRRsig()) {
  924. addToMessage(q, Section::ADDITIONAL(), rrset->getRRsig(), true);
  925. }
  926. }
  927. }
  928. }
  929. DataSrc::Result
  930. DataSrc::findAddrs(const Name& qname, const RRClass& qclass,
  931. RRsetList& target, uint32_t& flags,
  932. const Name* zonename) const
  933. {
  934. Result r;
  935. bool a = false, aaaa = false;
  936. flags = 0;
  937. r = findExactRRset(qname, qclass, RRType::A(), target, flags, zonename);
  938. if (r == SUCCESS && flags == 0) {
  939. a = true;
  940. }
  941. flags = 0;
  942. r = findExactRRset(qname, qclass, RRType::AAAA(), target, flags,
  943. zonename);
  944. if (r == SUCCESS && flags == 0) {
  945. aaaa = true;
  946. }
  947. if (!a && !aaaa) {
  948. flags = TYPE_NOT_FOUND;
  949. } else {
  950. flags = 0;
  951. }
  952. return (SUCCESS);
  953. }
  954. DataSrc::Result
  955. DataSrc::findReferral(const Name& qname, const RRClass& qclass,
  956. RRsetList& target, uint32_t& flags,
  957. const Name* zonename) const
  958. {
  959. Result r;
  960. bool ns = false, ds = false, dname = false;
  961. flags = 0;
  962. r = findExactRRset(qname, qclass, RRType::NS(), target, flags, zonename);
  963. if (r == SUCCESS && flags == 0) {
  964. ns = true;
  965. } else if ((flags & (NO_SUCH_ZONE|NAME_NOT_FOUND))) {
  966. return (SUCCESS);
  967. }
  968. flags = 0;
  969. r = findExactRRset(qname, qclass, RRType::DS(), target, flags, zonename);
  970. if (r == SUCCESS && flags == 0) {
  971. ds = true;
  972. } else if ((flags & (NO_SUCH_ZONE|NAME_NOT_FOUND))) {
  973. return (SUCCESS);
  974. }
  975. flags = 0;
  976. r = findExactRRset(qname, qclass, RRType::DNAME(), target, flags, zonename);
  977. if (r == SUCCESS && flags == 0) {
  978. dname = true;
  979. } else if ((flags & (NO_SUCH_ZONE|NAME_NOT_FOUND))) {
  980. return (SUCCESS);
  981. }
  982. if (!ns && !dname && !ds) {
  983. flags = TYPE_NOT_FOUND;
  984. } else {
  985. flags = 0;
  986. }
  987. return (SUCCESS);
  988. }
  989. void
  990. MetaDataSrc::addDataSrc(ConstDataSrcPtr data_src) {
  991. if (getClass() != RRClass::ANY() && data_src->getClass() != getClass()) {
  992. isc_throw(Unexpected, "class mismatch");
  993. }
  994. data_sources.push_back(data_src);
  995. }
  996. void
  997. MetaDataSrc::removeDataSrc(ConstDataSrcPtr data_src) {
  998. std::vector<ConstDataSrcPtr>::iterator it, itr;
  999. for (it = data_sources.begin(); it != data_sources.end(); it++) {
  1000. if (*it == data_src) {
  1001. itr = it;
  1002. }
  1003. }
  1004. data_sources.erase(itr);
  1005. }
  1006. void
  1007. MetaDataSrc::findClosestEnclosure(DataSrcMatch& match) const {
  1008. if (getClass() != match.getClass() &&
  1009. getClass() != RRClass::ANY() && match.getClass() != RRClass::ANY()) {
  1010. return;
  1011. }
  1012. BOOST_FOREACH (ConstDataSrcPtr data_src, data_sources) {
  1013. data_src->findClosestEnclosure(match);
  1014. }
  1015. }
  1016. DataSrcMatch::~DataSrcMatch() {
  1017. delete closest_name_;
  1018. }
  1019. void
  1020. DataSrcMatch::update(const DataSrc& new_source, const Name& container) {
  1021. if (getClass() != new_source.getClass() && getClass() != RRClass::ANY() &&
  1022. new_source.getClass() != RRClass::ANY())
  1023. {
  1024. return;
  1025. }
  1026. if (closest_name_ == NULL) {
  1027. const NameComparisonResult::NameRelation cmp =
  1028. getName().compare(container).getRelation();
  1029. if (cmp != NameComparisonResult::EQUAL &&
  1030. cmp != NameComparisonResult::SUBDOMAIN)
  1031. {
  1032. return;
  1033. }
  1034. closest_name_ = new Name(container);
  1035. best_source_ = &new_source;
  1036. return;
  1037. }
  1038. if (container.compare(*closest_name_).getRelation() ==
  1039. NameComparisonResult::SUBDOMAIN) {
  1040. Name* newname = new Name(container);
  1041. delete closest_name_;
  1042. closest_name_ = newname;
  1043. best_source_ = &new_source;
  1044. }
  1045. }
  1046. Nsec3Param::Nsec3Param(const uint8_t a, const uint8_t f, const uint16_t i,
  1047. const std::vector<uint8_t>& s) :
  1048. algorithm_(a), flags_(f), iterations_(i), salt_(s)
  1049. {}
  1050. string
  1051. Nsec3Param::getHash(const Name& name) const {
  1052. OutputBuffer buf(0);
  1053. name.toWire(buf);
  1054. uint8_t digest[SHA1_HASHSIZE];
  1055. const uint8_t* input = static_cast<const uint8_t*>(buf.getData());
  1056. size_t inlength = buf.getLength();
  1057. const uint8_t saltlen = salt_.size();
  1058. int n = 0;
  1059. SHA1Context sha;
  1060. do {
  1061. SHA1Reset(&sha);
  1062. SHA1Input(&sha, input, inlength);
  1063. SHA1Input(&sha, &salt_[0], saltlen);
  1064. SHA1Result(&sha, digest);
  1065. input = digest;
  1066. inlength = SHA1_HASHSIZE;
  1067. } while (n++ < iterations_);
  1068. return (encodeBase32Hex(vector<uint8_t>(digest, digest + SHA1_HASHSIZE)));
  1069. }
  1070. //
  1071. // The following methods are effectively empty, and their parameters are
  1072. // unused. To silence compilers that warn unused function parameters,
  1073. // we specify a (compiler dependent) special keyword when available.
  1074. // It's defined in config.h, and to avoid including this header file from
  1075. // installed files we define the methods here.
  1076. //
  1077. DataSrc::Result
  1078. DataSrc::init(const isc::data::ElementPtr config UNUSED_PARAM) {
  1079. return NOT_IMPLEMENTED;
  1080. }
  1081. DataSrc::Result
  1082. MetaDataSrc::findRRset(const isc::dns::Name& qname UNUSED_PARAM,
  1083. const isc::dns::RRClass& qclass UNUSED_PARAM,
  1084. const isc::dns::RRType& qtype UNUSED_PARAM,
  1085. isc::dns::RRsetList& target UNUSED_PARAM,
  1086. uint32_t& flags UNUSED_PARAM,
  1087. const isc::dns::Name* zonename UNUSED_PARAM) const
  1088. {
  1089. return (NOT_IMPLEMENTED);
  1090. }
  1091. DataSrc::Result
  1092. MetaDataSrc::findExactRRset(const isc::dns::Name& qname UNUSED_PARAM,
  1093. const isc::dns::RRClass& qclass UNUSED_PARAM,
  1094. const isc::dns::RRType& qtype UNUSED_PARAM,
  1095. isc::dns::RRsetList& target UNUSED_PARAM,
  1096. uint32_t& flags UNUSED_PARAM,
  1097. const isc::dns::Name* zonename UNUSED_PARAM) const
  1098. {
  1099. return (NOT_IMPLEMENTED);
  1100. }
  1101. DataSrc::Result
  1102. MetaDataSrc::findAddrs(const isc::dns::Name& qname UNUSED_PARAM,
  1103. const isc::dns::RRClass& qclass UNUSED_PARAM,
  1104. isc::dns::RRsetList& target UNUSED_PARAM,
  1105. uint32_t& flags UNUSED_PARAM,
  1106. const isc::dns::Name* zonename UNUSED_PARAM) const
  1107. {
  1108. return (NOT_IMPLEMENTED);
  1109. }
  1110. DataSrc::Result
  1111. MetaDataSrc::findReferral(const isc::dns::Name& qname UNUSED_PARAM,
  1112. const isc::dns::RRClass& qclass UNUSED_PARAM,
  1113. isc::dns::RRsetList& target UNUSED_PARAM,
  1114. uint32_t& flags UNUSED_PARAM,
  1115. const isc::dns::Name* zonename UNUSED_PARAM) const
  1116. {
  1117. return (NOT_IMPLEMENTED);
  1118. }
  1119. DataSrc::Result
  1120. MetaDataSrc::findPreviousName(const isc::dns::Name& qname UNUSED_PARAM,
  1121. isc::dns::Name& target UNUSED_PARAM,
  1122. const isc::dns::Name* zonename UNUSED_PARAM) const
  1123. {
  1124. return (NOT_IMPLEMENTED);
  1125. }
  1126. DataSrc::Result
  1127. MetaDataSrc::findCoveringNSEC3(const isc::dns::Name& zonename UNUSED_PARAM,
  1128. std::string& hash UNUSED_PARAM,
  1129. isc::dns::RRsetList& target UNUSED_PARAM) const
  1130. {
  1131. return (NOT_IMPLEMENTED);
  1132. }
  1133. }
  1134. }