adb.c revision 875e88e734b310976b178dc26a74d86fbebc935c
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1999 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark 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.
63737247d167ffa7151bc3d228ca5c0875751818Tinderbox User * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
b5f4cc132e91afb1217f4aa79424793c0e11c09aMark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
2c089bf6d24936de631a57b4958ba6b8b5e3b23dMark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
2c089bf6d24936de631a57b4958ba6b8b5e3b23dMark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
b5f4cc132e91afb1217f4aa79424793c0e11c09aMark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
b5f4cc132e91afb1217f4aa79424793c0e11c09aMark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
2c089bf6d24936de631a57b4958ba6b8b5e3b23dMark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
#include <config.h>
#include <stdio.h>
#include <string.h>
struct dns_adb {
unsigned int magic;
int next_namebucket;
int next_entrybucket;
unsigned int irefcnt;
unsigned int erefcnt;
struct dns_adbname {
unsigned int magic;
unsigned int partial_result;
unsigned int flags;
int lock_bucket;
unsigned int chains;
struct dns_adbfetch {
unsigned int magic;
struct dns_adbfetch6 {
unsigned int magic;
unsigned int flags;
struct dns_adbnamehook {
unsigned int magic;
struct dns_adbzoneinfo {
unsigned int magic;
struct dns_adbentry {
unsigned int magic;
int lock_bucket;
unsigned int refcnt;
unsigned int flags;
unsigned int srtt;
dns_adbentry_t *);
dns_adbentry_t *);
dns_a6context_t *);
isc_sockaddr_t *, int *);
static isc_result_t
int addr_bucket;
unsigned int findoptions;
goto fail;
goto fail;
fail:
if (new_addresses_added) {
return (ISC_R_SUCCESS);
return (result);
int addr_bucket;
goto fail;
goto fail;
fail:
if (address_added)
name = *n;
*n = NULL;
int bucket;
int bucket;
int addr_bucket;
unsigned int addrs)
unsigned int wanted;
switch (evtype) {
if (wanted == 0) {
if (process) {
if (lock)
if (lock)
if (lock)
if (lock)
if (lock)
if (lock)
if (lock)
if (lock)
int bucket;
if (lock)
if (lock)
int bucket;
if (lock)
if (lock)
if (!destroy_entry)
static inline dns_adbname_t *
return (NULL);
return (NULL);
return (name);
dns_adbname_t *n;
n = *name;
n->magic = 0;
static inline dns_adbnamehook_t *
return (NULL);
return (nh);
static inline dns_adbzoneinfo_t *
return (NULL);
return (NULL);
return (zi);
static inline dns_adbentry_t *
dns_adbentry_t *e;
isc_uint32_t r;
if (e == NULL)
return (NULL);
e->refcnt = 0;
e->flags = 0;
e->goodness = 0;
dns_adbentry_t *e;
e = *entry;
e->magic = 0;
static inline dns_adbfind_t *
dns_adbfind_t *h;
if (h == NULL)
return (NULL);
h->magic = 0;
h->partial_result = 0;
h->options = 0;
h->flags = 0;
return (NULL);
static inline dns_adbfetch_t *
dns_adbfetch_t *f;
if (f == NULL)
return (NULL);
f->magic = 0;
goto err;
goto err;
err:
return (NULL);
dns_adbfetch_t *f;
f = *fetch;
f->magic = 0;
static isc_result_t
goto cleanup;
goto cleanup;
static inline dns_adbfetch6_t *
dns_adbfetch6_t *f;
if (f == NULL)
return (NULL);
f->magic = 0;
f->flags = 0;
goto err;
goto err;
err:
return (NULL);
dns_adbfetch6_t *f;
f = *fetch;
f->magic = 0;
static inline dns_adbaddrinfo_t *
return (NULL);
return (ai);
static inline dns_adbname_t *
int bucket;
return (adbname);
return (NULL);
static inline dns_adbentry_t *
int bucket;
return (entry);
return (NULL);
static isc_boolean_t
return (ISC_FALSE);
return (is_bad);
int bucket;
goto nextv4;
goto out;
goto nextv6;
goto out;
out:
goto reset;
return (ISC_R_NOMEMORY);
goto fail0a;
goto fail0b;
goto fail0c;
goto fail1;
for (i = 0 ; i < NBUCKETS ; i++) {
for (i = 0 ; i < NBUCKETS ; i++)
goto fail2;
#define MPINIT(t, p, l, n) do { \
goto fail3; \
isc_mempool_setname((p), n); \
goto fail3;
goto fail3;
return (ISC_R_SUCCESS);
return (result);
int bucket;
unsigned int wanted_addresses;
unsigned int query_pending;
query_pending = 0;
if (now == 0) {
return (result);
return (ISC_R_NOMEMORY);
goto out;
goto out;
adbname);
goto v6;
adbname);
goto v6;
v6:
adbname);
goto copy;
adbname);
goto copy;
copy:
if (want_event) {
out:
if (want_event) {
return (result);
int name_bucket;
return (ISC_R_NOTFOUND);
if (decr_adbrefcnt)
return (DNS_R_SUCCESS);
if (now == 0) {
return (result);
goto out;
goto out;
goto out;
goto out;
return (ISC_R_SUCCESS);
out:
if (free_name)
if (free_entry)
if (free_namehook)
return (result);
int bucket;
int bucket;
goto cleanup;
const char *tmpp;
for (i = 0 ; i < NBUCKETS ; i++)
for (i = 0 ; i < NBUCKETS ; i++)
for (i = 0 ; i < NBUCKETS ; i++) {
for (i = 0 ; i < NBUCKETS ; i++) {
case AF_INET:
case AF_INET6:
for (i = 0 ; i < NBUCKETS ; i++)
for (i = 0 ; i < NBUCKETS ; i++)
const char *tmpp;
case AF_INET:
case AF_INET6:
isc_buffer_t b;
if (NAME_FETCH_A(n))
if (NAME_FETCH_AAAA(n))
static isc_result_t
switch (result) {
case DNS_R_GLUE:
case DNS_R_HINT:
case DNS_R_SUCCESS:
case DNS_R_NCACHENXDOMAIN:
case DNS_R_NCACHENXRRSET:
return (result);
static isc_result_t
switch (result) {
case DNS_R_GLUE:
case DNS_R_HINT:
case DNS_R_SUCCESS:
case DNS_R_NCACHENXDOMAIN:
case DNS_R_NCACHENXRRSET:
return (result);
int bucket;
unsigned int address_type;
(void)task;
address_type = 0;
if (address_type == 0) {
if (decr_adbrefcnt)
goto out;
out:
int bucket;
(void)task;
if (decr_adbrefcnt)
goto out;
name);
goto out;
name);
goto out;
goto out;
out:
static isc_result_t
goto cleanup;
goto cleanup;
goto cleanup;
return (result);
static isc_result_t
goto cleanup;
goto cleanup;
goto cleanup;
return (result);
static isc_result_t
goto cleanup;
goto cleanup;
if (use_hints)
goto cleanup;
return (result);
int bucket;
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
int goodness_adjustment)
int bucket;
if (goodness_adjustment == 0)
if (goodness_adjustment > 0) {
int bucket;
unsigned int new_srtt;
int bucket;