resolver.c revision 3d3a9152d85788cc367ec2c2c95761452f410bf3
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt * Copyright (C) 1999 Internet Software Consortium.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * copyright notice and this permission notice appear in all copies.
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt "res %p: %s", (r), (m))
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt "fetch %p (fctx %p): %s", \
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt "resquery %p (fctx %p): %s", \
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt#define RRTRACE(r, m)
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt#define SEND_BUFFER_SIZE 2048 /* XXXRTH Constant. */
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunttypedef struct query {
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt /* Not locked. */
c92122485d6868a88e6cc1469e06a9c8f306b575Evan Hunt unsigned int magic;
unsigned int options;
} resquery_t;
fetchstate_init = 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 references;
unsigned int nbuckets;
unsigned int activebuckets;
static inline isc_result_t
ISC_FALSE));
static inline isc_result_t
ISC_FALSE));
unsigned int rtt;
unsigned int factor;
factor = 0;
deventp);
(void)task;
static inline isc_result_t
return (result);
return (result);
return (result);
static isc_result_t
unsigned int options)
return (result);
goto stop_timer;
goto cleanup_query;
&socket);
goto cleanup_query;
goto cleanup_dispatch;
case PF_INET:
case PF_INET6:
goto cleanup_dispatch;
goto cleanup_dispatch;
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, 0);
goto cleanup_message;
DNS_SECTION_ADDITIONAL, 0, 0);
goto cleanup_message;
goto cleanup_message;
goto cleanup_message;
return (ISC_R_SUCCESS);
NULL);
return (result);
(void)task;
unsigned int bucketnum;
(void)task;
if (want_try)
else if (want_done)
else if (bucket_empty)
static isc_result_t
isc_region_t r;
unsigned int options;
return (DNS_R_SERVFAIL);
return (result);
&find);
return (result);
return (result);
return (result);
static inline dns_adbaddrinfo_t *
return (addrinfo);
unsigned int options;
static isc_boolean_t
unsigned int bucketnum;
return (ISC_TRUE);
return (ISC_FALSE);
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
return (ISC_R_NOMEMORY);
goto cleanup_fetch;
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);
static inline isc_result_t
void *data;
return (result);
return (result);
&node);
return (result);
if (need_validation) {
return (DNS_R_NOTIMPLEMENTED);
eresult =
eresult =
return (result);
static inline isc_result_t
section++) {
&name);
return (result);
static inline isc_result_t
void *data;
return (result);
goto unlock;
&node);
goto unlock;
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
isc_region_t r;
return (result);
return (ISC_R_SUCCESS);
static inline isc_result_t
isc_region_t r;
int order;
return (result);
&nbits);
return (DNS_R_FORMERR);
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);
fctx);
return (result);
return (DNS_R_DELEGATION);
if (negative_response)
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int aflag;
aflag = 0;
return (DNS_R_FORMERR);
&tname);
return (result);
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 (aa)
} else if (external) {
if (want_chaining) {
&dname);
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);
return (ISC_R_SUCCESS);
unsigned int options;
(void)task;
covers = 0;
goto done;
goto done;
switch (result) {
case DNS_R_UNEXPECTEDEND:
goto done;
case DNS_R_FORMERR:
goto done;
case DNS_R_MOREDATA:
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) {
if (need_destroy)
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_buckets;
port++;
goto cleanup_buckets;
goto cleanup_udpsocket4;
goto cleanup_dispatch4;
goto cleanup_udpsocket6;
goto cleanup_dispatch6;
return (ISC_R_SUCCESS);
for (i = 0; i < buckets_created; i++) {
return (result);
if (need_destroy)
static inline isc_boolean_t
unsigned int options)
return (ISC_FALSE);
isc_buffer_t b;
isc_region_t r;
isc_buffer_available(&b, &r);
isc_buffer_used(&b, &r);
unsigned int bucketnum;
(void)forwarders;
return (ISC_R_NOMEMORY);
goto unlock;
goto unlock;
if (new_fctx) {
return (result);
link);
&cevent);