rbtdb.c revision a8da00ef95ba37b9d071c2b8db1a0c967e060106
ebf264ea105fc78b8316a1166bae0624d488d83bMark Andrews * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC")
a7038d1a0513c8e804937ebc95fc9cb3a46c04f5Mark Andrews * Copyright (C) 1999-2003 Internet Software Consortium.
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * Permission to use, copy, modify, and/or distribute this software for any
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * purpose with or without fee is hereby granted, provided that the above
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence * Principal Author: Bob Halley
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson/* #define inline */
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define RBTDB_MAGIC ISC_MAGIC('R', 'B', 'D', '8')
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define RBTDB_MAGIC ISC_MAGIC('R', 'B', 'D', '4')
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson if (result != ISC_R_SUCCESS) goto failure; \
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * This is the map file header for RBTDB images. It is populated, and then
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * written, as the LAST thing done to the file. Writing this last (with
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * zeros in the header area initially) will ensure that the header is only
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * valid when the RBTDB image is also valid.
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafssontypedef struct rbtdb_file_header rbtdb_file_header_t;
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson/* Header length, always the same size regardless of structure size */
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson char version2[32]; /* repeated; must match version1 */
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson * Note that "impmagic" is not the first four bytes of the struct, so
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson * ISC_MAGIC_VALID cannot be used.
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews#define VALID_RBTDB(rbtdb) ((rbtdb) != NULL && \
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson * Make casting easier in symbolic debuggers by using different names
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson * for the 64 bit version.
66a12302e12be6813c3e16e6c05e4a7871e78e6eMark Andrews#define rdatasetiter_methods rdatasetiter_methods64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define add_empty_wildcards add_empty_wildcards64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define add_wildcard_magic add_wildcard_magic64
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews#define cache_zonecut_callback cache_zonecut_callback64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define cleanup_dead_nodes_callback cleanup_dead_nodes_callback64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define dbiterator_current dbiterator_current64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define dbiterator_destroy dbiterator_destroy64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define dbiterator_first dbiterator_first64
28e509b145c3d241d1d2d9102fea38afad95bbd4Andreas Gustafsson#define dbiterator_origin dbiterator_origin64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define dbiterator_pause dbiterator_pause64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define decrement_reference decrement_reference64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define find_closest_nsec find_closest_nsec64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define find_deepest_zonecut find_deepest_zonecut64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define free_acachearray free_acachearray64
8eaa51a6991ea6bc6c9db0b907beacde8dd1fed2Andreas Gustafsson#define free_rbtdb_callback free_rbtdb_callback64
4844ed026a9b5a91044e76399cee80a6514cbf0dMark Andrews#define loading_addrdataset loading_addrdataset64
4844ed026a9b5a91044e76399cee80a6514cbf0dMark Andrews#define previous_closest_nsec previous_closest_nsec64
4844ed026a9b5a91044e76399cee80a6514cbf0dMark Andrews#define rdataset_clearprefetch rdataset_clearprefetch64
4844ed026a9b5a91044e76399cee80a6514cbf0dMark Andrews#define rdataset_disassociate rdataset_disassociate64
4844ed026a9b5a91044e76399cee80a6514cbf0dMark Andrews#define rdataset_getadditional rdataset_getadditional64
4844ed026a9b5a91044e76399cee80a6514cbf0dMark Andrews#define rdataset_getclosest rdataset_getclosest64
4844ed026a9b5a91044e76399cee80a6514cbf0dMark Andrews#define rdataset_getnoqname rdataset_getnoqname64
4844ed026a9b5a91044e76399cee80a6514cbf0dMark Andrews#define rdataset_putadditional rdataset_putadditional64
4844ed026a9b5a91044e76399cee80a6514cbf0dMark Andrews#define rdataset_setadditional rdataset_setadditional64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define rdataset_settrust rdataset_settrust64
87cafc5e70f79f2586d067fbdd64f61bbab069d2David Lawrence#define rdatasetiter_current rdatasetiter_current64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define rdatasetiter_destroy rdatasetiter_destroy64
87cafc5e70f79f2586d067fbdd64f61bbab069d2David Lawrence#define rdatasetiter_first rdatasetiter_first64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define setup_delegation setup_delegation64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define subtractrdataset subtractrdataset64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define update_cachestats update_cachestats64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define update_newheader update_newheader64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define update_rrsetstats update_rrsetstats64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define zone_findrdataset zone_findrdataset64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define zone_findzonecut zone_findzonecut64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define zone_zonecut_callback zone_zonecut_callback64
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define RBTDB_RDATATYPE_BASE(type) ((dns_rdatatype_t)((type) & 0xFFFF))
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define RBTDB_RDATATYPE_EXT(type) ((dns_rdatatype_t)((type) >> 16))
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson#define RBTDB_RDATATYPE_VALUE(b, e) ((rbtdb_rdatatype_t)((e) << 16) | (b))
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec)
87cafc5e70f79f2586d067fbdd64f61bbab069d2David Lawrence RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec3)
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ns)
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_cname)
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_dname)
91cd0f93ad34d23e8b09dca337120f64fbe8f0a1Andreas Gustafsson RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ds)
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson RBTDB_RDATATYPE_VALUE(0, dns_rdatatype_any)
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews * We use rwlock for DB lock only when ISC_RWLOCK_USEATOMIC is non 0.
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews * Using rwlock is effective with regard to lookup performance only when
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews * it is implemented in an efficient way.
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews * Otherwise, it is generally wise to stick to the simple locking since rwlock
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews * would require more memory or can even make lookups slower due to its own
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews * overhead (when it internally calls mutex locks).
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews#define RBTDB_INITLOCK(l) isc_rwlock_init((l), 0, 0)
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews#define RBTDB_DESTROYLOCK(l) isc_rwlock_destroy(l)
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews * Since node locking is sensitive to both performance and memory footprint,
e12b02b62c0176646aad3097b3576cd47665e347Mark Andrews * we need some trick here. If we have both high-performance rwlock and
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews * high performance and small-memory reference counters, we use rwlock for
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews * node lock and isc_refcount for node references. In this case, we don't have
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews * to protect the access to the counters by locks.
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews * Otherwise, we simply use ordinary mutex lock for node locking, and use
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * simple integers as reference counters which is protected by the lock.
d80da258e377f02f0dcd703b89a1044cc58e949fMichael Graff * In most cases, we can simply use wrapper macros such as NODE_LOCK and
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * NODE_UNLOCK. In some other cases, however, we need to protect reference
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * counters first and then protect other parts of a node as read-only data.
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * Special additional macros, NODE_STRONGLOCK(), NODE_WEAKLOCK(), etc, are also
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews * provided for these special cases. When we can use the efficient backend
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * routines, we should only protect the "other members" by NODE_WEAKLOCK(read).
cbc0becf053009dd4a94a66c3283aad2fbd512a4Mark Andrews * Otherwise, we should use NODE_STRONGLOCK() to protect the entire critical
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews * section including the access to the reference counter.
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews * Note that we cannot use NODE_LOCK()/NODE_UNLOCK() wherever the protected
5d82424f5d3c77c092c111b935041fd3dc4b3e98Andreas Gustafsson * section is also protected by NODE_STRONGLOCK().
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews#if defined(ISC_RWLOCK_USEATOMIC) && defined(DNS_RBT_USEISCREFCOUNT)
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews#define NODE_INITLOCK(l) isc_rwlock_init((l), 0, 0)
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews#define NODE_DESTROYLOCK(l) isc_rwlock_destroy(l)
15683369e0113bd08863a705a8a1785c093455d3Mark Andrews#define NODE_TRYUPGRADE(l) isc_rwlock_tryupgrade(l)
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews#define NODE_STRONGLOCK(l) ((void)0)
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews#define NODE_STRONGUNLOCK(l) ((void)0)
6526fd032fc418411da3af4201214e95c113d3e2Mark Andrews#define NODE_WEAKDOWNGRADE(l) isc_rwlock_downgrade(l)
7e361074bc8a2df7a0891a7040eea02ca3a5e286Andreas Gustafsson#define NODE_INITLOCK(l) isc_mutex_init(l)
91cd0f93ad34d23e8b09dca337120f64fbe8f0a1Andreas Gustafsson#define NODE_DESTROYLOCK(l) DESTROYLOCK(l)
91cd0f93ad34d23e8b09dca337120f64fbe8f0a1Andreas Gustafsson#define NODE_WEAKLOCK(l, t) ((void)0)
7e361074bc8a2df7a0891a7040eea02ca3a5e286Andreas Gustafsson#define NODE_WEAKUNLOCK(l, t) ((void)0)
7e361074bc8a2df7a0891a7040eea02ca3a5e286Andreas Gustafsson#define NODE_WEAKDOWNGRADE(l) ((void)0)
d80da258e377f02f0dcd703b89a1044cc58e949fMichael Graff * Whether to rate-limit updating the LRU to avoid possible thread contention.
d80da258e377f02f0dcd703b89a1044cc58e949fMichael Graff * Our performance measurement has shown the cost is marginal, so it's defined
d80da258e377f02f0dcd703b89a1044cc58e949fMichael Graff * to be 0 by default either with or without threads.
d80da258e377f02f0dcd703b89a1044cc58e949fMichael Graff * Allow clients with a virtual time of up to 5 minutes in the past to see
6eccf5bd07eb9abf65cc08fec4a8fc97b62c0e1bBrian Wellington * records that would have otherwise have expired.
79a6a33184abff1999ba13b10922ccb34a2758a5Mark Andrewstypedef struct rdatasetheader {
79a6a33184abff1999ba13b10922ccb34a2758a5Mark Andrews * Locked by the owning node's lock.
79a6a33184abff1999ba13b10922ccb34a2758a5Mark Andrews * We don't use the LIST macros, because the LIST structure has
79a6a33184abff1999ba13b10922ccb34a2758a5Mark Andrews * both head and tail pointers, and is doubly linked.
79a6a33184abff1999ba13b10922ccb34a2758a5Mark Andrews * If this is the top header for an rdataset, 'next' points
6eccf5bd07eb9abf65cc08fec4a8fc97b62c0e1bBrian Wellington * to the top header for the next rdataset (i.e., the next type).
6eccf5bd07eb9abf65cc08fec4a8fc97b62c0e1bBrian Wellington * Otherwise, it points up to the header whose down pointer points
de6fe5ebe289d8e922b2fd8e8d642b6dd4f2a8efDavid Lawrence * at this header.
900d7d9c9bc443110f9a2b93c94def44093d64b0David Lawrence * Points to the header for the next older version of
6eccf5bd07eb9abf65cc08fec4a8fc97b62c0e1bBrian Wellington * this rdataset.
6eccf5bd07eb9abf65cc08fec4a8fc97b62c0e1bBrian Wellington * Monotonously increased every time this rdataset is bound so that
unsigned int heap_index;
typedef struct acache_cbarg {
unsigned int count;
struct acachectl {
typedef struct rbtdb_changed {
} expire_t;
typedef struct rbtdb_version {
struct dns_rbtdb {
/* Locks the tree structure (prevents nodes appearing/disappearing) */
unsigned int node_lock_count;
unsigned int active;
unsigned int attributes;
void * mmap_location;
unsigned int quantum;
unsigned int options;
} rbtdb_load_t;
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
typedef struct rbtdb_rdatasetiter {
typedef struct rbtdb_dbiterator {
int delete;
static unsigned int init_count;
#ifdef DEBUG
isc_buffer_t b;
isc_region_t r;
isc_buffer_putuint8(&b, 0);
} while (size > 0);
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_CNAME:
case DNS_R_DNAME:
case DNS_R_DELEGATION:
case DNS_R_NCACHENXDOMAIN:
case DNS_R_NCACHENXRRSET:
if (increment)
int idx;
static isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
static isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
unsigned int interval;
unsigned int new;
if (interval == 0)
if (usecs == 0) {
return (old);
if (new == 0)
return (new);
unsigned int refs;
&refs);
sizeof(rbtdb_version_t));
&start);
NULL,
sizeof(isc_event_t));
if (log) {
sizeof(buf));
sizeof(rdatasetheaderlist_t));
unsigned int inactive = 0;
inactive++;
if (inactive != 0) {
if (want_free) {
sizeof(buf));
unsigned int refs;
if (refs == 0)
unsigned int refs;
static inline rbtdb_version_t *
return (NULL);
return (NULL);
return (version);
static isc_result_t
ISC_TRUE);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
unsigned int refs;
static rbtdb_changed_t *
unsigned int refs;
return (changed);
unsigned int count;
for (i = 0; i < count; i++)
h->heap_index = 0;
h->is_mmapped = 0;
h->next_is_relative = 0;
h->node_is_relative = 0;
#if TRACE_HEADER
p = (char *) old;
p = (char *) old;
static inline rdatasetheader_t *
rdatasetheader_t *h;
if (h == NULL)
return (NULL);
#if TRACE_HEADER
unsigned int size;
int idx;
sizeof(*rdataset));
if (make_dirty)
if (!still_dirty)
case DNS_RBT_NSEC_NORMAL:
case DNS_RBT_NSEC_HAS_NSEC:
case DNS_RBT_NSEC_NSEC:
case DNS_RBT_NSEC_NSEC3:
count--;
if (maybe_cleanup)
static isc_boolean_t
#define KEEP_NODE(n, r) \
if (nrefs == 0) {
if (nrefs > 0) {
return (ISC_FALSE);
if (least_serial == 0) {
goto restore_locks;
if (write_locked) {
sizeof(isc_event_t));
deadlink);
node,
sizeof(printname)));
if (write_locked)
if (write_locked)
return (no_reference);
unsigned int locknum;
if (!haszonekey) {
while (count-- > 0U) {
®ion);
NULL);
goto unlock;
unsigned int locknum;
unsigned int refs;
if (again)
if (refs == 0)
unsigned int refs;
if (commit) {
goto end;
if (commit) {
unsigned cur_ref;
&cur_ref);
if (cur_ref == 0) {
&cleanup_list);
if (cur_ref == 0) {
link);
&cur_ref);
&cleanup_list);
link);
sizeof(*cleanup_version));
header);
if (rollback)
sizeof(*changed));
end:
static isc_result_t
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
return (result);
&node);
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
if (!create) {
return (result);
#ifdef DNS_RBT_USEHASH
return (result);
return (result);
* a longer domain. A common example is adding *.example.com
* (implicitly creating example.com) followed by explicitly adding
* example.com.
return (ISC_R_SUCCESS);
static isc_result_t
static isc_result_t
static isc_result_t
return (DNS_R_CONTINUE);
return (result);
static inline isc_result_t
return (result);
return (DNS_R_DNAME);
return (DNS_R_DELEGATION);
static inline isc_boolean_t
return (ISC_FALSE);
return (ISC_FALSE);
while (count > 0) {
count--;
return (valid);
static inline isc_boolean_t
return (answer);
static inline isc_boolean_t
return (answer);
static inline isc_result_t
if (wild) {
&name,
NULL);
wname)) {
return (ISC_R_NOTFOUND);
if (active) {
} while (!done);
return (result);
static isc_boolean_t
while (count-- > 0) {
return (ISC_TRUE);
return (ISC_FALSE);
static inline isc_result_t
return (result);
nodep);
return (result);
if (*firstp) {
return (result);
return (result);
return (result);
return (result);
return (DNS_R_BADDB);
static inline isc_result_t
return (result);
if (!empty_node) {
NULL);
node);
rdataset);
node,
&prevnode,
&first);
if (!first)
goto again;
return (result);
static isc_result_t
goto tree_exit;
goto tree_exit;
goto found;
goto tree_exit;
goto tree_exit;
goto tree_exit;
if (maybe_zonecut &&
goto partial_match;
cname_ok)) {
cname_ok) {
sigtype =
} else if (cname_ok &&
if (empty_node) {
if (!wild) {
goto partial_match;
goto tree_exit;
if (!wild) {
goto node_exit;
goto tree_exit;
goto node_exit;
0, rdataset);
if (wild)
goto node_exit;
goto tree_exit;
if (!at_zonecut)
if (wild)
if (close_version)
return (result);
static isc_result_t
return (ISC_R_NOTIMPLEMENTED);
static isc_result_t
mctx,
header);
header);
header);
return (result);
static inline isc_result_t
RBTDB_VIRTUAL) &&
isc_mem_t *m;
m, header);
header);
header);
&name);
result =
&name,
NULL);
goto node_exit;
rdataset);
} while (!done);
return (result);
static isc_result_t
return (result);
isc_mem_t *m;
m, header);
header);
header);
goto unlock_node;
} else if (!empty_node) {
NULL);
return (result);
static isc_result_t
return (result);
static isc_result_t
if (now == 0)
goto tree_exit;
goto tree_exit;
goto tree_exit;
goto tree_exit;
header);
header);
cname_ok &&
} else if (cname_ok &&
if (empty_node) {
goto find_ns;
rdataset);
goto node_exit;
goto find_ns;
rdataset);
return (result);
static isc_result_t
if (now == 0)
goto tree_exit;
goto tree_exit;
header);
header);
goto find_ns;
return (result);
unsigned int refs;
if (inactive) {
if (want_free) {
sizeof(buf));
static isc_result_t
if (now == 0)
if (log)
sizeof(printname)));
if (log)
} else if (force_expire) {
} else if (log) {
return (ISC_R_SUCCESS);
/* This is an empty callback. See adb.c:water() */
if (!first)
static isc_result_t
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
static isc_result_t
now = 0;
if (covers == 0)
sigmatchtype = 0;
if (close_version)
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
static isc_result_t
if (now == 0)
if (covers == 0)
sigmatchtype = 0;
return (ISC_R_NOTFOUND);
return (result);
static isc_result_t
unsigned int refs;
return (ISC_R_NOMEMORY);
now = 0;
&refs);
if (now == 0)
return (ISC_R_SUCCESS);
static isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
static isc_result_t
return (result);
static isc_result_t
unsigned char *merged;
int idx;
return (ISC_R_NOMEMORY);
negtype = 0;
goto find_header;
return (DNS_R_UNCHANGED);
goto find_header;
return (DNS_R_UNCHANGED);
return (DNS_R_UNCHANGED);
if (merge) {
unsigned int flags = 0;
(unsigned char *)header,
(unsigned char *)newheader,
(unsigned int)(sizeof(*newheader)),
return (result);
(unsigned char *)newheader,
(unsigned int)(sizeof(*newheader)),
return (ISC_R_SUCCESS);
(unsigned char *)newheader,
(unsigned int)(sizeof(*newheader)))) {
return (ISC_R_SUCCESS);
if (loading) {
return (result);
return (result);
if (newheader_nx) {
return (DNS_R_UNCHANGED);
return (result);
return (DNS_R_CNAMEANDOTHER);
return (ISC_R_SUCCESS);
static inline isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
return (ISC_TRUE);
return (ISC_FALSE);
static inline isc_result_t
isc_region_t r;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
return (ISC_R_SUCCESS);
return(result);
static inline isc_result_t
isc_region_t r;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
return (ISC_R_SUCCESS);
return(result);
static isc_result_t
if (now == 0)
now = 0;
return (result);
now = 0;
return (result);
return (result);
if (cache_is_overmem)
if (tree_locked)
if (newnsec) {
if (tree_locked)
return (result);
static isc_result_t
unsigned char *subresult;
return (result);
return (ISC_R_NOMEMORY);
unsigned int flags = 0;
(unsigned char *)header,
(unsigned char *)newheader,
(unsigned int)(sizeof(*newheader)),
goto unlock;
goto unlock;
return (result);
static isc_result_t
return (ISC_R_NOTIMPLEMENTED);
return (ISC_R_NOTIMPLEMENTED);
return (ISC_R_NOMEMORY);
return (result);
static isc_result_t
name);
if (!hasnsec)
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return (noderesult);
static isc_result_t
return (DNS_R_NOTZONETOP);
return (DNS_R_INVALIDNS);
return (DNS_R_INVALIDNSEC3);
return (result);
return (result);
#ifdef DNS_RBT_USEHASH
®ion,
sizeof(rdatasetheader_t));
return (result);
return (result);
static isc_result_t
p = (unsigned char *) header;
#ifdef DEBUG
return (result);
return (ISC_R_INVALIDFILE);
return (ISC_R_INVALIDFILE);
return (ISC_R_SUCCESS);
static isc_result_t
int fd;
char *base;
#ifdef MAP_FILE
return (ISC_R_FAILURE);
return (result);
return (result);
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_NOMEMORY);
sizeof(*loadctx));
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_SUCCESS);
static isc_result_t
char pad[sizeof(char *)];
sizeof(rdatasetheader_t));
p = (unsigned char *) header;
return (ISC_R_RANGE);
#ifdef DEBUG
sizeof(rdatasetheader_t));
sizeof(rdatasetheader_t));
return (result);
static isc_result_t
return (result);
init_file_version(void) {
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
unsigned int locknum;
static isc_boolean_t
return (secure);
static isc_boolean_t
return (dnssec);
unsigned int count;
return (count);
unsigned int count;
return (count);
static isc_boolean_t
return (ISC_FALSE);
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
header--;
if (resign == 0) {
return (result);
static isc_result_t
unsigned int locknum;
goto unlock;
return (result);
header--;
static isc_result_t
return (ISC_R_SUCCESS);
static dns_stats_t *
dump,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
dump,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
#ifdef DNS_RBTDB_VERSION64
return (ISC_R_NOMEMORY);
if (argc != 0)
goto cleanup_rbtdb;
goto cleanup_lock;
goto cleanup_tree_lock;
sizeof(rbtdb_nodelock_t));
goto cleanup_tree_lock;
goto cleanup_node_locks;
sizeof(rdatasetheaderlist_t));
goto cleanup_rrsetstats;
sizeof(isc_heap_t *));
goto cleanup_rdatasets;
goto cleanup_heaps;
sizeof(rbtnodelist_t));
goto cleanup_heaps;
goto cleanup_deadnodes;
return (result);
return (result);
return (result);
return (result);
return (result);
#ifdef DNS_RBT_USEHASH
&nsec3node);
return (result);
#ifdef DNS_RBT_USEHASH
return (result);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
sizeof(rdatasetheaderlist_t));
return (result);
static isc_result_t
unsigned int count;
if (count == 0) {
return (ISC_R_NOMORE);
count--;
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int count;
unsigned int length;
if (count == 0)
return (ISC_R_NOMORE);
count--;
return (ISC_R_SUCCESS);
unsigned int offset;
unsigned int length;
isc_region_t r;
unsigned int flags = 0;
length--;
raw++;
unsigned int count;
return (count);
static isc_result_t
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_SUCCESS);
header--;
header--;
header--;
sizeof(*rbtiterator));
static isc_result_t
now = 0;
return (ISC_R_NOMORE);
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_NOMORE);
now = 0;
RDATASET_ATTR_NONEXISTENT) != 0 ||
return (ISC_R_NOMORE);
return (ISC_R_SUCCESS);
rdataset);
if (was_read_locked) {
static isc_result_t
origin);
return (result);
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
return (result);
unsigned int refs;
return (result);
static isc_result_t
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
static isc_result_t
static isc_result_t
unsigned int count;
unsigned int total_count;
switch (type) {
INSIST(0);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (result);
unsigned int count;
INSIST(0);
static isc_result_t
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
goto fail;
goto fail;
switch (type) {
INSIST(0);
sizeof(acachectl_t));
goto fail;
for (i = 0; i < total_count; i++) {
switch (type) {
INSIST(0);
return (ISC_R_SUCCESS);
fail:
&newcbarg);
sizeof(*newcbarg));
return (result);
static isc_result_t
return (ISC_R_SUCCESS);
switch (type) {
INSIST(0);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
static inline isc_boolean_t
return (ISC_FALSE);
return (ISC_TRUE);
unsigned int locknum;
purgecount--;
link);
purgecount--;
switch (reason) {
case expire_ttl:
case expire_lru: