query.c revision d1cbf714097e900ed1703529584d3e1a50e8a4a8
ca41b452ede6feaa9d8739ec3cae19389a7b0d03Bob Halley * Copyright (C) 1999, 2000 Internet Software Consortium.
615eff12e0e3565c52758292e10080a25d872941William King * Permission to use, copy, modify, and distribute this software for any
615eff12e0e3565c52758292e10080a25d872941William King * purpose with or without fee is hereby granted, provided that the above
615eff12e0e3565c52758292e10080a25d872941William King * copyright notice and this permission notice appear in all copies.
615eff12e0e3565c52758292e10080a25d872941William King * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
615eff12e0e3565c52758292e10080a25d872941William King * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
615eff12e0e3565c52758292e10080a25d872941William King * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
615eff12e0e3565c52758292e10080a25d872941William King * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
615eff12e0e3565c52758292e10080a25d872941William King * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
615eff12e0e3565c52758292e10080a25d872941William King * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
615eff12e0e3565c52758292e10080a25d872941William King * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
615eff12e0e3565c52758292e10080a25d872941William King * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
615eff12e0e3565c52758292e10080a25d872941William King/* $Id: query.c,v 1.134 2000/10/07 00:09:16 bwelling Exp $ */
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#define PARTIALANSWER(c) (((c)->query.attributes & \
615eff12e0e3565c52758292e10080a25d872941William King#define RECURSIONOK(c) (((c)->query.attributes & \
615eff12e0e3565c52758292e10080a25d872941William King#define RECURSING(c) (((c)->query.attributes & \
615eff12e0e3565c52758292e10080a25d872941William King#define CACHEGLUEOK(c) (((c)->query.attributes & \
615eff12e0e3565c52758292e10080a25d872941William King#define WANTRECURSION(c) (((c)->query.attributes & \
615eff12e0e3565c52758292e10080a25d872941William King#define CTRACE(m) ((void)m)
615eff12e0e3565c52758292e10080a25d872941William King#define QTRACE(m) ((void)m)
615eff12e0e3565c52758292e10080a25d872941William Kingquery_simplefind(void *arg, dns_name_t *name, dns_rdatatype_t type,
615eff12e0e3565c52758292e10080a25d872941William King dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
1b6d529cb5ee0ad44f8518e1b8c2cbca54bbdf18David Lawrencestatic inline void
615eff12e0e3565c52758292e10080a25d872941William Kingquery_adda6rrset(void *arg, dns_name_t *name, dns_rdataset_t *rdataset,
615eff12e0e3565c52758292e10080a25d872941William Kingquery_find(ns_client_t *client, dns_fetchevent_t *event);
615eff12e0e3565c52758292e10080a25d872941William Kingstatic inline void
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington * client->query.qname was dynamically allocated.
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellingtonstatic inline void
446aa1ec8cb8f231d8649cfd705c90c6d0976143David Lawrencequery_reset(ns_client_t *client, isc_boolean_t everything) {
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington ns_dbversion_t *dbversion, *dbversion_next;
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington unsigned int i;
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington * Reset the query state of a client to its default state.
615eff12e0e3565c52758292e10080a25d872941William King * Cancel the fetch if it's running.
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington * Cleanup any active versions.
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington for (dbversion = ISC_LIST_HEAD(client->query.activeversions);
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington dbversion_next = ISC_LIST_NEXT(dbversion, link);
446aa1ec8cb8f231d8649cfd705c90c6d0976143David Lawrence dns_db_closeversion(dbversion->db, &dbversion->version,
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington ISC_LIST_APPEND(client->query.freeversions, dbversion, link);
615eff12e0e3565c52758292e10080a25d872941William King * Clean up free versions.
615eff12e0e3565c52758292e10080a25d872941William King for (dbversion = ISC_LIST_HEAD(client->query.freeversions), i = 0;
a9bc95f22ef2dd4a12e79be99412c9f18b814a5dBrian Wellington dbversion_next = ISC_LIST_NEXT(dbversion, link);
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington * If we're not freeing everything, we keep the first three
c50936eb40263b65ebf6afe4e6556e2dc67c10e4Brian Wellington * dbversions structures around.
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington ISC_LIST_UNLINK(client->query.freeversions, dbversion,
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington for (dbuf = ISC_LIST_HEAD(client->query.namebufs);
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington ISC_LIST_UNLINK(client->query.namebufs, dbuf, link);
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington client->query.attributes = (NS_QUERYATTR_RECURSIONOK |
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington * Allocate a name buffer.
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington result = isc_buffer_allocate(client->mctx, &dbuf, 1024);
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington CTRACE("query_newnamebuf: isc_buffer_allocate failed: done");
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington ISC_LIST_APPEND(client->query.namebufs, dbuf, link);
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington * Return a name buffer with space for a maximal name, allocating
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington * a new one if necessary.
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington if (ISC_LIST_EMPTY(client->query.namebufs)) {
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington CTRACE("query_getnamebuf: query_newnamebuf failed: done");
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington dbuf = ISC_LIST_TAIL(client->query.namebufs);
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington CTRACE("query_getnamebuf: query_newnamebuf failed: done");
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington dbuf = ISC_LIST_TAIL(client->query.namebufs);
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellingtonstatic inline void
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellingtonquery_keepname(ns_client_t *client, dns_name_t *name, isc_buffer_t *dbuf) {
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington * 'name' is using space in 'dbuf', but 'dbuf' has not yet been
c50936eb40263b65ebf6afe4e6556e2dc67c10e4Brian Wellington * adjusted to take account of that. We do the adjustment.
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellington REQUIRE((client->query.attributes & NS_QUERYATTR_NAMEBUFUSED) != 0);
c50936eb40263b65ebf6afe4e6556e2dc67c10e4Brian Wellington client->query.attributes &= ~NS_QUERYATTR_NAMEBUFUSED;
615eff12e0e3565c52758292e10080a25d872941William Kingstatic inline void
615eff12e0e3565c52758292e10080a25d872941William Kingquery_releasename(ns_client_t *client, dns_name_t **namep) {
615eff12e0e3565c52758292e10080a25d872941William King * 'name' is no longer needed. Return it to our pool of temporary
615eff12e0e3565c52758292e10080a25d872941William King * names. If it is using a name buffer, relinquish its exclusive
615eff12e0e3565c52758292e10080a25d872941William King * rights on the buffer.
a7d792804f564aa0889a94f64913b11bffd9738cBrian Wellington INSIST((client->query.attributes & NS_QUERYATTR_NAMEBUFUSED)
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence client->query.attributes &= ~NS_QUERYATTR_NAMEBUFUSED;
615eff12e0e3565c52758292e10080a25d872941William King dns_message_puttempname(client->message, namep);
615eff12e0e3565c52758292e10080a25d872941William Kingstatic inline dns_name_t *
615eff12e0e3565c52758292e10080a25d872941William Kingquery_newname(ns_client_t *client, isc_buffer_t *dbuf,
615eff12e0e3565c52758292e10080a25d872941William King REQUIRE((client->query.attributes & NS_QUERYATTR_NAMEBUFUSED) == 0);
615eff12e0e3565c52758292e10080a25d872941William King result = dns_message_gettempname(client->message, &name);
615eff12e0e3565c52758292e10080a25d872941William King CTRACE("query_newname: dns_message_gettempname failed: done");
615eff12e0e3565c52758292e10080a25d872941William King client->query.attributes |= NS_QUERYATTR_NAMEBUFUSED;
615eff12e0e3565c52758292e10080a25d872941William King result = dns_message_gettemprdataset(client->message, &rdataset);
615eff12e0e3565c52758292e10080a25d872941William King "dns_message_gettemprdataset failed: done");
c50936eb40263b65ebf6afe4e6556e2dc67c10e4Brian Wellingtonstatic inline void
615eff12e0e3565c52758292e10080a25d872941William Kingquery_putrdataset(ns_client_t *client, dns_rdataset_t **rdatasetp) {
615eff12e0e3565c52758292e10080a25d872941William King dns_message_puttemprdataset(client->message, rdatasetp);
615eff12e0e3565c52758292e10080a25d872941William Kingquery_newdbversion(ns_client_t *client, unsigned int n) {
615eff12e0e3565c52758292e10080a25d872941William King unsigned int i;
615eff12e0e3565c52758292e10080a25d872941William King for (i = 0; i < n; i++) {
615eff12e0e3565c52758292e10080a25d872941William King dbversion = isc_mem_get(client->mctx, sizeof *dbversion);
615eff12e0e3565c52758292e10080a25d872941William King ISC_LIST_APPEND(client->query.freeversions, dbversion,
a7d792804f564aa0889a94f64913b11bffd9738cBrian Wellington * We only return ISC_R_NOMEMORY if we couldn't
615eff12e0e3565c52758292e10080a25d872941William King * allocate anything.
615eff12e0e3565c52758292e10080a25d872941William King if (ISC_LIST_EMPTY(client->query.freeversions)) {
615eff12e0e3565c52758292e10080a25d872941William King dbversion = ISC_LIST_HEAD(client->query.freeversions);
615eff12e0e3565c52758292e10080a25d872941William King ISC_LIST_UNLINK(client->query.freeversions, dbversion, link);
a9bc95f22ef2dd4a12e79be99412c9f18b814a5dBrian Wellington dns_a6_init(&client->query.a6ctx, query_simplefind, query_adda6rrset,
615eff12e0e3565c52758292e10080a25d872941William Kingquery_findversion(ns_client_t *client, dns_db_t *db,
615eff12e0e3565c52758292e10080a25d872941William King * We may already have done a query related to this
615eff12e0e3565c52758292e10080a25d872941William King * database. If so, we must be sure to make subsequent
615eff12e0e3565c52758292e10080a25d872941William King * queries from the same version.
a9bc95f22ef2dd4a12e79be99412c9f18b814a5dBrian Wellington for (dbversion = ISC_LIST_HEAD(client->query.activeversions);
a9bc95f22ef2dd4a12e79be99412c9f18b814a5dBrian Wellington dbversion = ISC_LIST_NEXT(dbversion, link)) {
a9bc95f22ef2dd4a12e79be99412c9f18b814a5dBrian Wellington * This is a new zone for this query. Add it to
a7d792804f564aa0889a94f64913b11bffd9738cBrian Wellington * the active list.
a9bc95f22ef2dd4a12e79be99412c9f18b814a5dBrian Wellington dns_db_currentversion(db, &dbversion->version);
7c37bc1a67a80209e05f6b1c01fa7fde7d0dd200Brian Wellingtonquery_getzonedb(ns_client_t *client, dns_name_t *name, unsigned int options,
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp)
615eff12e0e3565c52758292e10080a25d872941William King * Find a zone database to answer the query.
615eff12e0e3565c52758292e10080a25d872941William King ztoptions = ((options & DNS_GETDB_NOEXACT) != 0) ?
615eff12e0e3565c52758292e10080a25d872941William King result = dns_zt_find(client->view->zonetable, name, ztoptions, NULL,
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH)
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence * If this is the first time we are called (that is, looking up
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * the actual name in the query section) remember this database.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * If authdb is non-NULL, we have been here before, and the
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * found database is always returned.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * This limits our searching to the zone where the first name
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * (the query target) is found. This prevents following CNAMES
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * or DNAMES into other zones and prevents returning additional
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * data from other zones.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * If the zone has an ACL, we'll check it, otherwise
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * we use the view's "allow-query" ACL. Each ACL is only checked
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * once per query.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * Also, get the database version to use.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King check_acl = ISC_TRUE; /* Keep compiler happy. */
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * Get the current version of this database.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King dbversion = query_findversion(client, db, &new_zone);
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * We've evaluated the view's queryacl already. If
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * NS_QUERYATTR_QUERYOK is set, then the client is
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * allowed to make queries, otherwise the query should
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * be refused.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * We haven't evaluated the view's queryacl yet.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King isc_boolean_t log = ISC_TF((options & DNS_GETDB_NOLOG) == 0);
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence result = ns_client_checkacl(client, "query", queryacl,
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * We were allowed by the default
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * "allow-query" ACL. Remember this so we
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * don't have to check again.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * We've now evaluated the view's query ACL, and
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * the NS_QUERYATTR_QUERYOK attribute is now valid.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King client->query.attributes |= NS_QUERYATTR_QUERYOKVALID;
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King /* Approved. */
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * Remember the result of the ACL check so we
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * don't have to check again.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King /* Transfer ownership. */
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William Kingquery_getcachedb(ns_client_t *client, dns_db_t **dbp, unsigned int options)
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * Find a cache database to answer the query.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * This may fail with DNS_R_REFUSED if the client
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * is not allowed to use the cache.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * We've evaluated the view's queryacl already. If
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * NS_QUERYATTR_QUERYOK is set, then the client is
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * allowed to make queries, otherwise the query should
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * be refused.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * We haven't evaluated the view's queryacl yet.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King isc_boolean_t log = ISC_TF((options & DNS_GETDB_NOLOG) == 0);
fa6c5e38f4b904aa85f3375f1ca830d4bf8f5877Andreas Gustafsson result = ns_client_checkacl(client, "query",
a9bc95f22ef2dd4a12e79be99412c9f18b814a5dBrian Wellington * We were allowed by the default
a9bc95f22ef2dd4a12e79be99412c9f18b814a5dBrian Wellington * "allow-query" ACL. Remember this so we
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington * don't have to check again.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * We've now evaluated the view's query ACL, and
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * the NS_QUERYATTR_QUERYOK attribute is now valid.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King client->query.attributes |= NS_QUERYATTR_QUERYOKVALID;
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King /* Approved. */
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King /* Transfer ownership. */
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William Kingquery_getdb(ns_client_t *client, dns_name_t *name, unsigned int options,
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp,
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence result = query_getzonedb(client, name, options, zonep, dbp, versionp);
a9bc95f22ef2dd4a12e79be99412c9f18b814a5dBrian Wellington result = query_getcachedb(client, dbp, options);
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William Kingquery_simplefind(void *arg, dns_name_t *name, dns_rdatatype_t type,
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington * Find a database to answer the query.
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington result = query_getdb(client, name, 0, &zone, &db, &version, &is_zone);
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington * Now look for an answer in the database.
fa6c5e38f4b904aa85f3375f1ca830d4bf8f5877Andreas Gustafsson if (db == client->query.gluedb || (!is_zone && CACHEGLUEOK(client)))
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrence result = dns_db_find(db, name, version, type, dboptions,
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * Either the answer is in the cache, or we
c50936eb40263b65ebf6afe4e6556e2dc67c10e4Brian Wellington * don't know it.
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrence * We don't have the data in the cache. If we've got
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrence * glue from the zone, use it.
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence * We don't know the answer.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * We found an answer, but the cache may be better.
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington * Remember what we've got and go look in the cache.
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington if (dns_rdataset_isassociated(sigrdataset)) {
4fe8755480c108a1232b7189fd5434ab35a6b623Brian Wellington dns_rdataset_clone(sigrdataset, &zsigrdataset);
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * Otherwise, the glue is the best answer.
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence if (dns_rdataset_isassociated(&zsigrdataset))
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William Kingquery_isduplicate(ns_client_t *client, dns_name_t *name,
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King result = dns_message_findname(client->message, section,
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * We've already got this RRset in the response.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * The name exists, but the rdataset does not.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * If the dns_name_t we're lookup up is already in the message,
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * we don't want to trigger the caller's name replacement logic.
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William Kingquery_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King dns_rdataset_t *rdataset, *sigrdataset, *a6rdataset, *trdataset;
e5966f9b9a13fc83afaf9b74ac1f7eea6a647817William King * Initialization.
goto cleanup;
goto cleanup;
goto try_cache;
goto found;
goto try_glue;
goto found;
goto cleanup;
goto cleanup;
goto addname;
goto addname;
dns_rdatatype_a, 0,
goto addname;
goto addname;
dns_rdatatype_a6, 0,
goto addname;
goto addname;
goto addname;
if (!added_something)
goto cleanup;
if (need_addname)
client);
return (eresult);
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
static inline isc_result_t
return (result);
goto cleanup;
if (zero_ttl) {
return (eresult);
static inline isc_result_t
return (result);
goto cleanup;
return (eresult);
static inline isc_result_t
isc_region_t r;
return (result);
return (result);
return (result);
return (ISC_R_SUCCESS);
isc_buffer_t b;
goto cleanup;
goto cleanup;
goto cleanup;
if (is_zone) {
goto cleanup;
goto db_find;
goto cleanup;
if (use_zone) {
goto cleanup;
static inline isc_result_t
* Should get help with this from rdata.c
switch (type) {
case dns_rdatatype_tkey:
return (DNS_R_NOTIMP);
case dns_rdatatype_tsig:
return (DNS_R_FORMERR);
case dns_rdatatype_ixfr:
case dns_rdatatype_axfr:
case dns_rdatatype_mailb:
case dns_rdatatype_maila:
return (DNS_R_REFUSED);
return (ISC_R_SUCCESS);
static isc_result_t
return (result);
return (ISC_R_NOMEMORY);
return (ISC_R_NOMEMORY);
return (result);
static inline isc_result_t
goto cleanup;
if (!is_zone) {
goto cleanup;
return (result);
#define QUERY_ERROR(r) \
eresult = r; \
int order;
isc_region_t r;
isc_buffer_t b;
goto cleanup;
goto cleanup;
goto cleanup;
goto resume;
goto cleanup;
if (is_zone)
qtype = 0;
qcount = 0;
qcount++;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
is_zone &&
goto cleanup;
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_GLUE:
case DNS_R_ZONECUT:
case ISC_R_NOTFOUND:
goto cleanup;
case DNS_R_DELEGATION:
if (is_zone) {
goto db_find;
goto cleanup;
case DNS_R_NXRRSET:
goto cleanup;
&tname);
goto cleanup;
case DNS_R_NXDOMAIN:
goto cleanup;
goto cleanup;
&tname);
goto cleanup;
case DNS_R_NCACHENXDOMAIN:
case DNS_R_NCACHENXRRSET:
goto cleanup;
case DNS_R_CNAME:
goto cleanup;
goto cleanup;
goto cleanup;
goto addauth;
case DNS_R_DNAME:
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto addauth;
goto cleanup;
goto cleanup;
goto cleanup;
if (!want_restart) {
if (is_zone) {
goto restart;
isc_buffer_t b;
isc_region_t r;
isc_buffer_availableregion(&b, &r);
isc_buffer_usedregion(&b, &r);
case dns_rdatatype_any:
case dns_rdatatype_ixfr:
case dns_rdatatype_axfr:
case dns_rdatatype_maila:
case dns_rdatatype_mailb:
case dns_rdatatype_tkey: