0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1999-2018 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence * Principal Author: Bob Halley
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley/* #define inline */
7cd4c3ddd1baf5f2b204562fdba3da37c716cc78Andreas Gustafsson if (result != ISC_R_SUCCESS) goto failure; \
48019314431389cca5f8eba7ee9aa5bc08a67f4eMark Andrews * This is the map file header for RBTDB images. It is populated, and then
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * written, as the LAST thing done to the file. Writing this last (with
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * zeros in the header area initially) will ensure that the header is only
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * valid when the RBTDB image is also valid.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewstypedef struct rbtdb_file_header rbtdb_file_header_t;
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews/* Header length, always the same size regardless of structure size */
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley char version2[32]; /* repeated; must match version1 */
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley * Note that "impmagic" is not the first four bytes of the struct, so
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley * ISC_MAGIC_VALID cannot be used.
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley * Make casting easier in symbolic debuggers by using different names
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * for the 64 bit version.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews#define rdatasetiter_methods rdatasetiter_methods64
7cd4c3ddd1baf5f2b204562fdba3da37c716cc78Andreas Gustafsson#define add_empty_wildcards add_empty_wildcards64
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley#define cache_zonecut_callback cache_zonecut_callback64
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews#define clean_stale_headers clean_stale_headers64
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews#define cleanup_dead_nodes_callback cleanup_dead_nodes_callback64
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley#define cname_and_other_data cname_and_other_data64
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley#define dereference_iter_node dereference_iter_node64
e0df061f35a26d2bbd0986aa889f88b3710b32d4Bob Halley#define find_deepest_zonecut find_deepest_zonecut64
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews#define free_rbtdb_callback free_rbtdb_callback64
55254a46f91419b92eee0d20dfb958e8dd52526cBob Halley#define match_header_version match_header_version64
66b2f0d4bfa342770aa5e26a005a0c0ec5071231Bob Halley#define previous_closest_nsec previous_closest_nsec64
1f1d36a87b65186d9f89aac7f456ab1fd2a39ef6Andreas Gustafsson#define rbtdb_write_header rbtdb_write_header64
1f1d36a87b65186d9f89aac7f456ab1fd2a39ef6Andreas Gustafsson#define rbtdb_zero_header rbtdb_zero_header64
48019314431389cca5f8eba7ee9aa5bc08a67f4eMark Andrews#define rdataset_clearprefetch rdataset_clearprefetch64
421e4cf66e4cba0b0751a34a9c027e39fe0474f9Mark Andrews#define rdataset_disassociate rdataset_disassociate64
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews#define rdataset_getadditional rdataset_getadditional64
08af8bf5ade4131fe44926ad04fd489e64a620bbBob Halley#define rdataset_getownercase rdataset_getownercase64
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley#define rdataset_putadditional rdataset_putadditional64
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley#define rdataset_setadditional rdataset_setadditional64
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley#define rdataset_setownercase rdataset_setownercase64
b2ca6fd3a8293440b4d263723525396059cf2400Brian Wellington#define rdataset_settrust rdataset_settrust64
84185d19c7a9ef1ac23cc6236c8773697d4efeb1Brian Wellington#define rdatasetiter_current rdatasetiter_current64
4e142a5bccd2944174ad9ae58d86cf03e170054dBob Halley#define rdatasetiter_destroy rdatasetiter_destroy64
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley#define update_recordsandbytes update_recordsandbytes64
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley#define zone_zonecut_callback zone_zonecut_callback64
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley#define RBTDB_RDATATYPE_BASE(type) ((dns_rdatatype_t)((type) & 0xFFFF))
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley#define RBTDB_RDATATYPE_EXT(type) ((dns_rdatatype_t)((type) >> 16))
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley#define RBTDB_RDATATYPE_VALUE(base, ext) ((rbtdb_rdatatype_t)(((isc_uint32_t)ext) << 16) | (((isc_uint32_t)base) & 0xffff))
368b37b616234fce3d23099eb180f1dd38e1fb62Mark Andrews RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec)
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrence RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec3)
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ns)
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_cname)
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_dname)
b2ca6fd3a8293440b4d263723525396059cf2400Brian Wellington RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ds)
84185d19c7a9ef1ac23cc6236c8773697d4efeb1Brian Wellington RBTDB_RDATATYPE_VALUE(0, dns_rdatatype_any)
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * We use rwlock for DB lock only when ISC_RWLOCK_USEATOMIC is non 0.
94a08e09db3dc844b6ee4841c368a2d7074a9c3fAndreas Gustafsson * Using rwlock is effective with regard to lookup performance only when
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * it is implemented in an efficient way.
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff * Otherwise, it is generally wise to stick to the simple locking since rwlock
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * would require more memory or can even make lookups slower due to its own
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * overhead (when it internally calls mutex locks).
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley#define RBTDB_INITLOCK(l) isc_rwlock_init((l), 0, 0)
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley#define RBTDB_DESTROYLOCK(l) isc_rwlock_destroy(l)
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * Since node locking is sensitive to both performance and memory footprint,
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * we need some trick here. If we have both high-performance rwlock and
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * high performance and small-memory reference counters, we use rwlock for
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff * node lock and isc_refcount for node references. In this case, we don't have
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * to protect the access to the counters by locks.
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * Otherwise, we simply use ordinary mutex lock for node locking, and use
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * simple integers as reference counters which is protected by the lock.
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * In most cases, we can simply use wrapper macros such as NODE_LOCK and
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * NODE_UNLOCK. In some other cases, however, we need to protect reference
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * counters first and then protect other parts of a node as read-only data.
c866769e664ba0a6a5e6f9375245f5ccca393009David Lawrence * Special additional macros, NODE_STRONGLOCK(), NODE_WEAKLOCK(), etc, are also
c866769e664ba0a6a5e6f9375245f5ccca393009David Lawrence * provided for these special cases. When we can use the efficient backend
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * routines, we should only protect the "other members" by NODE_WEAKLOCK(read).
c866769e664ba0a6a5e6f9375245f5ccca393009David Lawrence * Otherwise, we should use NODE_STRONGLOCK() to protect the entire critical
c866769e664ba0a6a5e6f9375245f5ccca393009David Lawrence * section including the access to the reference counter.
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * Note that we cannot use NODE_LOCK()/NODE_UNLOCK() wherever the protected
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley * section is also protected by NODE_STRONGLOCK().
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews#if defined(ISC_RWLOCK_USEATOMIC) && defined(DNS_RBT_USEISCREFCOUNT)
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews#define NODE_INITLOCK(l) isc_rwlock_init((l), 0, 0)
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews#define NODE_DESTROYLOCK(l) isc_rwlock_destroy(l)
948eabe2a254a8a278ef6325f3790e75329ee656Bob Halley#define NODE_TRYUPGRADE(l) isc_rwlock_tryupgrade(l)
c866769e664ba0a6a5e6f9375245f5ccca393009David Lawrence#define NODE_WEAKUNLOCK(l, t) NODE_UNLOCK(l, t)
c866769e664ba0a6a5e6f9375245f5ccca393009David Lawrence#define NODE_WEAKDOWNGRADE(l) isc_rwlock_downgrade(l)
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * Whether to rate-limit updating the LRU to avoid possible thread contention.
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * Our performance measurement has shown the cost is marginal, so it's defined
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * to be 0 by default either with or without threads.
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * Allow clients with a virtual time of up to 5 minutes in the past to see
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * records that would have otherwise have expired.
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * Locked by the owning node's lock.
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * We don't use the LIST macros, because the LIST structure has
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * both head and tail pointers, and is doubly linked.
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * If this is the top header for an rdataset, 'next' points
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * to the top header for the next rdataset (i.e., the next type).
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * Otherwise, it points up to the header whose down pointer points
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * at this header.
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * Points to the header for the next older version of
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * this rdataset.
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * Monotonously increased every time this rdataset is bound so that
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * it is used as the base of the starting point in DNS responses
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * when the "cyclic" rrset-order is required. Since the ordering
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * should not be so crucial, no lock is set for the counter for
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * performance reasons.
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * Used for TTL-based cache cleaning.
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * Case vector. If the bit is set then the corresponding
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * character in the owner name needs to be AND'd with 0x20,
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * rendering that character upper case.
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉typedef ISC_LIST(rdatasetheader_t) rdatasetheaderlist_t;
d0eb2cc33c5db3366a16b1cb0abcca6ec7c8ee3cTatuya JINMEI 神明達哉typedef ISC_LIST(dns_rbtnode_t) rbtnodelist_t;
cccfafa31131844c3b82e4c92f87f243d7ca3287Mark Andrews * When the cache will pre-expire data (due to memory low or other
cccfafa31131844c3b82e4c92f87f243d7ca3287Mark Andrews * situations) before the rdataset's TTL has expired, it MUST
cccfafa31131844c3b82e4c92f87f243d7ca3287Mark Andrews * respect the RETAIN bit and not expire the data until its TTL is
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews#undef IGNORE /* WIN32 winbase.h defines this. */
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews (((header)->attributes & RDATASET_ATTR_NONEXISTENT) == 0)
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews (((header)->attributes & RDATASET_ATTR_NONEXISTENT) != 0)
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews (((header)->attributes & RDATASET_ATTR_IGNORE) != 0)
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews (((header)->attributes & RDATASET_ATTR_RETAIN) != 0)
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews (((header)->attributes & RDATASET_ATTR_NXDOMAIN) != 0)
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews (((header)->attributes & RDATASET_ATTR_STALE) != 0)
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews (((header)->attributes & RDATASET_ATTR_RESIGN) != 0)
cccfafa31131844c3b82e4c92f87f243d7ca3287Mark Andrews (((header)->attributes & RDATASET_ATTR_OPTOUT) != 0)
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews (((header)->attributes & RDATASET_ATTR_NEGATIVE) != 0)
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews (((header)->attributes & RDATASET_ATTR_PREFETCH) != 0)
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews (((header)->attributes & RDATASET_ATTR_CASESET) != 0)
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews (((header)->attributes & RDATASET_ATTR_ZEROTTL) != 0)
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews (((header)->attributes & RDATASET_ATTR_CASEFULLYLOWER) != 0)
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews ((header)->rdh_ttl == (now) && ZEROTTL(header)))
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews#define DEFAULT_NODE_LOCK_COUNT 7 /*%< Should be prime. */
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * Number of buckets for cache DB entries (locks, LRU lists, TTL heaps).
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * There is a tradeoff issue about configuring this value: if this is too
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * small, it may cause heavier contention between threads; if this is too large,
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * LRU purge algorithm won't work well (entries tend to be purged prematurely).
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * The default value should work well for most environments, but this can
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * also be configurable at compilation time via the
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * DNS_RBTDB_CACHE_NODE_LOCK_COUNT variable. This value must be larger than
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * 1 due to the assumption of overmem_purge().
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews#error "DNS_RBTDB_CACHE_NODE_LOCK_COUNT must be larger than 1"
515c7f3c43f76d7b439905b18009105364b36100Automatic Updater#define DEFAULT_CACHE_NODE_LOCK_COUNT DNS_RBTDB_CACHE_NODE_LOCK_COUNT
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews#endif /* DNS_RBTDB_CACHE_NODE_LOCK_COUNT */
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrewstypedef struct {
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews /* Protected in the refcount routines. */
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews /* Locked by lock. */
cccfafa31131844c3b82e4c92f87f243d7ca3287Mark Andrewstypedef ISC_LIST(rbtdb_changed_t) rbtdb_changedlist_t;
cccfafa31131844c3b82e4c92f87f243d7ca3287Mark Andrewstypedef enum {
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews/* Reason for expiring a record from cache */
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrewstypedef enum {
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews /* Not locked */
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * Protected in the refcount routines.
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * XXXJT: should we change the lock policy based on the refcount
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * performance?
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews /* Locked by database lock. */
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews /* NSEC3 parameters */
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews * records and bytes are covered by rwlock.
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrewstypedef ISC_LIST(rbtdb_version_t) rbtdb_versionlist_t;
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews /* Unlocked. */
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews /* Locks the data in this struct */
b335299322e50f045f10e4636262cd2f8d407a8bMark Andrews /* Locks the tree structure (prevents nodes appearing/disappearing) */
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews /* Locks for individual tree nodes */
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews /* Locked by lock. */
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * This is a linked list used to implement the LRU cache. There will
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * be node_lock_count linked lists here. Nodes in bucket 1 will be
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * placed on the linked list rdatasets[1].
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * Temporary storage for stale cache nodes and dynamically deleted
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt * nodes that await being cleaned up.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * Heaps. These are used for TTL based expiry in a cache,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * or for zone resigning in a zone DB. hmctx is the memory
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * context to use for the heap (which differs from the main
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * database memory context in the case of a cache).
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * Base values for the mmap() code.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews /* Locked by tree_lock. */
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews /* Unlocked */
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * Search Context
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewstypedef struct {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * Load Context
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
#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)
static isc_boolean_t
static isc_boolean_t
if (interval == 0)
if (usecs == 0) {
return (old);
if (nodes == 0)
return (nodes);
&refs);
sizeof(rbtdb_version_t));
&start);
NULL,
sizeof(isc_event_t));
if (log) {
sizeof(buf));
sizeof(rdatasetheaderlist_t));
sizeof(dns_dbonupdatelistener_t));
inactive++;
if (inactive != 0) {
if (want_free) {
sizeof(buf));
if (refs == 0)
static inline rbtdb_version_t *
return (NULL);
return (NULL);
return (version);
static isc_result_t
ISC_TRUE);
sizeof(*version));
return (result);
return (ISC_R_SUCCESS);
static rbtdb_changed_t *
return (changed);
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
h->rdh_ttl = 0;
sizeof(*rdataset));
if (make_dirty)
if (!still_dirty)
node,
case DNS_RBT_NSEC_NORMAL:
case DNS_RBT_NSEC_HAS_NSEC:
case DNS_RBT_NSEC_NSEC:
case DNS_RBT_NSEC_NSEC3:
sizeof(isc_event_t));
count--;
if (maybe_cleanup)
static isc_boolean_t
if (nrefs == 0) {
if (nrefs > 0) {
return (ISC_FALSE);
if (least_serial == 0) {
goto restore_locks;
if (write_locked) {
sizeof(isc_event_t));
deadlink);
if (write_locked)
if (write_locked)
return (no_reference);
if (!haszonekey) {
while (count-- > 0U) {
®ion);
NULL);
goto unlock;
if (again)
if (refs == 0)
if (commit) {
goto end;
if (commit) {
&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_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
static isc_result_t
&header_prev)) {
return (result);
static inline isc_result_t
&header_prev)) {
&name);
result =
&name,
NULL);
goto node_exit;
rdataset);
} while (!done);
return (result);
static isc_result_t
return (result);
&header_prev)) {
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_prev)) {
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_prev)) {
goto find_ns;
return (result);
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
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);
if (add) {
static isc_result_t
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 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);
header);
return (result);
return (result);
header);
if (newheader_nx) {
return (DNS_R_UNCHANGED);
return (result);
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
return (result);
return (ISC_R_NOMEMORY);
(unsigned char *)header,
(unsigned char *)newheader,
(unsigned int)(sizeof(*newheader)),
goto unlock;
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
#ifdef MAP_FILE
return (ISC_R_FAILURE);
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
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
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);
static isc_result_t
return (result);
static isc_boolean_t
return (ISC_FALSE);
return (ISC_TRUE);
static isc_result_t
return (result);
static isc_result_t
static isc_boolean_t
return (secure);
static isc_boolean_t
return (dnssec);
return (count);
static size_t
return (size);
static isc_boolean_t
return (ISC_FALSE);
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
header--;
if (resign != 0) {
if (resign == 0) {
} else if (resign != 0) {
return (result);
static isc_result_t
goto unlock;
return (result);
header--;
static isc_result_t
return (ISC_R_SUCCESS);
static dns_stats_t *
static isc_result_t
return (result);
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
return (result);
#ifdef DNS_RBT_USEHASH
return (result);
return (ISC_R_NOMEMORY);
return (result);
return (ISC_R_SUCCESS);
sizeof(rdatasetheaderlist_t));
return (result);
static isc_result_t
if (count == 0) {
return (ISC_R_NOMORE);
count--;
return (ISC_R_SUCCESS);
static isc_result_t
if (count == 0)
return (ISC_R_NOMORE);
count--;
return (ISC_R_SUCCESS);
isc_region_t r;
length--;
raw++;
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;
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);
return (result);
static isc_result_t
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
static isc_result_t
static isc_result_t
switch (type) {
INSIST(0);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (result);
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);
c = bp[0];
c = *bp;
flip ^= c;
flip ^= c;
static inline isc_boolean_t
RDATASET_ATTR_ZEROTTL)) != 0)
return (ISC_FALSE);
return (ISC_TRUE);
purgecount--;
link);
purgecount--;
switch (reason) {
case expire_ttl:
case expire_lru: