adb.c revision e883738546c7c73b761bce8a15e08661863d3ae1
5fa46bc91672ef5737aee6f99763161511566c24Tinderbox User * Copyright (C) 1999 Internet Software Consortium.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Permission to use, copy, modify, and distribute this software for any
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * purpose with or without fee is hereby granted, provided that the above
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * copyright notice and this permission notice appear in all copies.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * Implementation notes
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * --------------------
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * In finds, if task == NULL, no events will be generated, and no events
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * have been sent. If task != NULL but taskaction == NULL, an event has been
f4b4e7c16211137332e50bcad3fef0d15639a4f1Brian Wellington * posted but not yet freed. If neigher are NULL, no event was posted.
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ADB_MAGIC 0x44616462 /* Dadb. */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ADB_VALID(x) ISC_MAGIC_VALID(x, DNS_ADB_MAGIC)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBNAME_MAGIC 0x6164624e /* adbN. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBNAME_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBNAME_MAGIC)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBNAMEHOOK_MAGIC 0x61644e48 /* adNH. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBNAMEHOOK_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBNAMEHOOK_MAGIC)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBZONEINFO_MAGIC 0x6164625a /* adbZ. */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#define DNS_ADBZONEINFO_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBZONEINFO_MAGIC)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBENTRY_MAGIC 0x61646245 /* adbE. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBENTRY_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBENTRY_MAGIC)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBFETCH_MAGIC 0x61644634 /* adF4. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBFETCH_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBFETCH_MAGIC)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBFETCH6_MAGIC 0x61644636 /* adF6. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBFETCH6_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBFETCH6_MAGIC)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Lengths of lists needs to be small primes.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBNAMELIST_LENGTH 31 /* how many buckets for names */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADBENTRYLIST_LENGTH 31 /* how many buckets for addresses */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington/* clean this many seconds initially */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define CLEAN_SECONDS (300 / DNS_ADBNAMELIST_LENGTH)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define FREE_ITEMS 16 /* free count for memory pools */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define FILL_COUNT 8 /* fill count for memory pools */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_ADB_INVALIDBUCKET (-1) /* invalid bucket address */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtontypedef ISC_LIST(dns_adbname_t) dns_adbnamelist_t;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtontypedef struct dns_adbnamehook dns_adbnamehook_t;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtontypedef ISC_LIST(dns_adbnamehook_t) dns_adbnamehooklist_t;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtontypedef struct dns_adbzoneinfo dns_adbzoneinfo_t;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtontypedef ISC_LIST(dns_adbentry_t) dns_adbentrylist_t;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtontypedef struct dns_adbfetch6 dns_adbfetch6_t;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_mempool_t *zimp; /* dns_adbzoneinfo_t */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_mempool_t *aimp; /* dns_adbaddrinfo_t */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_mempool_t *af6mp; /* dns_adbfetch6_t */
557bcc2092642b2d4668c9b08872c9f2bb88bddbMark Andrews * Bucketized locks and lists for names.
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington dns_adbnamelist_t names[DNS_ADBNAMELIST_LENGTH];
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington isc_mutex_t namelocks[DNS_ADBNAMELIST_LENGTH];
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington isc_boolean_t name_sd[DNS_ADBNAMELIST_LENGTH];
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington unsigned int name_refcnt[DNS_ADBNAMELIST_LENGTH];
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington * Bucketized locks for entries.
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington dns_adbentrylist_t entries[DNS_ADBENTRYLIST_LENGTH];
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington isc_mutex_t entrylocks[DNS_ADBENTRYLIST_LENGTH];
557bcc2092642b2d4668c9b08872c9f2bb88bddbMark Andrews * XXX: This has a pointer to the adb it came from. It shouldn't need
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington * this, but I can't think of how to get rid of it. In particular, since
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * events have but one "arg" value, and that is currently used for the name
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * pointer in fetches, we need a way to get to the fetch contexts as well
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington * as the adb itself.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * dns_adbnamehook_t
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * This is a small widget that dangles off a dns_adbname_t. It contains a
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * pointer to the address information about this host, and a link to the next
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * namehook that will contain the next address this host has.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * dns_adbzoneinfo_t
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * This is a small widget that holds zone-specific information about an
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * address. Currently limited to lameness, but could just as easily be
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * extended to other types of information about zones.
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington * An address entry. It holds quite a bit of information about addresses,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * including edns state, rtt, and of course the address of the host.
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews unsigned int magic;
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews unsigned int flags;
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington unsigned int srtt;
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington * Internal functions (and prototypes).
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellingtonstatic inline dns_adbname_t *new_adbname(dns_adb_t *, dns_name_t *);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellingtonstatic inline void free_adbname(dns_adb_t *, dns_adbname_t **);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic inline dns_adbnamehook_t *new_adbnamehook(dns_adb_t *,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic inline void free_adbnamehook(dns_adb_t *, dns_adbnamehook_t **);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellingtonstatic inline dns_adbzoneinfo_t *new_adbzoneinfo(dns_adb_t *, dns_name_t *);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellingtonstatic inline void free_adbzoneinfo(dns_adb_t *, dns_adbzoneinfo_t **);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic inline dns_adbentry_t *new_adbentry(dns_adb_t *);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void free_adbentry(dns_adb_t *, dns_adbentry_t **);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline dns_adbfind_t *new_adbfind(dns_adb_t *);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellingtonstatic inline void free_adbfind(dns_adb_t *, dns_adbfind_t **);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellingtonstatic inline dns_adbaddrinfo_t *new_adbaddrinfo(dns_adb_t *,
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellingtonstatic inline dns_adbfetch_t *new_adbfetch(dns_adb_t *);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellingtonstatic inline void free_adbfetch(dns_adb_t *, dns_adbfetch_t **);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline dns_adbfetch6_t *new_adbfetch6(dns_adb_t *, dns_adbname_t *,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void free_adbfetch6(dns_adb_t *, dns_adbfetch6_t **);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic inline dns_adbname_t *find_name_and_lock(dns_adb_t *, dns_name_t *,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic inline dns_adbentry_t *find_entry_and_lock(dns_adb_t *,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic void print_dns_name(FILE *, dns_name_t *);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic void print_namehook_list(FILE *, dns_adbname_t *);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic void print_find_list(FILE *, dns_adbname_t *);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellingtonstatic void print_fetch_list(FILE *, dns_adbname_t *);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic inline void inc_adb_irefcnt(dns_adb_t *, isc_boolean_t);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic inline void dec_adb_irefcnt(dns_adb_t *, isc_boolean_t);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic inline void inc_adb_erefcnt(dns_adb_t *, isc_boolean_t);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic inline void dec_adb_erefcnt(dns_adb_t *, isc_boolean_t);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonstatic inline void inc_entry_refcnt(dns_adb_t *, dns_adbentry_t *,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void dec_entry_refcnt(dns_adb_t *, dns_adbentry_t *,
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellingtonstatic inline void violate_locking_hierarchy(isc_mutex_t *, isc_mutex_t *);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic void clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *);
de32cbd34e78bdd276e69cff239846760d4ee16eBrian Wellingtonstatic void clean_finds_at_name(dns_adbname_t *, isc_eventtype_t,
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews unsigned int);
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrewsstatic void check_expire_namehooks(dns_adbname_t *, isc_stdtime_t);
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellingtonstatic void cancel_fetches_at_name(dns_adb_t *, dns_adbname_t *);
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellingtonstatic isc_result_t dbfind_name(dns_adbfind_t *, dns_name_t *,
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellingtonstatic isc_result_t fetch_name_v4(dns_adbname_t *, isc_stdtime_t);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic isc_result_t fetch_name_aaaa(dns_adbname_t *, isc_stdtime_t);
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrewsstatic isc_result_t fetch_name_a6(dns_adbname_t *, isc_stdtime_t);
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrewsstatic void timer_cleanup(isc_task_t *, isc_event_t *);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void link_name(dns_adb_t *, int, dns_adbname_t *);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic inline void unlink_name(dns_adb_t *, dns_adbname_t *);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic void kill_name(dns_adbname_t **, isc_eventtype_t);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic void fetch_callback_a6(isc_task_t *, isc_event_t *);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonstatic isc_result_t dbfind_a6(dns_adbfind_t *, dns_name_t *,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * MUST NOT overlap DNS_ADBFIND_* flags!
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define EVENT_SENT(h) (((h)->flags & FIND_EVENT_SENT) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define EVENT_FREED(h) (((h)->flags & FIND_EVENT_FREED) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define NAME_DEAD(n) (((n)->flags & NAME_IS_DEAD) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define NAME_NEEDSPOKE(n) (((n)->flags & NAME_NEEDS_POKE) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define WANTEVENT(x) (((x) & DNS_ADBFIND_WANTEVENT) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define WANTEMPTYEVENT(x) (((x) & DNS_ADBFIND_EMPTYEVENT) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define HAVE_INET(n) (!ISC_LIST_EMPTY((n)->v4))
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define HAVE_INET6(n) (!ISC_LIST_EMPTY((n)->v6))
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define HAVE_ADDRS(h) (!ISC_LIST_EMPTY((h)->list))
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define QUERY_INET(x) (((x) & DNS_ADBFIND_INET) != 0)
2f012d936b5ccdf6520c96a4de23721dc58a2221Automatic Updater#define QUERY_INET6(x) (((x) & DNS_ADBFIND_INET6) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define QUERYPENDING(x, y) (((x) & (y)) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define WANT_INET(x) (((x) & DNS_ADBFIND_INET) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define WANT_INET6(x) (((x) & DNS_ADBFIND_INET6) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define WANTEDADDR(x, y) (((x) & (y)) != 0)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define NO_FETCHES_A(n) ((n)->fetch_a == NULL)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson#define NO_FETCHES_AAAA(n) ((n)->fetch_aaaa == NULL)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson#define NO_FETCHES_A6(n) (ISC_LIST_EMPTY((n)->fetches_a6))
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_ADB,
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson * Requires the adbname bucket be locked and that no entry buckets be locked.
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson * This code handles A and AAAA rdatasets only.
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafssonimport_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_adbentry_t *foundentry; /* NO CLEAN UP! */
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson INSIST((rdtype == dns_rdatatype_a) || (rdtype == dns_rdatatype_aaaa));
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson isc_sockaddr_fromin6(&sockaddr, &in6a, 53);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington foundentry = find_entry_and_lock(adb, &sockaddr, &addr_bucket);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson ISC_LIST_APPEND(adb->entries[addr_bucket],
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (addr_bucket != DNS_ADB_INVALIDBUCKET)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington adbname->expire_v4 = ISC_MIN(adbname->expire_v4, now + rdataset->ttl);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * Lie a little here. This is more or less so code that cares
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * can find out if any new information was added or not.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonimport_a6(void *arg, struct in6_addr *address)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_adbentry_t *foundentry; /* NO CLEAN UP! */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * XXX Once the time is passed in to us, this can go away.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington expire_time = now + 30; /* XXX 30 seconds */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington name->partial_result |= DNS_ADBFIND_INET6; /* clear for AAAA */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington isc_sockaddr_fromin6(&sockaddr, address, 53);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington foundentry = find_entry_and_lock(adb, &sockaddr, &addr_bucket);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson name->partial_result |= DNS_ADBFIND_INET6;
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson ISC_LIST_APPEND(adb->entries[addr_bucket], entry, plink);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (addr_bucket != DNS_ADB_INVALIDBUCKET)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington name->expire_v6 = ISC_MIN(name->expire_v6, expire_time);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Requires the name's bucket be locked.
f3ca27e9fe307b55e35ea8d7b37351650630e5a3Andreas Gustafssonkill_name(dns_adbname_t **n, isc_eventtype_t ev)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * If we're dead already, just check to see if we should go
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * away now or not.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Clean up the name's various lists. These two are destructive
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * in that they will always empty the list.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington clean_finds_at_name(name, ev, DNS_ADBFIND_ADDRESSMASK);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * If fetches are running, cancel them. If none are running, we can
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington * just kill the name here.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Requires the name's bucket be locked and no entry buckets be locked.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtoncheck_expire_namehooks(dns_adbname_t *name, isc_stdtime_t now)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Check to see if we need to remove the v4 addresses
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (QUERY_INET(name->query_pending) && (name->expire_v4 < now)) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Check to see if we need to remove the v6 addresses
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (QUERY_INET6(name->query_pending) && (name->expire_v6 < now)) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Requires the name's bucket be locked.
7829fad4093f2c1985b1efb7cea00287ff015d2bckbstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonlink_name(dns_adb_t *adb, int bucket, dns_adbname_t *name)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington INSIST(name->lock_bucket == DNS_ADB_INVALIDBUCKET);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington ISC_LIST_PREPEND(adb->names[bucket], name, plink);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Requires the name's bucket be locked.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonunlink_name(dns_adb_t *adb, dns_adbname_t *name)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington ISC_LIST_UNLINK(adb->names[bucket], name, plink);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonviolate_locking_hierarchy(isc_mutex_t *have, isc_mutex_t *want)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (isc_mutex_trylock(want) != ISC_R_SUCCESS) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * The ADB _MUST_ be locked before calling. Also, exit conditions must be
c0d2891f6e08fcf5379dfb9a1bf8fbbb63f1952aMark Andrews * checked after calling this function.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington for (bucket = 0 ; bucket < DNS_ADBNAMELIST_LENGTH ; bucket++) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Run through the list. For each name, clean up finds
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * found there, and cancel any fetches running. When
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * all the fetches are canceled, the name will destroy
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* kill_name() will decrement the refcnt. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Name bucket must be locked
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtoncancel_fetches_at_name(dns_adb_t *adb, dns_adbname_t *name)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_resolver_cancelfetch(adb->view->resolver,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_resolver_cancelfetch(adb->view->resolver,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * Assumes the name bucket is locked.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonclean_namehooks(dns_adb_t *adb, dns_adbnamehooklist_t *namehooks)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Clean up the entry if needed.
793814f80703afdd69b59ade91e63efa81ae4178Evan Hunt * Free the namehook
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington ISC_LIST_UNLINK(*namehooks, namehook, plink);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Assumes nothing is locked, since this is called by the client.
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington * Assumes the name bucket is locked.
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrewsclean_finds_at_name(dns_adbname_t *name, isc_eventtype_t evtype,
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews unsigned int addrs)
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington * If this is a successful poke, we want to match only
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * finds that are interested in the address family.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * If it is an unsuccessful poke (kill all names, etc)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * match everything that matches the "addrs" mask.
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington if (evtype != DNS_EVENT_ADBMOREADDRESSES) {
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews if ((find->options & DNS_ADBFIND_ADDRESSMASK) != 0)
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews * Unlink the find from the name, letting the caller
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews * call dns_adb_destroyfind() on it to clean it up later.
6e93e6ea4557291e847aced6a88adcdf39f06843Andreas Gustafsson ISC_LIST_UNLINK(name->finds, find, plink);
6e93e6ea4557291e847aced6a88adcdf39f06843Andreas Gustafsson find->name_bucket = DNS_ADB_INVALIDBUCKET;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington DP(1, "Sending event %p to task %p for find %p",
793814f80703afdd69b59ade91e63efa81ae4178Evan Huntstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington && (isc_mempool_getallocated(adb->ahmp) == 0))
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtoninc_adb_irefcnt(dns_adb_t *adb, isc_boolean_t lock)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondec_adb_irefcnt(dns_adb_t *adb, isc_boolean_t lock)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrewsinc_adb_erefcnt(dns_adb_t *adb, isc_boolean_t lock)
85fcd0b9b2d80be4646187d7094e5644a52e3263Mark Andrewsstatic inline void
85fcd0b9b2d80be4646187d7094e5644a52e3263Mark Andrewsdec_adb_erefcnt(dns_adb_t *adb, isc_boolean_t lock)
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrewsstatic inline void
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrewsinc_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock)
c302b021cc65cc9a358a9a1cbe48de12364f4cb6Brian Wellingtonstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondec_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock)
c302b021cc65cc9a358a9a1cbe48de12364f4cb6Brian Wellington ISC_LIST_UNLINK(adb->entries[bucket], entry, plink);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington entry->lock_bucket = DNS_ADB_INVALIDBUCKET;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonnew_adbname(dns_adb_t *adb, dns_name_t *dnsname)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (dns_name_dup(dnsname, adb->mctx, &name->name) != ISC_R_SUCCESS) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonfree_adbname(dns_adb_t *adb, dns_adbname_t **name)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington INSIST(name != NULL && DNS_ADBNAME_VALID(*name));
b7cd261f2fca2c7138cdc6ae8ee434e9c0031303Brian Wellington INSIST(n->lock_bucket == DNS_ADB_INVALIDBUCKET);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonnew_adbnamehook(dns_adb_t *adb, dns_adbentry_t *entry)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonfree_adbnamehook(dns_adb_t *adb, dns_adbnamehook_t **namehook)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington INSIST(namehook != NULL && DNS_ADBNAMEHOOK_VALID(*namehook));
7a6f285bc933d08353d2f18290c85def575b6e57Andreas Gustafssonnew_adbzoneinfo(dns_adb_t *adb, dns_name_t *zone)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (dns_name_dup(zone, adb->mctx, &zi->zone) != ISC_R_SUCCESS) {
7a6f285bc933d08353d2f18290c85def575b6e57Andreas Gustafssonstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonfree_adbzoneinfo(dns_adb_t *adb, dns_adbzoneinfo_t **zoneinfo)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington INSIST(zoneinfo != NULL && DNS_ADBZONEINFO_VALID(*zoneinfo));
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonstatic inline void
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonfree_adbentry(dns_adb_t *adb, dns_adbentry_t **entry)
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews INSIST(entry != NULL && DNS_ADBENTRY_VALID(*entry));
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington INSIST(e->lock_bucket == DNS_ADB_INVALIDBUCKET);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * public members
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * private members
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews "isc_mutex_init failed in new_adbfind()");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington ISC_EVENT_INIT(&h->event, sizeof (isc_event_t), 0, 0, 0, NULL, NULL,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonfree_adbfetch(dns_adb_t *adb, dns_adbfetch_t **fetch)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington INSIST(fetch != NULL && DNS_ADBFETCH_VALID(*fetch));
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (dns_rdataset_isassociated(&f->rdataset))
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Caller must be holding the name lock.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtona6find(void *arg, dns_name_t *a6name, dns_rdatatype_t type,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * XXXRTH Cache 'now' in the name so we don't have to call
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * isc_stdtime_get() on every dns_view_find().
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return (dns_view_find(adb->view, a6name, type, 0, 0, ISC_FALSE,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Caller must be holding the name lock.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtona6missing(dns_a6context_t *a6ctx, dns_name_t *a6name) {
4a30ede93d59137009db734661cde17612e8ffbeMark Andrews isc_buffer_init(&buffer, ndata, sizeof(ndata), ISC_BUFFERTYPE_BINARY);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* XXXRTH Use cached 'now' from name. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_view_findzonecut(adb->view, a6name, &fname, 0,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_resolver_createfetch(adb->view->resolver, a6name,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington ISC_LIST_APPEND(name->fetches_a6, fetch, plink);
4a30ede93d59137009db734661cde17612e8ffbeMark Andrewsnew_adbfetch6(dns_adb_t *adb, dns_adbname_t *name, dns_a6context_t *a6ctx)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_a6_init(&f->a6ctx, a6find, NULL, import_a6,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonfree_adbfetch6(dns_adb_t *adb, dns_adbfetch6_t **fetch)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington INSIST(fetch != NULL && DNS_ADBFETCH6_VALID(*fetch));
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington if (dns_rdataset_isassociated(&f->rdataset))
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
f24c135e09214c3843a49fd32ebef2f6a436ba8eBrian Wellingtonfree_adbfind(dns_adb_t *adb, dns_adbfind_t **findp)
f24c135e09214c3843a49fd32ebef2f6a436ba8eBrian Wellington INSIST(findp != NULL && DNS_ADBFIND_VALID(*findp));
75e1e12f48012505699f504cfa364260cb2bc1afBrian Wellington INSIST(find->name_bucket == DNS_ADB_INVALIDBUCKET);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Copy bits from the entry into the newly allocated addrinfo. The entry
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * must be locked, and the reference count must be bumped up by one
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * if this function returns a valid pointer.
f24c135e09214c3843a49fd32ebef2f6a436ba8eBrian Wellingtonnew_adbaddrinfo(dns_adb_t *adb, dns_adbentry_t *entry)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic inline void
78838d3e0cd62423c23de5503910e01884d2104bBrian Wellingtonfree_adbaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **ainfo)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington INSIST(ainfo != NULL && DNS_ADBADDRINFO_VALID(*ainfo));
a012d6dbfb100390efa7d0d4be64ada0210b09ddBrian Wellington * Search for the name. NOTE: The bucket is kept locked on both
a012d6dbfb100390efa7d0d4be64ada0210b09ddBrian Wellington * success and failure, so it must always be unlocked by the caller!
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * On the first call to this function, *bucketp must be set to
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * DNS_ADB_INVALIDBUCKET.
a012d6dbfb100390efa7d0d4be64ada0210b09ddBrian Wellingtonfind_name_and_lock(dns_adb_t *adb, dns_name_t *name, int *bucketp)
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉 bucket = dns_name_hash(name, ISC_FALSE) % DNS_ADBNAMELIST_LENGTH;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington adbname = ISC_LIST_HEAD(adb->names[bucket]);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Search for the address. NOTE: The bucket is kept locked on both
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * success and failure, so it must always be unlocked by the caller.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * On the first call to this function, *bucketp must be set to
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * DNS_ADB_INVALIDBUCKET. This will cause a lock to occur. On
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * later calls (within the same "lock path") it can be left alone, so
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * if this function is called multiple times locking is only done if
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * the bucket changes.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonfind_entry_and_lock(dns_adb_t *adb, isc_sockaddr_t *addr, int *bucketp)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington bucket = isc_sockaddr_hash(addr, ISC_TRUE) % DNS_ADBENTRYLIST_LENGTH;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington entry = ISC_LIST_HEAD(adb->entries[bucket]);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (isc_sockaddr_equal(addr, &entry->sockaddr))
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * Entry bucket MUST be locked!
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonentry_is_bad_for_zone(dns_adb_t *adb, dns_adbentry_t *entry, dns_name_t *zone,
01dbc4fc00adc933af96e88bfce95c07ef1f3c39Mark Andrews * Has the entry expired?
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington ISC_LIST_UNLINK(entry->zoneinfo, zi, plink);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington * Order tests from least to most expensive.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtoncopy_namehook_lists(dns_adb_t *adb, dns_adbfind_t *find,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_adbname_t *name, dns_name_t *zone, isc_stdtime_t now)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (entry_is_bad_for_zone(adb, namehook->entry,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington addrinfo = new_adbaddrinfo(adb, namehook->entry);
5d85bf183f957f9ea0902be1a6e3405b90bc7c0fBrian Wellington * Found a valid entry. Add it to the find's list.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington inc_entry_refcnt(adb, namehook->entry, ISC_FALSE);
b7cd261f2fca2c7138cdc6ae8ee434e9c0031303Brian Wellington ISC_LIST_APPEND(find->list, addrinfo, publink);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (entry_is_bad_for_zone(adb, namehook->entry,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington addrinfo = new_adbaddrinfo(adb, namehook->entry);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Found a valid entry. Add it to the find's list.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington inc_entry_refcnt(adb, namehook->entry, ISC_FALSE);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington ISC_LIST_APPEND(find->list, addrinfo, publink);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonshutdown_task(isc_task_t *task, isc_event_t *ev)
goto reset;
return (ISC_R_NOMEMORY);
goto fail0a;
goto fail0b;
goto fail0c;
goto fail1;
for (i = 0 ; i < DNS_ADBNAMELIST_LENGTH ; i++) {
for (i = 0 ; i < DNS_ADBENTRYLIST_LENGTH ; 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;
if (now == 0) {
return (result);
return (ISC_R_NOMEMORY);
goto out;
goto out;
adbname);
goto v6;
adbname);
goto v6;
v6:
goto copy;
adbname);
goto copy;
copy:
& wanted_addresses);
out:
if (attach_to_task) {
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 < DNS_ADBNAMELIST_LENGTH ; i++)
for (i = 0 ; i < DNS_ADBENTRYLIST_LENGTH ; i++)
for (i = 0 ; i < DNS_ADBNAMELIST_LENGTH ; i++) {
for (i = 0 ; i < DNS_ADBENTRYLIST_LENGTH ; i++) {
case AF_INET:
case AF_INET6:
for (i = 0 ; i < DNS_ADBENTRYLIST_LENGTH ; i++)
for (i = 0 ; i < DNS_ADBNAMELIST_LENGTH ; i++)
const char *tmpp;
case AF_INET:
case AF_INET6:
isc_buffer_t b;
static isc_result_t
return (ISC_R_NOTIMPLEMENTED);
switch (result) {
case DNS_R_GLUE:
case DNS_R_HINT:
case DNS_R_SUCCESS:
return (result);
static isc_result_t
return (ISC_R_NOTIMPLEMENTED);
switch (result) {
case DNS_R_GLUE:
case DNS_R_HINT:
case DNS_R_SUCCESS:
return (result);
int bucket;
(void)task;
if (decr_adbrefcnt)
goto out;
out:
int bucket;
(void)task;
if (decr_adbrefcnt)
goto out;
out:
int bucket;
(void)task;
if (decr_adbrefcnt)
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;
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;
if (factor == 0)