resolver.c revision a123725906b49002ca8250bc79b7a83ddff0f7e2
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * Copyright (C) 1999, 2000 Internet Software Consortium.
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * Permission to use, copy, modify, and distribute this software for any
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * purpose with or without fee is hereby granted, provided that the above
44aae046c38e796e581110b7ecdf4478167d684dBob Halley * copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
44aae046c38e796e581110b7ecdf4478167d684dBob Halley/* $Id: resolver.c,v 1.177 2000/11/03 22:53:14 bwelling Exp $ */
#define RTRACE(m)
#define RRTRACE(r, m)
#define FCTXTRACE(m)
#define FTRACE(m)
#define QTRACE(m)
typedef struct query {
unsigned int magic;
unsigned int options;
unsigned int attributes;
unsigned int sends;
} resquery_t;
RESQUERY_ATTR_CONNECTING) != 0)
RESQUERY_ATTR_CANCELED) != 0)
} fetchstate;
struct fetchctx {
unsigned int magic;
unsigned int options;
unsigned int bucketnum;
unsigned int references;
unsigned int attributes;
unsigned int pending;
unsigned int restarts;
struct dns_fetch {
unsigned int magic;
void * private;
typedef struct fctxbucket {
} fctxbucket_t;
struct dns_resolver {
unsigned int magic;
unsigned int options;
unsigned int nbuckets;
unsigned int references;
unsigned int activebuckets;
FCTX_ADDRINFO_FORWARDER) != 0)
static inline isc_result_t
ISC_TRUE));
static inline isc_result_t
ISC_FALSE));
unsigned int rtt;
unsigned int factor;
factor);
static inline isc_result_t
return (result);
return (result);
return (result);
unsigned int seconds;
static isc_result_t
unsigned int options)
return (result);
goto stop_idle_timer;
goto cleanup_query;
int pf;
goto cleanup_query;
goto cleanup_socket;
case PF_INET:
case PF_INET6:
goto cleanup_query;
goto cleanup_socket;
goto cleanup_dispatch;
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
isc_region_t r;
goto cleanup_temps;
goto cleanup_temps;
task,
goto cleanup_temps;
goto cleanup_message;
DNS_SECTION_QUESTION, 0);
goto cleanup_message;
goto cleanup_message;
goto cleanup_message;
goto cleanup_message;
goto cleanup_message;
goto cleanup_message;
goto cleanup_message;
int match;
match > 0)
if (drop) {
goto cleanup_message;
goto cleanup_message;
return (ISC_R_SUCCESS);
return (result);
unsigned int attrs;
attrs = 0;
unsigned int bucketnum;
if (want_try)
else if (want_done)
else if (bucket_empty)
static inline isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
static inline isc_boolean_t
return (all_bad);
static isc_result_t
return (DNS_R_SERVFAIL);
goto out;
return (result);
out:
if (all_bad) {
} else if (pruned) {
goto restart;
return (result);
static inline dns_adbaddrinfo_t *
return (addrinfo);
return (addrinfo);
static isc_boolean_t
unsigned int bucketnum;
return (ISC_TRUE);
return (ISC_FALSE);
&cevent);
unsigned int bucketnum;
if (bucket_empty)
unsigned int bucketnum;
if (!done) {
} else if (bucket_empty)
static inline isc_result_t
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int findoptions = 0;
return (ISC_R_NOMEMORY);
goto cleanup_fetch;
NULL);
goto cleanup_name;
goto cleanup_name;
goto cleanup_name;
goto cleanup_name;
goto cleanup_domain;
goto cleanup_qmessage;
goto cleanup_rmessage;
goto cleanup_rmessage;
return (ISC_R_SUCCESS);
return (result);
static inline isc_result_t
return (DNS_R_FORMERR);
return (result);
return (DNS_R_FORMERR);
return (ISC_R_SUCCESS);
unsigned int bucketnum;
if (bucket_empty)
goto cleanup_event;
if (!negative &&
&node);
goto noanswer_response;
(void)dns_db_deleterdataset(
goto noanswer_response;
if (negative) {
goto noanswer_response;
ttl = 0;
goto noanswer_response;
goto answer_response;
goto noanswer_response;
goto noanswer_response;
goto noanswer_response;
if (sentresponse) {
goto cleanup_event;
goto cleanup_event;
static inline isc_result_t
unsigned int options;
return (result);
!need_validation) {
return (result);
return (result);
* Cache this rdataset/sigrdataset pair as
if (!need_validation)
rdataset, 0,
if (!need_validation)
sigrdataset, 0,
name,
task,
fctx,
&validator);
options = 0;
eresult =
eresult =
name,
task,
fctx,
&validator);
return (result);
static inline isc_result_t
section++) {
&name);
return (result);
static isc_result_t
return (result);
static inline isc_result_t
return (result);
if (secure_domain) {
&tname);
return (result);
if (need_validation) {
&validator);
return (result);
return (ISC_R_SUCCESS);
goto unlock;
&node);
goto unlock;
ttl = 0;
goto unlock;
return (result);
if (gluing)
if (external)
static isc_result_t
NULL);
gluing);
&rdataset);
gluing);
* See query.c.
return (ISC_R_SUCCESS);
static inline isc_result_t
return (result);
return (result);
return (ISC_R_SUCCESS);
static inline isc_result_t
int order;
return (result);
return (result);
&nbits);
return (DNS_R_FORMERR);
return (result);
return (result);
static isc_result_t
return (ISC_R_SUCCESS);
return (DNS_R_FORMERR);
return (DNS_R_FORMERR);
if (aa)
return (result);
return (ISC_R_SUCCESS);
return (DNS_R_FORMERR);
return (DNS_R_FORMERR);
return (DNS_R_FORMERR);
return (DNS_R_FORMERR);
fctx);
return (result);
return (DNS_R_DELEGATION);
if (negative_response)
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int aflag;
aflag = 0;
&& !found_cname) {
&& !found_type) {
return (DNS_R_FORMERR);
&tname);
return (result);
&& !found_type) {
if (found) {
if (!chaining) {
if (aflag ==
if (aa)
} else if (external) {
(void)dns_rdataset_additionaldata(
fctx);
if (want_chaining) {
aflag = 0;
return (DNS_R_FORMERR);
&dname);
return (result);
if (found) {
if (!chaining) {
if (aflag ==
if (aa)
} else if (external) {
if (want_chaining) {
NULL,
NULL);
return (result);
&fqname);
return (result);
if (!have_answer)
return (DNS_R_FORMERR);
if (want_chaining) {
return (DNS_R_FORMERR);
if (!external) {
(void)dns_rdataset_additionaldata(
fctx);
return (result);
unsigned int options;
goto done;
goto done;
goto done;
switch (result) {
case ISC_R_UNEXPECTEDEND:
goto done;
case DNS_R_FORMERR:
goto done;
case DNS_R_MOREDATA:
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
if (truncated) {
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
if (keep_trying) {
if (broken_server) {
if (get_nameservers) {
NULL);
} else if (resend) {
unsigned int options,
unsigned int i, buckets_created = 0;
return (ISC_R_NOMEMORY);
goto cleanup_res;
for (i = 0; i < ntasks; i++) {
goto cleanup_buckets;
goto cleanup_buckets;
goto cleanup_dispatches;
return (ISC_R_SUCCESS);
for (i = 0; i < buckets_created; i++) {
return (result);
if (want_priming) {
if (need_destroy)
static inline isc_boolean_t
unsigned int options)
return (ISC_FALSE);
isc_buffer_t b;
isc_region_t r;
isc_buffer_availableregion(&b, &r);
isc_buffer_usedregion(&b, &r);
unsigned int bucketnum;
return (ISC_R_NOMEMORY);
goto unlock;
goto unlock;
if (new_fctx) {
return (result);
unsigned int bucketnum;
if (bucket_empty)