rbtdb.c File Reference

#include <config.h>
#include <isc/crc64.h>
#include <isc/event.h>
#include <isc/heap.h>
#include <isc/file.h>
#include <isc/hex.h>
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/once.h>
#include <isc/platform.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/refcount.h>
#include <isc/rwlock.h>
#include <isc/serial.h>
#include <isc/socket.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/time.h>
#include <isc/util.h>
#include <dns/acache.h>
#include <dns/callbacks.h>
#include <dns/db.h>
#include <dns/dbiterator.h>
#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/lib.h>
#include <dns/log.h>
#include <dns/masterdump.h>
#include <dns/nsec.h>
#include <dns/nsec3.h>
#include <dns/rbt.h>
#include <dns/rpz.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdataslab.h>
#include <dns/rdatastruct.h>
#include <dns/result.h>
#include <dns/stats.h>
#include <dns/version.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <dns/zonekey.h>
#include <sys/mman.h>
#include "rbtdb.h"
#include "rbtdb64.h"

Go to the source code of this file.

Data Structures

struct  rbtdb_file_header
struct  noqname
struct  rdatasetheader
struct  acachectl
struct  rbtdb_nodelock_t
struct  rbtdb_changed
struct  rbtdb_version
struct  rbtdb_search_t
 Search Context. More...
struct  rbtdb_load_t
 Load Context. More...
struct  rbtdb_rdatasetiter
struct  rbtdb_dbiterator

Defines

#define RBTDB_MAGIC   ISC_MAGIC('R', 'B', 'D', '4')
#define CHECK(op)
#define RBTDB_HEADER_LENGTH   1024
#define VALID_RBTDB(rbtdb)
 Note that "impmagic" is not the first four bytes of the struct, so ISC_MAGIC_VALID cannot be used.
#define RBTDB_RDATATYPE_BASE(type)   ((dns_rdatatype_t)((type) & 0xFFFF))
#define RBTDB_RDATATYPE_EXT(type)   ((dns_rdatatype_t)((type) >> 16))
#define RBTDB_RDATATYPE_VALUE(b, e)   ((rbtdb_rdatatype_t)((e) << 16) | (b))
#define RBTDB_RDATATYPE_SIGNSEC   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec)
#define RBTDB_RDATATYPE_SIGNSEC3   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec3)
#define RBTDB_RDATATYPE_SIGNS   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ns)
#define RBTDB_RDATATYPE_SIGCNAME   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_cname)
#define RBTDB_RDATATYPE_SIGDNAME   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_dname)
#define RBTDB_RDATATYPE_SIGDDS   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ds)
#define RBTDB_RDATATYPE_NCACHEANY   RBTDB_RDATATYPE_VALUE(0, dns_rdatatype_any)
#define DNS_RBTDB_USERWLOCK   0
#define RBTDB_INITLOCK(l)   isc_mutex_init(l)
#define RBTDB_DESTROYLOCK(l)   DESTROYLOCK(l)
#define RBTDB_LOCK(l, t)   LOCK(l)
#define RBTDB_UNLOCK(l, t)   UNLOCK(l)
#define NODE_INITLOCK(l)   isc_mutex_init(l)
#define NODE_DESTROYLOCK(l)   DESTROYLOCK(l)
#define NODE_LOCK(l, t)   LOCK(l)
#define NODE_UNLOCK(l, t)   UNLOCK(l)
#define NODE_TRYUPGRADE(l)   ISC_R_SUCCESS
#define NODE_STRONGLOCK(l)   LOCK(l)
#define NODE_STRONGUNLOCK(l)   UNLOCK(l)
#define NODE_WEAKLOCK(l, t)   ((void)0)
#define NODE_WEAKUNLOCK(l, t)   ((void)0)
#define NODE_WEAKDOWNGRADE(l)   ((void)0)
#define DNS_RBTDB_LIMITLRUUPDATE   0
 Whether to rate-limit updating the LRU to avoid possible thread contention. Our performance measurement has shown the cost is marginal, so it's defined to be 0 by default either with or without threads.
#define RBTDB_VIRTUAL   300
#define RDATASET_ATTR_NONEXISTENT   0x0001
#define RDATASET_ATTR_STALE   0x0002
#define RDATASET_ATTR_IGNORE   0x0004
#define RDATASET_ATTR_RETAIN   0x0008
#define RDATASET_ATTR_NXDOMAIN   0x0010
#define RDATASET_ATTR_RESIGN   0x0020
#define RDATASET_ATTR_STATCOUNT   0x0040
#define RDATASET_ATTR_OPTOUT   0x0080
#define RDATASET_ATTR_NEGATIVE   0x0100
#define RDATASET_ATTR_PREFETCH   0x0200
#define RDATASET_ATTR_CASESET   0x0400
#define EXISTS(header)   (((header)->attributes & RDATASET_ATTR_NONEXISTENT) == 0)
#define NONEXISTENT(header)   (((header)->attributes & RDATASET_ATTR_NONEXISTENT) != 0)
#define IGNORE(header)   (((header)->attributes & RDATASET_ATTR_IGNORE) != 0)
#define RETAIN(header)   (((header)->attributes & RDATASET_ATTR_RETAIN) != 0)
#define NXDOMAIN(header)   (((header)->attributes & RDATASET_ATTR_NXDOMAIN) != 0)
#define RESIGN(header)   (((header)->attributes & RDATASET_ATTR_RESIGN) != 0)
#define OPTOUT(header)   (((header)->attributes & RDATASET_ATTR_OPTOUT) != 0)
#define NEGATIVE(header)   (((header)->attributes & RDATASET_ATTR_NEGATIVE) != 0)
#define PREFETCH(header)   (((header)->attributes & RDATASET_ATTR_PREFETCH) != 0)
#define CASESET(header)   (((header)->attributes & RDATASET_ATTR_CASESET) != 0)
#define DEFAULT_NODE_LOCK_COUNT   7
 Should be prime.
#define DEFAULT_CACHE_NODE_LOCK_COUNT   16
 Number of buckets for cache DB entries (locks, LRU lists, TTL heaps). There is a tradeoff issue about configuring this value: if this is too small, it may cause heavier contention between threads; if this is too large, LRU purge algorithm won't work well (entries tend to be purged prematurely). The default value should work well for most environments, but this can also be configurable at compilation time via the DNS_RBTDB_CACHE_NODE_LOCK_COUNT variable. This value must be larger than 1 due to the assumption of overmem_purge().
#define RBTDB_ATTR_LOADED   0x01
#define RBTDB_ATTR_LOADING   0x02
#define DELETION_BATCH_MAX   64
#define IS_STUB(rbtdb)   (((rbtdb)->common.attributes & DNS_DBATTR_STUB) != 0)
#define IS_CACHE(rbtdb)   (((rbtdb)->common.attributes & DNS_DBATTR_CACHE) != 0)
#define KEEP_NODE(n, r)   ((n)->data != NULL || (n)->down != NULL || (n) == (r)->origin_node)

Typedefs

typedef struct rbtdb_file_header rbtdb_file_header_t
typedef isc_uint32_t rbtdb_serial_t
typedef isc_uint32_t rbtdb_rdatatype_t
typedef isc_mutex_t nodelock_t
typedef struct acachectl acachectl_t
typedef struct rdatasetheader rdatasetheader_t
typedef struct rbtdb_changed rbtdb_changed_t
typedef struct dns_rbtdb dns_rbtdb_t
typedef struct rbtdb_version rbtdb_version_t
typedef struct rbtdb_rdatasetiter rbtdb_rdatasetiter_t
typedef struct rbtdb_dbiterator rbtdb_dbiterator_t

Enumerations

enum  expire_t { expire_lru, expire_ttl, expire_flush }

Functions

typedef ISC_LIST (rdatasetheader_t)
typedef ISC_LIST (rbtdb_changed_t)
typedef ISC_LIST (rbtdb_version_t)
static void delete_callback (void *data, void *arg)
static void rdataset_disassociate (dns_rdataset_t *rdataset)
static isc_result_t rdataset_first (dns_rdataset_t *rdataset)
static isc_result_t rdataset_next (dns_rdataset_t *rdataset)
static void rdataset_current (dns_rdataset_t *rdataset, dns_rdata_t *rdata)
static void rdataset_clone (dns_rdataset_t *source, dns_rdataset_t *target)
static unsigned int rdataset_count (dns_rdataset_t *rdataset)
static isc_result_t rdataset_getnoqname (dns_rdataset_t *rdataset, dns_name_t *name, dns_rdataset_t *neg, dns_rdataset_t *negsig)
static isc_result_t rdataset_getclosest (dns_rdataset_t *rdataset, dns_name_t *name, dns_rdataset_t *neg, dns_rdataset_t *negsig)
static isc_result_t rdataset_getadditional (dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_rdatatype_t qtype, dns_acache_t *acache, dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp, dns_dbnode_t **nodep, dns_name_t *fname, dns_message_t *msg, isc_stdtime_t now)
 Additional cache routines.
static isc_result_t rdataset_setadditional (dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_rdatatype_t qtype, dns_acache_t *acache, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, dns_name_t *fname)
static isc_result_t rdataset_putadditional (dns_acache_t *acache, dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_rdatatype_t qtype)
static isc_boolean_t need_headerupdate (rdatasetheader_t *header, isc_stdtime_t now)
 Routines for LRU-based cache management.
static void update_header (dns_rbtdb_t *rbtdb, rdatasetheader_t *header, isc_stdtime_t now)
 Update the timestamp of a given cache entry and move it to the head of the corresponding LRU list.
static void expire_header (dns_rbtdb_t *rbtdb, rdatasetheader_t *header, isc_boolean_t tree_locked, expire_t reason)
static void overmem_purge (dns_rbtdb_t *rbtdb, unsigned int locknum_start, isc_stdtime_t now, isc_boolean_t tree_locked)
 Purge some expired and/or stale (i.e. unused for some period) cache entries under an overmem condition. To recover from this condition quickly, up to 2 entries will be purged. This process is triggered while adding a new entry, and we specifically avoid purging entries in the same LRU bucket as the one to which the new entry will belong. Otherwise, we might purge entries of the same name of different RR types while adding RRsets from a single response (consider the case where we're adding A and AAAA glue records of the same NS name).
static isc_result_t resign_insert (dns_rbtdb_t *rbtdb, int idx, rdatasetheader_t *newheader)
static void resign_delete (dns_rbtdb_t *rbtdb, rbtdb_version_t *version, rdatasetheader_t *header)
static void prune_tree (isc_task_t *task, isc_event_t *event)
static void rdataset_settrust (dns_rdataset_t *rdataset, dns_trust_t trust)
static void rdataset_expire (dns_rdataset_t *rdataset)
static void rdataset_clearprefetch (dns_rdataset_t *rdataset)
static void rdataset_setownercase (dns_rdataset_t *rdataset, const dns_name_t *name)
static void rdataset_getownercase (const dns_rdataset_t *rdataset, dns_name_t *name)
static void rdatasetiter_destroy (dns_rdatasetiter_t **iteratorp)
static isc_result_t rdatasetiter_first (dns_rdatasetiter_t *iterator)
static isc_result_t rdatasetiter_next (dns_rdatasetiter_t *iterator)
static void rdatasetiter_current (dns_rdatasetiter_t *iterator, dns_rdataset_t *rdataset)
static void dbiterator_destroy (dns_dbiterator_t **iteratorp)
static isc_result_t dbiterator_first (dns_dbiterator_t *iterator)
static isc_result_t dbiterator_last (dns_dbiterator_t *iterator)
static isc_result_t dbiterator_seek (dns_dbiterator_t *iterator, dns_name_t *name)
static isc_result_t dbiterator_prev (dns_dbiterator_t *iterator)
static isc_result_t dbiterator_next (dns_dbiterator_t *iterator)
static isc_result_t dbiterator_current (dns_dbiterator_t *iterator, dns_dbnode_t **nodep, dns_name_t *name)
static isc_result_t dbiterator_pause (dns_dbiterator_t *iterator)
static isc_result_t dbiterator_origin (dns_dbiterator_t *iterator, dns_name_t *name)
static void free_rbtdb (dns_rbtdb_t *rbtdb, isc_boolean_t log, isc_event_t *event)
static void overmem (dns_db_t *db, isc_boolean_t over)
static void setnsec3parameters (dns_db_t *db, rbtdb_version_t *version)
static void setownercase (rdatasetheader_t *header, const dns_name_t *name)
static void attach (dns_db_t *source, dns_db_t **targetp)
static void free_rbtdb_callback (isc_task_t *task, isc_event_t *event)
static void update_cachestats (dns_rbtdb_t *rbtdb, isc_result_t result)
static void update_rrsetstats (dns_rbtdb_t *rbtdb, rdatasetheader_t *header, isc_boolean_t increment)
static void set_ttl (dns_rbtdb_t *rbtdb, rdatasetheader_t *header, dns_ttl_t newttl)
static isc_boolean_t ttl_sooner (void *v1, void *v2)
 These functions allow the heap code to rank the priority of each element. It returns ISC_TRUE if v1 happens "sooner" than v2.
static isc_boolean_t resign_sooner (void *v1, void *v2)
static void set_index (void *what, unsigned int idx)
 This function sets the heap index into the header.
static unsigned int adjust_quantum (unsigned int old, isc_time_t *start)
 Work out how many nodes can be deleted in the time between two requests to the nameserver. Smooth the resulting number and use it as a estimate for the number of nodes to be deleted in the next iteration.
static void maybe_free_rbtdb (dns_rbtdb_t *rbtdb)
static void detach (dns_db_t **dbp)
static void currentversion (dns_db_t *db, dns_dbversion_t **versionp)
static rbtdb_version_tallocate_version (isc_mem_t *mctx, rbtdb_serial_t serial, unsigned int references, isc_boolean_t writer)
static isc_result_t newversion (dns_db_t *db, dns_dbversion_t **versionp)
static void attachversion (dns_db_t *db, dns_dbversion_t *source, dns_dbversion_t **targetp)
static rbtdb_changed_tadd_changed (dns_rbtdb_t *rbtdb, rbtdb_version_t *version, dns_rbtnode_t *node)
static void free_acachearray (isc_mem_t *mctx, rdatasetheader_t *header, acachectl_t *array)
static void free_noqname (isc_mem_t *mctx, struct noqname **noqname)
static void init_rdataset (dns_rbtdb_t *rbtdb, rdatasetheader_t *h)
static void update_newheader (rdatasetheader_t *new, rdatasetheader_t *old)
static rdatasetheader_tnew_rdataset (dns_rbtdb_t *rbtdb, isc_mem_t *mctx)
static void free_rdataset (dns_rbtdb_t *rbtdb, isc_mem_t *mctx, rdatasetheader_t *rdataset)
static void rollback_node (dns_rbtnode_t *node, rbtdb_serial_t serial)
static void mark_stale_header (dns_rbtdb_t *rbtdb, rdatasetheader_t *header)
static void clean_stale_headers (dns_rbtdb_t *rbtdb, isc_mem_t *mctx, rdatasetheader_t *top)
static void clean_cache_node (dns_rbtdb_t *rbtdb, dns_rbtnode_t *node)
static void clean_zone_node (dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rbtdb_serial_t least_serial)
static void delete_node (dns_rbtdb_t *rbtdb, dns_rbtnode_t *node)
static void cleanup_dead_nodes (dns_rbtdb_t *rbtdb, int bucketnum)
 Clean up dead nodes. These are nodes which have no references, and have no data. They are dead but we could not or chose not to delete them when we deleted all the data at that node because we did not want to wait for the tree write lock.
static void new_reference (dns_rbtdb_t *rbtdb, dns_rbtnode_t *node)
static void reactivate_node (dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, isc_rwlocktype_t treelocktype)
static isc_boolean_t decrement_reference (dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rbtdb_serial_t least_serial, isc_rwlocktype_t nlock, isc_rwlocktype_t tlock, isc_boolean_t pruning)
static void make_least_version (dns_rbtdb_t *rbtdb, rbtdb_version_t *version, rbtdb_changedlist_t *cleanup_list)
static void cleanup_nondirty (rbtdb_version_t *version, rbtdb_changedlist_t *cleanup_list)
static void iszonesecure (dns_db_t *db, rbtdb_version_t *version, dns_dbnode_t *origin)
 Walk the origin node looking for NSEC3PARAM records. Cache the nsec3 parameters.
static void cleanup_dead_nodes_callback (isc_task_t *task, isc_event_t *event)
static void closeversion (dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit)
static isc_result_t add_wildcard_magic (dns_rbtdb_t *rbtdb, dns_name_t *name)
static isc_result_t add_empty_wildcards (dns_rbtdb_t *rbtdb, dns_name_t *name)
static isc_result_t findnodeintree (dns_rbtdb_t *rbtdb, dns_rbt_t *tree, dns_name_t *name, isc_boolean_t create, dns_dbnode_t **nodep)
static isc_result_t findnode (dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_dbnode_t **nodep)
static isc_result_t findnsec3node (dns_db_t *db, dns_name_t *name, isc_boolean_t create, dns_dbnode_t **nodep)
static isc_result_t zone_zonecut_callback (dns_rbtnode_t *node, dns_name_t *name, void *arg)
static void bind_rdataset (dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rdatasetheader_t *header, isc_stdtime_t now, dns_rdataset_t *rdataset)
static isc_result_t setup_delegation (rbtdb_search_t *search, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_boolean_t valid_glue (rbtdb_search_t *search, dns_name_t *name, rbtdb_rdatatype_t type, dns_rbtnode_t *node)
static isc_boolean_t activeempty (rbtdb_search_t *search, dns_rbtnodechain_t *chain, dns_name_t *name)
static isc_boolean_t activeemtpynode (rbtdb_search_t *search, dns_name_t *qname, dns_name_t *wname)
static isc_result_t find_wildcard (rbtdb_search_t *search, dns_rbtnode_t **nodep, dns_name_t *qname)
static isc_boolean_t matchparams (rdatasetheader_t *header, rbtdb_search_t *search)
static isc_result_t previous_closest_nsec (dns_rdatatype_t type, rbtdb_search_t *search, dns_name_t *name, dns_name_t *origin, dns_rbtnode_t **nodep, dns_rbtnodechain_t *nsecchain, isc_boolean_t *firstp)
static isc_result_t find_closest_nsec (rbtdb_search_t *search, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_rbt_t *tree, dns_db_secure_t secure)
static isc_result_t zone_find (dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, dns_rdatatype_t type, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t zone_findzonecut (dns_db_t *db, dns_name_t *name, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t cache_zonecut_callback (dns_rbtnode_t *node, dns_name_t *name, void *arg)
static isc_result_t find_deepest_zonecut (rbtdb_search_t *search, dns_rbtnode_t *node, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t find_coveringnsec (rbtdb_search_t *search, dns_dbnode_t **nodep, isc_stdtime_t now, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static void rpz_attach (dns_db_t *db, dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num)
static isc_result_t rpz_ready (dns_db_t *db)
static isc_result_t cache_find (dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, dns_rdatatype_t type, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t cache_findzonecut (dns_db_t *db, dns_name_t *name, unsigned int options, isc_stdtime_t now, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static void attachnode (dns_db_t *db, dns_dbnode_t *source, dns_dbnode_t **targetp)
static void detachnode (dns_db_t *db, dns_dbnode_t **targetp)
static isc_result_t expirenode (dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now)
static void printnode (dns_db_t *db, dns_dbnode_t *node, FILE *out)
static isc_result_t createiterator (dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp)
static isc_result_t zone_findrdataset (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers, isc_stdtime_t now, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t cache_findrdataset (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers, isc_stdtime_t now, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t allrdatasets (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_stdtime_t now, dns_rdatasetiter_t **iteratorp)
static isc_boolean_t cname_and_other_data (dns_rbtnode_t *node, rbtdb_serial_t serial)
static isc_result_t add32 (dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, rdatasetheader_t *newheader, unsigned int options, isc_boolean_t loading, dns_rdataset_t *addedrdataset, isc_stdtime_t now)
static isc_boolean_t delegating_type (dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rbtdb_rdatatype_t type)
static isc_result_t addnoqname (dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader, dns_rdataset_t *rdataset)
static isc_result_t addclosest (dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader, dns_rdataset_t *rdataset)
static isc_result_t addrdataset (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_stdtime_t now, dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *addedrdataset)
static isc_result_t subtractrdataset (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdataset_t *rdataset, unsigned int options, dns_rdataset_t *newrdataset)
static isc_result_t deleterdataset (dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers)
static isc_result_t loadnode (dns_rbtdb_t *rbtdb, dns_name_t *name, dns_rbtnode_t **nodep, isc_boolean_t hasnsec)
static isc_result_t loading_addrdataset (void *arg, dns_name_t *name, dns_rdataset_t *rdataset)
static isc_result_t rbt_datafixer (dns_rbtnode_t *rbtnode, void *base, size_t filesize, void *arg, isc_uint64_t *crc)
static isc_result_t deserialize32 (void *arg, FILE *f, off_t offset)
static isc_result_t beginload (dns_db_t *db, dns_rdatacallbacks_t *callbacks)
static isc_result_t endload (dns_db_t *db, dns_rdatacallbacks_t *callbacks)
static isc_result_t rbt_datawriter (FILE *rbtfile, unsigned char *data, void *arg, isc_uint64_t *crc)
static isc_result_t rbtdb_zero_header (FILE *rbtfile)
static void init_file_version (void)
static isc_result_t rbtdb_write_header (FILE *rbtfile, off_t tree_location, off_t nsec_location, off_t nsec3_location)
static isc_result_t serialize (dns_db_t *db, dns_dbversion_t *ver, FILE *rbtfile)
static isc_result_t dump (dns_db_t *db, dns_dbversion_t *version, const char *filename, dns_masterformat_t masterformat)
static isc_boolean_t issecure (dns_db_t *db)
static isc_boolean_t isdnssec (dns_db_t *db)
static unsigned int nodecount (dns_db_t *db)
static unsigned int hashsize (dns_db_t *db)
static void settask (dns_db_t *db, isc_task_t *task)
static isc_boolean_t ispersistent (dns_db_t *db)
static isc_result_t getoriginnode (dns_db_t *db, dns_dbnode_t **nodep)
static isc_result_t getnsec3parameters (dns_db_t *db, dns_dbversion_t *version, dns_hash_t *hash, isc_uint8_t *flags, isc_uint16_t *iterations, unsigned char *salt, size_t *salt_length)
static isc_result_t setsigningtime (dns_db_t *db, dns_rdataset_t *rdataset, isc_stdtime_t resign)
static isc_result_t getsigningtime (dns_db_t *db, dns_rdataset_t *rdataset, dns_name_t *foundname)
static void resigned (dns_db_t *db, dns_rdataset_t *rdataset, dns_dbversion_t *version)
static isc_result_t setcachestats (dns_db_t *db, isc_stats_t *stats)
static dns_stats_tgetrrsetstats (dns_db_t *db)
isc_result_t dns_rbtdb_create (isc_mem_t *mctx, dns_name_t *origin, dns_dbtype_t type, dns_rdataclass_t rdclass, unsigned int argc, char *argv[], void *driverarg, dns_db_t **dbp)
 Create a new database of type "rbt" (or "rbt64"). Called via dns_db_create(); see documentation for that function for more details.
static void reference_iter_node (rbtdb_dbiterator_t *rbtdbiter)
static void dereference_iter_node (rbtdb_dbiterator_t *rbtdbiter)
static void flush_deletions (rbtdb_dbiterator_t *rbtdbiter)
static void resume_iteration (rbtdb_dbiterator_t *rbtdbiter)
static void acache_callback (dns_acacheentry_t *entry, void **arg)
static void acache_cancelentry (isc_mem_t *mctx, dns_acacheentry_t *entry, acache_cbarg_t **cbargp)

Variables

 acache_cbarg_t
 dns_db_secure_t
static dns_rdatasetmethods_t rdataset_methods
static dns_rdatasetmethods_t slab_methods
static dns_rdatasetitermethods_t rdatasetiter_methods
static dns_dbiteratormethods_t dbiterator_methods
static char FILE_VERSION [32] = "\0"
static unsigned int init_count
 'init_count' is used to initialize 'newheader->count' which inturn is used to determine where in the cycle rrset-order cyclic starts. We don't lock this as we don't care about simultaneous updates.
static dns_dbmethods_t zone_methods
static isc_once_t once = ISC_ONCE_INIT
static dns_dbmethods_t cache_methods


Detailed Description

Definition in file rbtdb.c.


Define Documentation

#define RBTDB_MAGIC   ISC_MAGIC('R', 'B', 'D', '4')

Definition at line 96 of file rbtdb.c.

Referenced by dns_rbtdb_create().

#define CHECK ( op   ) 

Value:

do { result = (op); \
                if (result != ISC_R_SUCCESS) goto failure; \
        } while (0)

Definition at line 99 of file rbtdb.c.

#define RBTDB_HEADER_LENGTH   1024

Definition at line 113 of file rbtdb.c.

Referenced by rbtdb_zero_header().

#define VALID_RBTDB ( rbtdb   ) 

Value:

((rbtdb) != NULL && \
                                 (rbtdb)->common.impmagic == RBTDB_MAGIC)
Note that "impmagic" is not the first four bytes of the struct, so ISC_MAGIC_VALID cannot be used.

Definition at line 131 of file rbtdb.c.

Referenced by addrdataset(), allrdatasets(), attach(), attachnode(), attachversion(), beginload(), cache_find(), cache_findrdataset(), cache_findzonecut(), closeversion(), createiterator(), currentversion(), deleterdataset(), deserialize32(), detach(), detachnode(), dump(), endload(), expirenode(), findnode(), findnsec3node(), getnsec3parameters(), getoriginnode(), getrrsetstats(), getsigningtime(), hashsize(), isdnssec(), issecure(), newversion(), nodecount(), printnode(), resigned(), rpz_attach(), rpz_ready(), serialize(), setcachestats(), setsigningtime(), settask(), subtractrdataset(), zone_find(), and zone_findrdataset().

#define RBTDB_RDATATYPE_BASE ( type   )     ((dns_rdatatype_t)((type) & 0xFFFF))

Definition at line 285 of file rbtdb.c.

Referenced by add32(), bind_rdataset(), cache_find(), cname_and_other_data(), find_coveringnsec(), rdatasetiter_next(), and update_rrsetstats().

#define RBTDB_RDATATYPE_EXT ( type   )     ((dns_rdatatype_t)((type) >> 16))

Definition at line 286 of file rbtdb.c.

Referenced by add32(), bind_rdataset(), rdatasetiter_next(), and update_rrsetstats().

#define RBTDB_RDATATYPE_VALUE ( b,
 )     ((rbtdb_rdatatype_t)((e) << 16) | (b))

Definition at line 287 of file rbtdb.c.

Referenced by add32(), addrdataset(), cache_find(), cache_findrdataset(), deleterdataset(), find_coveringnsec(), loading_addrdataset(), rdatasetiter_next(), subtractrdataset(), zone_find(), and zone_findrdataset().

#define RBTDB_RDATATYPE_SIGNSEC   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec)

Definition at line 289 of file rbtdb.c.

Referenced by find_closest_nsec(), and zone_find().

#define RBTDB_RDATATYPE_SIGNSEC3   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec3)

Definition at line 291 of file rbtdb.c.

Referenced by find_closest_nsec().

#define RBTDB_RDATATYPE_SIGNS   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ns)

Definition at line 293 of file rbtdb.c.

Referenced by cache_find(), cache_findzonecut(), and find_deepest_zonecut().

#define RBTDB_RDATATYPE_SIGCNAME   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_cname)

Definition at line 295 of file rbtdb.c.

Referenced by cache_find(), and zone_find().

#define RBTDB_RDATATYPE_SIGDNAME   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_dname)

Definition at line 297 of file rbtdb.c.

Referenced by cache_zonecut_callback(), and zone_zonecut_callback().

#define RBTDB_RDATATYPE_SIGDDS   RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ds)

Definition at line 299 of file rbtdb.c.

Referenced by add32().

#define RBTDB_RDATATYPE_NCACHEANY   RBTDB_RDATATYPE_VALUE(0, dns_rdatatype_any)

Definition at line 301 of file rbtdb.c.

Referenced by add32(), cache_find(), and cache_findrdataset().

#define DNS_RBTDB_USERWLOCK   0

Definition at line 315 of file rbtdb.c.

#define RBTDB_INITLOCK (  )     isc_mutex_init(l)

Definition at line 324 of file rbtdb.c.

Referenced by dns_rbtdb_create().

#define RBTDB_DESTROYLOCK (  )     DESTROYLOCK(l)

Definition at line 325 of file rbtdb.c.

Referenced by dns_rbtdb_create(), and free_rbtdb().

#define RBTDB_LOCK ( l,
 )     LOCK(l)

Definition at line 326 of file rbtdb.c.

Referenced by add_changed(), beginload(), closeversion(), currentversion(), decrement_reference(), detachnode(), endload(), maybe_free_rbtdb(), newversion(), and settask().

#define RBTDB_UNLOCK ( l,
 )     UNLOCK(l)

Definition at line 327 of file rbtdb.c.

Referenced by add_changed(), beginload(), closeversion(), currentversion(), decrement_reference(), detachnode(), endload(), maybe_free_rbtdb(), newversion(), and settask().

#define NODE_INITLOCK (  )     isc_mutex_init(l)

Definition at line 366 of file rbtdb.c.

Referenced by dns_rbtdb_create().

#define NODE_DESTROYLOCK (  )     DESTROYLOCK(l)

Definition at line 367 of file rbtdb.c.

Referenced by dns_rbtdb_create(), and free_rbtdb().

#define NODE_LOCK ( l,
 )     LOCK(l)

Definition at line 368 of file rbtdb.c.

Referenced by acache_callback(), activeempty(), activeemtpynode(), addrdataset(), cache_find(), cache_findrdataset(), cache_findzonecut(), cache_zonecut_callback(), cleanup_dead_nodes_callback(), closeversion(), delete_callback(), deleterdataset(), dereference_iter_node(), detachnode(), expirenode(), find_closest_nsec(), find_coveringnsec(), find_deepest_zonecut(), find_wildcard(), flush_deletions(), getsigningtime(), maybe_free_rbtdb(), overmem_purge(), printnode(), prune_tree(), rdataset_clearprefetch(), rdataset_expire(), rdataset_getadditional(), rdataset_putadditional(), rdataset_setadditional(), rdataset_settrust(), rdatasetiter_current(), rdatasetiter_first(), rdatasetiter_next(), resigned(), setnsec3parameters(), setsigningtime(), setup_delegation(), subtractrdataset(), zone_find(), zone_findrdataset(), and zone_zonecut_callback().

#define NODE_UNLOCK ( l,
 )     UNLOCK(l)

Definition at line 369 of file rbtdb.c.

Referenced by acache_callback(), activeempty(), activeemtpynode(), addrdataset(), cache_find(), cache_findrdataset(), cache_findzonecut(), cache_zonecut_callback(), cleanup_dead_nodes_callback(), closeversion(), delete_callback(), deleterdataset(), dereference_iter_node(), detachnode(), expirenode(), find_closest_nsec(), find_coveringnsec(), find_deepest_zonecut(), find_wildcard(), flush_deletions(), getsigningtime(), maybe_free_rbtdb(), overmem_purge(), printnode(), prune_tree(), rdataset_clearprefetch(), rdataset_expire(), rdataset_getadditional(), rdataset_putadditional(), rdataset_setadditional(), rdataset_settrust(), rdatasetiter_current(), rdatasetiter_first(), rdatasetiter_next(), resigned(), setnsec3parameters(), setsigningtime(), setup_delegation(), subtractrdataset(), zone_find(), zone_findrdataset(), and zone_zonecut_callback().

#define NODE_TRYUPGRADE (  )     ISC_R_SUCCESS

Definition at line 370 of file rbtdb.c.

Referenced by cache_find(), cache_findrdataset(), cache_findzonecut(), cache_zonecut_callback(), find_coveringnsec(), and find_deepest_zonecut().

#define NODE_STRONGLOCK (  )     LOCK(l)

Definition at line 372 of file rbtdb.c.

Referenced by allrdatasets(), attachnode(), dbiterator_current(), getoriginnode(), and reactivate_node().

#define NODE_STRONGUNLOCK (  )     UNLOCK(l)

Definition at line 373 of file rbtdb.c.

Referenced by allrdatasets(), attachnode(), dbiterator_current(), getoriginnode(), and reactivate_node().

#define NODE_WEAKLOCK ( l,
 )     ((void)0)

Definition at line 374 of file rbtdb.c.

Referenced by decrement_reference(), and reactivate_node().

#define NODE_WEAKUNLOCK ( l,
 )     ((void)0)

Definition at line 375 of file rbtdb.c.

Referenced by decrement_reference(), and reactivate_node().

#define NODE_WEAKDOWNGRADE (  )     ((void)0)

Definition at line 376 of file rbtdb.c.

Referenced by decrement_reference().

#define DNS_RBTDB_LIMITLRUUPDATE   0

Whether to rate-limit updating the LRU to avoid possible thread contention. Our performance measurement has shown the cost is marginal, so it's defined to be 0 by default either with or without threads.

Definition at line 385 of file rbtdb.c.

#define RBTDB_VIRTUAL   300

Definition at line 392 of file rbtdb.c.

Referenced by addrdataset(), cache_find(), cache_findrdataset(), cache_findzonecut(), cache_zonecut_callback(), expirenode(), find_coveringnsec(), find_deepest_zonecut(), and overmem_purge().

#define RDATASET_ATTR_NONEXISTENT   0x0001

Referenced by clean_cache_node(), deleterdataset(), free_rdataset(), need_headerupdate(), rdatasetiter_next(), and subtractrdataset().

#define RDATASET_ATTR_STALE   0x0002

Referenced by clean_cache_node(), mark_stale_header(), and need_headerupdate().

#define RDATASET_ATTR_IGNORE   0x0004

Referenced by rollback_node().

#define RDATASET_ATTR_RETAIN   0x0008

#define RDATASET_ATTR_NXDOMAIN   0x0010

#define RDATASET_ATTR_RESIGN   0x0020

Referenced by addrdataset(), loading_addrdataset(), setsigningtime(), and subtractrdataset().

#define RDATASET_ATTR_STATCOUNT   0x0040

Referenced by addrdataset(), free_rdataset(), and mark_stale_header().

#define RDATASET_ATTR_OPTOUT   0x0080

Referenced by addrdataset().

#define RDATASET_ATTR_NEGATIVE   0x0100

#define RDATASET_ATTR_PREFETCH   0x0200

Referenced by addrdataset(), and rdataset_clearprefetch().

#define RDATASET_ATTR_CASESET   0x0400

Referenced by setownercase(), and update_newheader().

#define EXISTS ( header   )     (((header)->attributes & RDATASET_ATTR_NONEXISTENT) == 0)

Definition at line 503 of file rbtdb.c.

Referenced by activeempty(), activeemtpynode(), add32(), cache_find(), cache_findrdataset(), cache_findzonecut(), cache_zonecut_callback(), find_deepest_zonecut(), find_wildcard(), free_rdataset(), mark_stale_header(), and subtractrdataset().

#define NONEXISTENT ( header   )     (((header)->attributes & RDATASET_ATTR_NONEXISTENT) != 0)

Definition at line 505 of file rbtdb.c.

Referenced by add32(), clean_zone_node(), cname_and_other_data(), find_closest_nsec(), find_coveringnsec(), rbt_datawriter(), rdatasetiter_first(), setnsec3parameters(), zone_find(), zone_findrdataset(), and zone_zonecut_callback().

#define IGNORE ( header   )     (((header)->attributes & RDATASET_ATTR_IGNORE) != 0)

Definition at line 507 of file rbtdb.c.

Referenced by activeempty(), activeemtpynode(), add32(), clean_zone_node(), closeversion(), cname_and_other_data(), find_closest_nsec(), find_wildcard(), rbt_datawriter(), rdatasetiter_first(), rdatasetiter_next(), setnsec3parameters(), subtractrdataset(), zone_find(), zone_findrdataset(), and zone_zonecut_callback().

#define RETAIN ( header   )     (((header)->attributes & RDATASET_ATTR_RETAIN) != 0)

Definition at line 509 of file rbtdb.c.

Referenced by expirenode().

#define NXDOMAIN ( header   )     (((header)->attributes & RDATASET_ATTR_NXDOMAIN) != 0)

Definition at line 511 of file rbtdb.c.

#define RESIGN ( header   )     (((header)->attributes & RDATASET_ATTR_RESIGN) != 0)

Definition at line 513 of file rbtdb.c.

Referenced by add32(), bind_rdataset(), rbt_datafixer(), and setsigningtime().

#define OPTOUT ( header   )     (((header)->attributes & RDATASET_ATTR_OPTOUT) != 0)

Definition at line 515 of file rbtdb.c.

#define NEGATIVE ( header   )     (((header)->attributes & RDATASET_ATTR_NEGATIVE) != 0)

Definition at line 517 of file rbtdb.c.

#define PREFETCH ( header   )     (((header)->attributes & RDATASET_ATTR_PREFETCH) != 0)

Definition at line 519 of file rbtdb.c.

Referenced by bind_rdataset().

#define CASESET ( header   )     (((header)->attributes & RDATASET_ATTR_CASESET) != 0)

Definition at line 521 of file rbtdb.c.

Referenced by rdataset_getownercase(), and update_newheader().

#define DEFAULT_NODE_LOCK_COUNT   7

Should be prime.

Definition at line 524 of file rbtdb.c.

Referenced by dns_rbtdb_create().

#define DEFAULT_CACHE_NODE_LOCK_COUNT   16

Number of buckets for cache DB entries (locks, LRU lists, TTL heaps). There is a tradeoff issue about configuring this value: if this is too small, it may cause heavier contention between threads; if this is too large, LRU purge algorithm won't work well (entries tend to be purged prematurely). The default value should work well for most environments, but this can also be configurable at compilation time via the DNS_RBTDB_CACHE_NODE_LOCK_COUNT variable. This value must be larger than 1 due to the assumption of overmem_purge().

Definition at line 543 of file rbtdb.c.

Referenced by dns_rbtdb_create().

#define RBTDB_ATTR_LOADED   0x01

Definition at line 676 of file rbtdb.c.

Referenced by beginload(), and endload().

#define RBTDB_ATTR_LOADING   0x02

Definition at line 677 of file rbtdb.c.

Referenced by beginload(), and endload().

#define DELETION_BATCH_MAX   64

Definition at line 852 of file rbtdb.c.

Referenced by dbiterator_current().

#define IS_STUB ( rbtdb   )     (((rbtdb)->common.attributes & DNS_DBATTR_STUB) != 0)

Definition at line 876 of file rbtdb.c.

Referenced by delegating_type(), zone_find(), and zone_zonecut_callback().

#define IS_CACHE ( rbtdb   )     (((rbtdb)->common.attributes & DNS_DBATTR_CACHE) != 0)

Definition at line 877 of file rbtdb.c.

Referenced by add32(), addrdataset(), beginload(), closeversion(), decrement_reference(), delegating_type(), deleterdataset(), dns_rbtdb_create(), endload(), free_rbtdb(), free_rdataset(), getoriginnode(), getrrsetstats(), init_rdataset(), loading_addrdataset(), new_rdataset(), rdatasetiter_first(), rdatasetiter_next(), resign_insert(), set_ttl(), setcachestats(), setsigningtime(), subtractrdataset(), update_cachestats(), update_header(), update_rrsetstats(), and zone_zonecut_callback().

#define KEEP_NODE ( n,
r   )     ((n)->data != NULL || (n)->down != NULL || (n) == (r)->origin_node)

Referenced by decrement_reference().


Typedef Documentation

typedef struct rbtdb_file_header rbtdb_file_header_t

Definition at line 110 of file rbtdb.c.

typedef isc_uint32_t rbtdb_serial_t

Definition at line 280 of file rbtdb.c.

typedef isc_uint32_t rbtdb_rdatatype_t

Definition at line 283 of file rbtdb.c.

typedef isc_mutex_t nodelock_t

Definition at line 364 of file rbtdb.c.

typedef struct acachectl acachectl_t

Definition at line 401 of file rbtdb.c.

typedef struct rdatasetheader rdatasetheader_t

typedef struct rbtdb_changed rbtdb_changed_t

typedef struct dns_rbtdb dns_rbtdb_t

Definition at line 568 of file rbtdb.c.

typedef struct rbtdb_version rbtdb_version_t

typedef struct rbtdb_rdatasetiter rbtdb_rdatasetiter_t

typedef struct rbtdb_dbiterator rbtdb_dbiterator_t


Enumeration Type Documentation

enum expire_t

Enumerator:
expire_lru 
expire_ttl 
expire_flush 

Definition at line 571 of file rbtdb.c.


Function Documentation

typedef ISC_LIST ( rdatasetheader_t   ) 

Definition at line 465 of file rbtdb.c.

References rdatasetheader::count, rdatasetheader::node, and rdatasetheader::type.

typedef ISC_LIST ( rbtdb_changed_t   ) 

Definition at line 560 of file rbtdb.c.

typedef ISC_LIST ( rbtdb_version_t   ) 

Temporary storage for stale cache nodes and dynamically deleted nodes that await being cleaned up.

Definition at line 603 of file rbtdb.c.

References rdatasetheader::attributes, and references.

static void delete_callback ( void *  data,
void *  arg 
) [static]

Definition at line 7769 of file rbtdb.c.

References free_rdataset(), isc_rwlocktype_write, dns_rbtnode::locknum, rdatasetheader::next, rdatasetheader::node, NODE_LOCK, and NODE_UNLOCK.

Referenced by deserialize32(), and dns_rbtdb_create().

static void rdataset_disassociate ( dns_rdataset_t rdataset  )  [static]

Definition at line 8527 of file rbtdb.c.

References detachnode(), rdatasetheader::node, dns_rdataset::private1, and dns_rdataset::private2.

static isc_result_t rdataset_first ( dns_rdataset_t rdataset  )  [static]

Definition at line 8535 of file rbtdb.c.

References dns_rdataset::attributes, rdatasetheader::count, DNS_RDATASETATTR_LOADORDER, ISC_R_NOMORE, ISC_R_SUCCESS, dns_rdataset::private3, dns_rdataset::private5, and dns_rdataset::privateuint4.

static isc_result_t rdataset_next ( dns_rdataset_t rdataset  )  [static]

Definition at line 8569 of file rbtdb.c.

References dns_rdataset::attributes, rdatasetheader::count, DNS_RDATASETATTR_LOADORDER, ISC_R_NOMORE, ISC_R_SUCCESS, dns_rdataset::private5, and dns_rdataset::privateuint4.

static void rdataset_current ( dns_rdataset_t rdataset,
dns_rdata_t rdata 
) [static]

Definition at line 8600 of file rbtdb.c.

References dns_rdataset::attributes, isc_region::base, dns_rdata_fromregion(), DNS_RDATA_OFFLINE, DNS_RDATASETATTR_LOADORDER, DNS_RDATASLAB_OFFLINE, dns_rdata::flags, isc_region::length, dns_rdataset::private3, dns_rdataset::private5, r, dns_rdataset::rdclass, REQUIRE, and dns_rdataset::type.

static void rdataset_clone ( dns_rdataset_t source,
dns_rdataset_t target 
) [static]

Definition at line 8642 of file rbtdb.c.

References attachnode(), INSIST, ISC_LINK_INIT, ISC_LINK_LINKED, rdatasetheader::node, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private5, and dns_rdataset::privateuint4.

static unsigned int rdataset_count ( dns_rdataset_t rdataset  )  [static]

Definition at line 8660 of file rbtdb.c.

References rdatasetheader::count, and dns_rdataset::private3.

static isc_result_t rdataset_getnoqname ( dns_rdataset_t rdataset,
dns_name_t name,
dns_rdataset_t neg,
dns_rdataset_t negsig 
) [static]

Definition at line 8670 of file rbtdb.c.

References attachnode(), dns_rdataset::covers, dns_name_clone(), ISC_R_SUCCESS, dns_rdataset::methods, noqname::name, noqname::neg, noqname::negsig, rdatasetheader::node, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::private5, dns_rdataset::private6, dns_rdataset::private7, dns_rdataset::privateuint4, dns_db::rdclass, dns_rdataset::rdclass, slab_methods, dns_rdataset::trust, dns_rdataset::ttl, noqname::type, and dns_rdataset::type.

static isc_result_t rdataset_getclosest ( dns_rdataset_t rdataset,
dns_name_t name,
dns_rdataset_t neg,
dns_rdataset_t negsig 
) [static]

Definition at line 8716 of file rbtdb.c.

References attachnode(), rdatasetheader::closest, dns_rdataset::covers, dns_name_clone(), ISC_R_SUCCESS, dns_rdataset::methods, noqname::name, noqname::neg, noqname::negsig, rdatasetheader::node, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::private5, dns_rdataset::private6, dns_rdataset::private7, dns_rdataset::privateuint4, dns_db::rdclass, dns_rdataset::rdclass, slab_methods, dns_rdataset::trust, dns_rdataset::ttl, noqname::type, and dns_rdataset::type.

static isc_result_t rdataset_getadditional ( dns_rdataset_t rdataset,
dns_rdatasetadditional_t  type,
dns_rdatatype_t  qtype,
dns_acache_t acache,
dns_zone_t **  zonep,
dns_db_t **  dbp,
dns_dbversion_t **  versionp,
dns_dbnode_t **  nodep,
dns_name_t fname,
dns_message_t msg,
isc_stdtime_t  now 
) [static]

Additional cache routines.

Definition at line 9490 of file rbtdb.c.

References rdatasetheader::additional_auth, rdatasetheader::additional_glue, rdatasetheader::count, dns_acache_attachentry(), dns_acache_countquerymiss(), dns_acache_detachentry(), dns_acache_getentry(), dns_rdatasetadditional_fromauth, dns_rdatasetadditional_fromcache, dns_rdatasetadditional_fromglue, header, INSIST, ISC_R_NOTFOUND, isc_rwlocktype_read, dns_rbtnode::locknum, NODE_LOCK, NODE_UNLOCK, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::privateuint4, and UNUSED.

static isc_result_t rdataset_setadditional ( dns_rdataset_t rdataset,
dns_rdatasetadditional_t  type,
dns_rdatatype_t  qtype,
dns_acache_t acache,
dns_zone_t zone,
dns_db_t db,
dns_dbversion_t version,
dns_dbnode_t node,
dns_name_t fname 
) [static]

Definition at line 9636 of file rbtdb.c.

References acache_callback(), acache_cancelentry(), acache_cbarg_t, rdatasetheader::additional_auth, rdatasetheader::additional_glue, acachectl::cbarg, rdatasetheader::count, dns_acache_createentry(), dns_acache_detachentry(), dns_acache_setentry(), dns_db_attach(), dns_db_attachnode(), dns_db_detach(), dns_db_detachnode(), dns_rdatasetadditional_fromauth, dns_rdatasetadditional_fromcache, dns_rdatasetadditional_fromglue, acachectl::entry, header, INSIST, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlocktype_write, dns_db::mctx, NODE_LOCK, NODE_UNLOCK, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::privateuint4, and UNUSED.

static isc_result_t rdataset_putadditional ( dns_acache_t acache,
dns_rdataset_t rdataset,
dns_rdatasetadditional_t  type,
dns_rdatatype_t  qtype 
) [static]

Definition at line 9769 of file rbtdb.c.

References acache_cancelentry(), acache_cbarg_t, rdatasetheader::additional_auth, rdatasetheader::additional_glue, acachectl::cbarg, rdatasetheader::count, dns_acache_detachentry(), dns_rdatasetadditional_fromauth, dns_rdatasetadditional_fromcache, dns_rdatasetadditional_fromglue, acachectl::entry, header, INSIST, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_write, dns_rbtnode::locknum, NODE_LOCK, NODE_UNLOCK, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::privateuint4, and UNUSED.

static isc_boolean_t need_headerupdate ( rdatasetheader_t header,
isc_stdtime_t  now 
) [inline, static]

Routines for LRU-based cache management.

See if a given cache entry that is being reused needs to be updated in the LRU-list. From the LRU management point of view, this function is expected to return true for almost all cases. When used with threads, however, this may cause a non-negligible performance penalty because a writer lock will have to be acquired before updating the list. If DNS_RBTDB_LIMITLRUUPDATE is defined to be non 0 at compilation time, this function returns true if the entry has not been updated for some period of time. We differentiate the NS or glue address case and the others since experiments have shown that the former tends to be accessed relatively infrequently and the cost of cache miss is higher (e.g., a missing NS records may cause external queries at a higher level zone, involving more transactions).

Caller must hold the node (read or write) lock.

Definition at line 9907 of file rbtdb.c.

References rdatasetheader::attributes, dns_trust_glue, ISC_FALSE, ISC_TRUE, rdatasetheader::last_used, RDATASET_ATTR_NONEXISTENT, RDATASET_ATTR_STALE, rdatasetheader::trust, rdatasetheader::type, and UNUSED.

Referenced by cache_find(), cache_findzonecut(), and find_deepest_zonecut().

static void update_header ( dns_rbtdb_t rbtdb,
rdatasetheader_t header,
isc_stdtime_t  now 
) [static]

Update the timestamp of a given cache entry and move it to the head of the corresponding LRU list.

Caller must hold the node (write) lock.

Note that the we do NOT touch the heap here, as the TTL has not changed.

Definition at line 9942 of file rbtdb.c.

References INSIST, IS_CACHE, ISC_LINK_LINKED, ISC_LIST_PREPEND, ISC_LIST_UNLINK, rdatasetheader::last_used, dns_rbtnode::locknum, and rdatasetheader::node.

Referenced by cache_find(), cache_findzonecut(), and find_deepest_zonecut().

static void expire_header ( dns_rbtdb_t rbtdb,
rdatasetheader_t header,
isc_boolean_t  tree_locked,
expire_t  reason 
) [static]

Definition at line 10010 of file rbtdb.c.

References decrement_reference(), dns_cachestatscounter_deletelru, dns_cachestatscounter_deletettl, dns_rbtnode_refcurrent, expire_lru, expire_ttl, ISC_FALSE, isc_rwlocktype_none, isc_rwlocktype_write, isc_stats_increment(), mark_stale_header(), new_reference(), rdatasetheader::node, and set_ttl().

Referenced by addrdataset(), overmem_purge(), and rdataset_expire().

static void overmem_purge ( dns_rbtdb_t rbtdb,
unsigned int  locknum_start,
isc_stdtime_t  now,
isc_boolean_t  tree_locked 
) [static]

Purge some expired and/or stale (i.e. unused for some period) cache entries under an overmem condition. To recover from this condition quickly, up to 2 entries will be purged. This process is triggered while adding a new entry, and we specifically avoid purging entries in the same LRU bucket as the one to which the new entry will belong. Otherwise, we might purge entries of the same name of different RR types while adding RRsets from a single response (consider the case where we're adding A and AAAA glue records of the same NS name).

Definition at line 9966 of file rbtdb.c.

References expire_header(), expire_lru, expire_ttl, header, isc_heap_element(), ISC_LIST_PREV, ISC_LIST_TAIL, ISC_LIST_UNLINK, isc_rwlocktype_write, NODE_LOCK, NODE_UNLOCK, RBTDB_VIRTUAL, and rdatasetheader::rdh_ttl.

Referenced by addrdataset().

static isc_result_t resign_insert ( dns_rbtdb_t rbtdb,
int  idx,
rdatasetheader_t newheader 
) [static]

Definition at line 6056 of file rbtdb.c.

References rdatasetheader::heap_index, INSIST, IS_CACHE, isc_heap_insert(), and ISC_LINK_LINKED.

Referenced by add32(), closeversion(), and setsigningtime().

static void resign_delete ( dns_rbtdb_t rbtdb,
rbtdb_version_t version,
rdatasetheader_t header 
) [static]

Definition at line 6068 of file rbtdb.c.

References rdatasetheader::heap_index, isc_heap_delete(), ISC_LIST_APPEND, dns_rbtnode::locknum, new_reference(), rdatasetheader::node, and rbtdb_version::resigned_list.

Referenced by add32(), resigned(), and subtractrdataset().

static void prune_tree ( isc_task_t task,
isc_event_t event 
) [static]

Definition at line 2262 of file rbtdb.c.

References decrement_reference(), detach(), dns_rbtnode::down, isc_event_free(), ISC_LINK_LINKED, ISC_LIST_UNLINK, isc_rwlocktype_write, ISC_TRUE, dns_rbtnode::locknum, new_reference(), rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, dns_rbtnode::parent, RWLOCK, RWUNLOCK, and UNUSED.

Referenced by decrement_reference().

static void rdataset_settrust ( dns_rdataset_t rdataset,
dns_trust_t  trust 
) [static]

Definition at line 8762 of file rbtdb.c.

References header, isc_rwlocktype_write, dns_rbtnode::locknum, NODE_LOCK, NODE_UNLOCK, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::trust, and rdatasetheader::trust.

static void rdataset_expire ( dns_rdataset_t rdataset  )  [static]

Definition at line 8776 of file rbtdb.c.

References expire_flush, expire_header(), header, ISC_FALSE, isc_rwlocktype_write, dns_rbtnode::locknum, NODE_LOCK, NODE_UNLOCK, dns_rdataset::private1, dns_rdataset::private2, and dns_rdataset::private3.

static void rdataset_clearprefetch ( dns_rdataset_t rdataset  )  [static]

Definition at line 8790 of file rbtdb.c.

References rdatasetheader::attributes, header, isc_rwlocktype_write, dns_rbtnode::locknum, NODE_LOCK, NODE_UNLOCK, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, and RDATASET_ATTR_PREFETCH.

static void rdataset_setownercase ( dns_rdataset_t rdataset,
const dns_name_t name 
) [static]

Definition at line 9854 of file rbtdb.c.

References header, dns_rdataset::private3, and setownercase().

static void rdataset_getownercase ( const dns_rdataset_t rdataset,
dns_name_t name 
) [static]

Definition at line 9863 of file rbtdb.c.

References CASESET, header, dns_name::length, dns_name::ndata, dns_rdataset::private3, and rdatasetheader::upper.

static void rdatasetiter_destroy ( dns_rdatasetiter_t **  iteratorp  )  [static]

Definition at line 8808 of file rbtdb.c.

References closeversion(), rbtdb_rdatasetiter::common, dns_rdatasetiter::db, detachnode(), ISC_FALSE, isc_mem_put, dns_db::mctx, dns_rdatasetiter::node, and dns_rdatasetiter::version.

static isc_result_t rdatasetiter_first ( dns_rdatasetiter_t iterator  )  [static]

Definition at line 8824 of file rbtdb.c.

References rbtdb_rdatasetiter::common, rbtdb_rdatasetiter::current, dns_rbtnode::data, dns_rdatasetiter::db, rdatasetheader::down, header, IGNORE, IS_CACHE, ISC_R_NOMORE, ISC_R_SUCCESS, isc_rwlocktype_read, dns_rbtnode::locknum, rdatasetheader::next, dns_rdatasetiter::node, NODE_LOCK, NODE_UNLOCK, NONEXISTENT, dns_rdatasetiter::now, now, rdatasetheader::rdh_ttl, rbtdb_version::serial, rdatasetheader::serial, and dns_rdatasetiter::version.

static isc_result_t rdatasetiter_next ( dns_rdatasetiter_t iterator  )  [static]

Definition at line 8881 of file rbtdb.c.

References rdatasetheader::attributes, rbtdb_rdatasetiter::common, rdatasetheader::covers, rbtdb_rdatasetiter::current, dns_rdatasetiter::db, rdatasetheader::down, header, IGNORE, IS_CACHE, ISC_R_NOMORE, ISC_R_SUCCESS, isc_rwlocktype_read, dns_rbtnode::locknum, NEGATIVE, rdatasetheader::next, dns_rdatasetiter::node, NODE_LOCK, NODE_UNLOCK, dns_rdatasetiter::now, now, RBTDB_RDATATYPE_BASE, RBTDB_RDATATYPE_EXT, RBTDB_RDATATYPE_VALUE, RDATASET_ATTR_NONEXISTENT, rdatasetheader::rdh_ttl, rbtdb_version::serial, rdatasetheader::serial, rdatasetheader::type, and dns_rdatasetiter::version.

static void rdatasetiter_current ( dns_rdatasetiter_t iterator,
dns_rdataset_t rdataset 
) [static]

Definition at line 8958 of file rbtdb.c.

References bind_rdataset(), rbtdb_rdatasetiter::common, rbtdb_rdatasetiter::current, dns_rdatasetiter::db, header, isc_rwlocktype_read, dns_rbtnode::locknum, dns_rdatasetiter::node, NODE_LOCK, NODE_UNLOCK, dns_rdatasetiter::now, and REQUIRE.

static void dbiterator_destroy ( dns_dbiterator_t **  iteratorp  )  [static]

Definition at line 9078 of file rbtdb.c.

References rbtdb_dbiterator::chain, rbtdb_dbiterator::common, dns_dbiterator::db, dereference_iter_node(), dns_db_attach(), dns_db_detach(), dns_rbtnodechain_reset(), flush_deletions(), INSIST, isc_mem_put, isc_rwlocktype_none, isc_rwlocktype_read, rbtdb_dbiterator::nsec3chain, RWUNLOCK, and rbtdb_dbiterator::tree_locked.

Referenced by createiterator().

static isc_result_t dbiterator_first ( dns_dbiterator_t iterator  )  [static]

Definition at line 9105 of file rbtdb.c.

References rbtdb_dbiterator::chain, rbtdb_dbiterator::current, dns_dbiterator::db, dereference_iter_node(), dns_fixedname_name, DNS_R_NEWORIGIN, dns_rbtnodechain_current(), dns_rbtnodechain_first(), dns_rbtnodechain_reset(), INSIST, ISC_R_NOMORE, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, rbtdb_dbiterator::name, name, rbtdb_dbiterator::new_origin, rbtdb_dbiterator::node, rbtdb_dbiterator::nonsec3, rbtdb_dbiterator::nsec3chain, rbtdb_dbiterator::nsec3only, rbtdb_dbiterator::origin, origin, rbtdb_dbiterator::paused, reference_iter_node(), rbtdb_dbiterator::result, and resume_iteration().

static isc_result_t dbiterator_last ( dns_dbiterator_t iterator  )  [static]

Definition at line 9158 of file rbtdb.c.

References rbtdb_dbiterator::chain, rbtdb_dbiterator::current, dns_dbiterator::db, dereference_iter_node(), dns_fixedname_name, DNS_R_NEWORIGIN, dns_rbtnodechain_current(), dns_rbtnodechain_last(), dns_rbtnodechain_reset(), INSIST, ISC_R_NOMORE, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, rbtdb_dbiterator::name, name, rbtdb_dbiterator::new_origin, rbtdb_dbiterator::node, rbtdb_dbiterator::nonsec3, rbtdb_dbiterator::nsec3chain, rbtdb_dbiterator::nsec3only, rbtdb_dbiterator::origin, origin, rbtdb_dbiterator::paused, reference_iter_node(), rbtdb_dbiterator::result, and resume_iteration().

static isc_result_t dbiterator_seek ( dns_dbiterator_t iterator,
dns_name_t name 
) [static]

Definition at line 9207 of file rbtdb.c.

References rbtdb_dbiterator::chain, rbtdb_dbiterator::current, dns_dbiterator::db, dereference_iter_node(), dns_fixedname_name, DNS_R_PARTIALMATCH, dns_rbt_findnode(), DNS_RBTFIND_EMPTYDATA, dns_rbtnodechain_current(), dns_rbtnodechain_reset(), ISC_R_NOMORE, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, rbtdb_dbiterator::name, rbtdb_dbiterator::new_origin, rdatasetheader::node, rbtdb_dbiterator::node, rbtdb_dbiterator::nonsec3, rbtdb_dbiterator::nsec3chain, rbtdb_dbiterator::nsec3only, rbtdb_dbiterator::origin, origin, rbtdb_dbiterator::paused, reference_iter_node(), rbtdb_dbiterator::result, and resume_iteration().

static isc_result_t dbiterator_prev ( dns_dbiterator_t iterator  )  [static]

Definition at line 9299 of file rbtdb.c.

References rbtdb_dbiterator::chain, rbtdb_dbiterator::current, dns_dbiterator::db, dereference_iter_node(), dns_fixedname_name, DNS_R_NEWORIGIN, dns_rbtnodechain_current(), dns_rbtnodechain_last(), dns_rbtnodechain_prev(), dns_rbtnodechain_reset(), ISC_R_NOMORE, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TF, rbtdb_dbiterator::name, name, rbtdb_dbiterator::new_origin, rbtdb_dbiterator::node, rbtdb_dbiterator::nonsec3, rbtdb_dbiterator::nsec3chain, rbtdb_dbiterator::nsec3only, rbtdb_dbiterator::origin, origin, rbtdb_dbiterator::paused, reference_iter_node(), REQUIRE, rbtdb_dbiterator::result, and resume_iteration().

static isc_result_t dbiterator_next ( dns_dbiterator_t iterator  )  [static]

Definition at line 9344 of file rbtdb.c.

References rbtdb_dbiterator::chain, rbtdb_dbiterator::current, dns_dbiterator::db, dereference_iter_node(), dns_fixedname_name, DNS_R_NEWORIGIN, dns_rbtnodechain_current(), dns_rbtnodechain_first(), dns_rbtnodechain_next(), dns_rbtnodechain_reset(), ISC_R_NOMORE, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TF, rbtdb_dbiterator::name, name, rbtdb_dbiterator::new_origin, rbtdb_dbiterator::node, rbtdb_dbiterator::nonsec3, rbtdb_dbiterator::nsec3chain, rbtdb_dbiterator::nsec3only, rbtdb_dbiterator::origin, origin, rbtdb_dbiterator::paused, reference_iter_node(), REQUIRE, rbtdb_dbiterator::result, and resume_iteration().

static isc_result_t dbiterator_current ( dns_dbiterator_t iterator,
dns_dbnode_t **  nodep,
dns_name_t name 
) [static]

Definition at line 9387 of file rbtdb.c.

References dns_dbiterator::cleaning, dns_dbiterator::db, DELETION_BATCH_MAX, dns_fixedname_name, dns_name_concatenate(), DNS_R_NEWORIGIN, dns_rbtnode_refincrement, dns_rbtnode::down, expirenode(), flush_deletions(), INSIST, ISC_R_SUCCESS, dns_rbtnode::locknum, new_reference(), rdatasetheader::node, NODE_STRONGLOCK, NODE_STRONGUNLOCK, origin, REQUIRE, and resume_iteration().

static isc_result_t dbiterator_pause ( dns_dbiterator_t iterator  )  [static]

Definition at line 9451 of file rbtdb.c.

References dns_dbiterator::db, flush_deletions(), INSIST, ISC_R_NOMORE, ISC_R_SUCCESS, isc_rwlocktype_none, isc_rwlocktype_read, ISC_TRUE, and RWUNLOCK.

static isc_result_t dbiterator_origin ( dns_dbiterator_t iterator,
dns_name_t name 
) [static]

Definition at line 9476 of file rbtdb.c.

References dns_fixedname_name, dns_name_copy(), ISC_R_SUCCESS, rbtdb_dbiterator::origin, origin, and rbtdb_dbiterator::result.

static void free_rbtdb ( dns_rbtdb_t rbtdb,
isc_boolean_t  log,
isc_event_t event 
) [static]

Definition at line 1143 of file rbtdb.c.

References adjust_quantum(), DNS_EVENT_FREESTORAGE, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, dns_name_dynamic(), dns_name_format(), DNS_NAME_FORMATSIZE, dns_name_free(), dns_rbt_destroy2(), dns_rpz_detach_rpzs(), dns_stats_detach(), EMPTY, free_rbtdb_callback(), dns_db::impmagic, INSIST, IS_CACHE, isc_event_allocate(), isc_event_free(), isc_file_munmap(), isc_heap_destroy(), ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, ISC_LOG_DEBUG, isc_log_write(), isc_mem_detach(), isc_mem_put, isc_mem_putanddetach, isc_ondestroy_notify(), ISC_R_QUOTA, ISC_R_SUCCESS, isc_refcount_decrement, isc_refcount_destroy, isc_rwlock_destroy(), isc_stats_detach(), isc_task_detach(), isc_task_send(), isc_time_now(), dns_db::magic, dns_db::mctx, rdatasetheader::node, NODE_DESTROYLOCK, dns_db::ondest, dns_db::origin, overmem(), RBTDB_DESTROYLOCK, REQUIRE, start, and UNLINK.

Referenced by detachnode(), dns_rbtdb_create(), free_rbtdb_callback(), and maybe_free_rbtdb().

static void overmem ( dns_db_t db,
isc_boolean_t  over 
) [static]

Definition at line 5647 of file rbtdb.c.

References UNUSED.

Referenced by check_stale_name(), clean_namehooks(), dns_adb_destroyfind(), dns_adb_freeaddrinfo(), free_rbtdb(), and water().

static void setnsec3parameters ( dns_db_t db,
rbtdb_version_t version 
) [static]

Definition at line 2419 of file rbtdb.c.

References isc_region::base, rdatasetheader::count, dns_rbtnode::data, dns_nsec3_supportedhash(), DNS_NSEC3_UNKNOWNALG, dns_rdata_fromregion(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), rdatasetheader::down, rbtdb_version::flags, rbtdb_version::hash, rbtdb_version::havensec3, header, IGNORE, INSIST, ISC_FALSE, ISC_R_SUCCESS, isc_rwlocktype_read, ISC_TRUE, rbtdb_version::iterations, isc_region::length, dns_rbtnode::locknum, rdatasetheader::next, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, NONEXISTENT, dns_rdata::rdclass, RWLOCK, RWUNLOCK, rbtdb_version::salt, rbtdb_version::salt_length, rbtdb_version::serial, rdatasetheader::serial, and rdatasetheader::type.

Referenced by iszonesecure().

static void setownercase ( rdatasetheader_t header,
const dns_name_t name 
) [static]

Definition at line 9839 of file rbtdb.c.

References rdatasetheader::attributes, dns_name::length, dns_name::ndata, RDATASET_ATTR_CASESET, and rdatasetheader::upper.

static void attach ( dns_db_t source,
dns_db_t **  targetp 
) [static]

Definition at line 957 of file rbtdb.c.

References isc_refcount_increment, REQUIRE, and VALID_RBTDB.

static void free_rbtdb_callback ( isc_task_t task,
isc_event_t event 
) [static]

Definition at line 968 of file rbtdb.c.

References free_rbtdb(), ISC_TRUE, and UNUSED.

Referenced by free_rbtdb().

static void update_cachestats ( dns_rbtdb_t rbtdb,
isc_result_t  result 
) [static]

Definition at line 977 of file rbtdb.c.

References dns_cachestatscounter_hits, dns_cachestatscounter_misses, DNS_R_CNAME, DNS_R_DELEGATION, DNS_R_DNAME, DNS_R_NCACHENXDOMAIN, DNS_R_NCACHENXRRSET, INSIST, IS_CACHE, ISC_R_SUCCESS, and isc_stats_increment().

Referenced by cache_find(), and cache_findrdataset().

static void update_rrsetstats ( dns_rbtdb_t rbtdb,
rdatasetheader_t header,
isc_boolean_t  increment 
) [static]

Definition at line 1000 of file rbtdb.c.

References dns_rdatasetstats_decrement(), dns_rdatasetstats_increment(), DNS_RDATASTATSTYPE_ATTR_NXDOMAIN, DNS_RDATASTATSTYPE_ATTR_NXRRSET, DNS_RDATASTATSTYPE_VALUE, INSIST, IS_CACHE, NEGATIVE, NXDOMAIN, RBTDB_RDATATYPE_BASE, RBTDB_RDATATYPE_EXT, and rdatasetheader::type.

Referenced by addrdataset(), free_rdataset(), and mark_stale_header().

static void set_ttl ( dns_rbtdb_t rbtdb,
rdatasetheader_t header,
dns_ttl_t  newttl 
) [static]

Definition at line 1028 of file rbtdb.c.

References rdatasetheader::heap_index, IS_CACHE, isc_heap_decreased(), isc_heap_increased(), dns_rbtnode::locknum, rdatasetheader::node, and rdatasetheader::rdh_ttl.

Referenced by add32(), addrdataset(), deleterdataset(), expire_header(), expirenode(), loading_addrdataset(), and subtractrdataset().

static isc_boolean_t ttl_sooner ( void *  v1,
void *  v2 
) [static]

These functions allow the heap code to rank the priority of each element. It returns ISC_TRUE if v1 happens "sooner" than v2.

Definition at line 1065 of file rbtdb.c.

References ISC_FALSE, ISC_TRUE, and rdatasetheader::rdh_ttl.

Referenced by dns_rbtdb_create().

static isc_boolean_t resign_sooner ( void *  v1,
void *  v2 
) [static]

Definition at line 1075 of file rbtdb.c.

References ISC_FALSE, isc_serial_lt(), ISC_TRUE, and rdatasetheader::resign.

Referenced by dns_rbtdb_create().

static void set_index ( void *  what,
unsigned int  idx 
) [static]

This function sets the heap index into the header.

Definition at line 1088 of file rbtdb.c.

References rdatasetheader::heap_index.

static unsigned int adjust_quantum ( unsigned int  old,
isc_time_t start 
) [static]

Work out how many nodes can be deleted in the time between two requests to the nameserver. Smooth the resulting number and use it as a estimate for the number of nodes to be deleted in the next iteration.

Definition at line 1101 of file rbtdb.c.

References dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, dns_pps, ISC_LOG_DEBUG, isc_log_write(), isc_time_microdiff(), and isc_time_now().

Referenced by free_rbtdb().

static void maybe_free_rbtdb ( dns_rbtdb_t rbtdb  )  [inline, static]

Definition at line 1313 of file rbtdb.c.

References dns_db_detachnode(), dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, dns_name_dynamic(), dns_name_format(), DNS_NAME_FORMATSIZE, free_rbtdb(), ISC_FALSE, ISC_LOG_DEBUG, isc_log_write(), isc_refcount_current, isc_rwlocktype_write, ISC_TRUE, NODE_LOCK, NODE_UNLOCK, dns_db::origin, RBTDB_LOCK, and RBTDB_UNLOCK.

Referenced by cleanup_dead_nodes_callback(), and detach().

static void detach ( dns_db_t **  dbp  )  [static]

Definition at line 1361 of file rbtdb.c.

References isc_refcount_decrement, maybe_free_rbtdb(), REQUIRE, and VALID_RBTDB.

static void currentversion ( dns_db_t db,
dns_dbversion_t **  versionp 
) [static]

Definition at line 1376 of file rbtdb.c.

References isc_refcount_increment, isc_rwlocktype_read, RBTDB_LOCK, RBTDB_UNLOCK, rbtdb_version::references, REQUIRE, VALID_RBTDB, and version.

Referenced by allrdatasets(), loadzonekeys(), warnifallksk(), zone_find(), and zone_findrdataset().

static rbtdb_version_t* allocate_version ( isc_mem_t mctx,
rbtdb_serial_t  serial,
unsigned int  references,
isc_boolean_t  writer 
) [inline, static]

Definition at line 1392 of file rbtdb.c.

References rbtdb_version::changed_list, rbtdb_version::commit_ok, ISC_FALSE, ISC_LINK_INIT, ISC_LIST_INIT, isc_mem_get, isc_mem_put, ISC_R_SUCCESS, isc_refcount_init(), rbtdb_version::references, rbtdb_version::resigned_list, rbtdb_version::serial, version, and rbtdb_version::writer.

Referenced by dns_rbtdb_create(), and newversion().

static isc_result_t newversion ( dns_db_t db,
dns_dbversion_t **  versionp 
) [static]

Definition at line 1417 of file rbtdb.c.

References allocate_version(), rbtdb_version::commit_ok, rbtdb_version::flags, rbtdb_version::hash, rbtdb_version::havensec3, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlocktype_write, ISC_TRUE, rbtdb_version::iterations, rbtdb_version::rbtdb, RBTDB_LOCK, RBTDB_UNLOCK, REQUIRE, RUNTIME_CHECK, rbtdb_version::salt, rbtdb_version::salt_length, rbtdb_version::secure, VALID_RBTDB, and version.

static void attachversion ( dns_db_t db,
dns_dbversion_t source,
dns_dbversion_t **  targetp 
) [static]

Definition at line 1464 of file rbtdb.c.

References INSIST, isc_refcount_increment, rbtdb_version::rbtdb, rbtdb_version::references, REQUIRE, and VALID_RBTDB.

Referenced by ATF_TC_BODY(), and ATF_TP_ADD_TCS().

static rbtdb_changed_t* add_changed ( dns_rbtdb_t rbtdb,
rbtdb_version_t version,
dns_rbtnode_t node 
) [static]

Definition at line 1481 of file rbtdb.c.

References rbtdb_version::changed_list, rbtdb_version::commit_ok, rbtdb_changed::dirty, dns_rbtnode_refincrement, INSIST, ISC_FALSE, ISC_LIST_INITANDAPPEND, isc_mem_get, isc_rwlocktype_write, rbtdb_changed::node, RBTDB_LOCK, RBTDB_UNLOCK, REQUIRE, and rbtdb_version::writer.

Referenced by add32(), and subtractrdataset().

static void free_acachearray ( isc_mem_t mctx,
rdatasetheader_t header,
acachectl_t array 
) [static]

Definition at line 1513 of file rbtdb.c.

References rdatasetheader::count, INSIST, and isc_mem_put.

Referenced by free_rdataset().

static void free_noqname ( isc_mem_t mctx,
struct noqname **  noqname 
) [inline, static]

Definition at line 1542 of file rbtdb.c.

References dns_name_dynamic(), dns_name_free(), dns_rdataslab_size(), and isc_mem_put.

Referenced by addclosest(), addnoqname(), and free_rdataset().

static void init_rdataset ( dns_rbtdb_t rbtdb,
rdatasetheader_t h 
) [inline, static]

Definition at line 1557 of file rbtdb.c.

References rdatasetheader::heap_index, IS_CACHE, rdatasetheader::is_mmapped, ISC_LINK_INIT, rdatasetheader::next_is_relative, rdatasetheader::node_is_relative, and UNUSED.

Referenced by add32(), addrdataset(), deleterdataset(), loading_addrdataset(), new_rdataset(), and subtractrdataset().

static void update_newheader ( rdatasetheader_t new,
rdatasetheader_t old 
) [static]

Definition at line 1576 of file rbtdb.c.

References CASESET, rdatasetheader::next, rdatasetheader::next_is_relative, rdatasetheader::node, rdatasetheader::node_is_relative, RDATASET_ATTR_CASESET, and rdatasetheader::upper.

Referenced by add32(), and subtractrdataset().

static rdatasetheader_t* new_rdataset ( dns_rbtdb_t rbtdb,
isc_mem_t mctx 
) [inline, static]

Definition at line 1596 of file rbtdb.c.

References init_rdataset(), IS_CACHE, isc_mem_get, rdatasetheader::rdh_ttl, and rdatasetheader::upper.

Referenced by deleterdataset(), and subtractrdataset().

static void free_rdataset ( dns_rbtdb_t rbtdb,
isc_mem_t mctx,
rdatasetheader_t rdataset 
) [inline, static]

Definition at line 1614 of file rbtdb.c.

References rdatasetheader::additional_auth, rdatasetheader::additional_glue, rdatasetheader::attributes, rdatasetheader::closest, dns_rdataslab_size(), EXISTS, free_acachearray(), free_noqname(), rdatasetheader::heap_index, INSIST, IS_CACHE, ISC_FALSE, isc_heap_delete(), ISC_LINK_LINKED, ISC_LIST_UNLINK, isc_mem_put, dns_rbtnode::locknum, rdatasetheader::node, rdatasetheader::noqname, RDATASET_ATTR_NONEXISTENT, RDATASET_ATTR_STATCOUNT, and update_rrsetstats().

Referenced by add32(), addrdataset(), cache_find(), cache_findzonecut(), cache_zonecut_callback(), clean_cache_node(), clean_stale_headers(), clean_zone_node(), delete_callback(), find_coveringnsec(), find_deepest_zonecut(), getsection(), and subtractrdataset().

static void rollback_node ( dns_rbtnode_t node,
rbtdb_serial_t  serial 
) [inline, static]

Definition at line 1654 of file rbtdb.c.

References rdatasetheader::attributes, dns_rbtnode::data, dns_rbtnode::dirty, rdatasetheader::down, header, ISC_FALSE, ISC_TRUE, rdatasetheader::next, RDATASET_ATTR_IGNORE, and rdatasetheader::serial.

Referenced by closeversion().

static void mark_stale_header ( dns_rbtdb_t rbtdb,
rdatasetheader_t header 
) [inline, static]

Definition at line 1686 of file rbtdb.c.

References rdatasetheader::attributes, dns_rbtnode::dirty, EXISTS, ISC_TRUE, rdatasetheader::node, RDATASET_ATTR_STALE, RDATASET_ATTR_STATCOUNT, and update_rrsetstats().

Referenced by add32(), cache_find(), cache_findrdataset(), cache_findzonecut(), cache_zonecut_callback(), expire_header(), expirenode(), find_coveringnsec(), and find_deepest_zonecut().

static void clean_stale_headers ( dns_rbtdb_t rbtdb,
isc_mem_t mctx,
rdatasetheader_t top 
) [inline, static]

Definition at line 1708 of file rbtdb.c.

References rdatasetheader::down, and free_rdataset().

Referenced by cache_find(), cache_findzonecut(), cache_zonecut_callback(), clean_cache_node(), find_coveringnsec(), and find_deepest_zonecut().

static void clean_cache_node ( dns_rbtdb_t rbtdb,
dns_rbtnode_t node 
) [inline, static]

Definition at line 1720 of file rbtdb.c.

References rdatasetheader::attributes, clean_stale_headers(), dns_rbtnode::data, dns_rbtnode::dirty, free_rdataset(), mctx, rdatasetheader::next, RDATASET_ATTR_NONEXISTENT, and RDATASET_ATTR_STALE.

Referenced by decrement_reference().

static void clean_zone_node ( dns_rbtdb_t rbtdb,
dns_rbtnode_t node,
rbtdb_serial_t  least_serial 
) [inline, static]

Definition at line 1749 of file rbtdb.c.

References dns_rbtnode::data, dns_rbtnode::dirty, rdatasetheader::down, free_rdataset(), IGNORE, INSIST, ISC_FALSE, ISC_TRUE, mctx, rdatasetheader::next, NONEXISTENT, REQUIRE, and rdatasetheader::serial.

Referenced by decrement_reference().

static void delete_node ( dns_rbtdb_t rbtdb,
dns_rbtnode_t node 
) [static]

Definition at line 1875 of file rbtdb.c.

References dns_fixedname_init, dns_fixedname_name, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, dns_rbt_deletenode(), dns_rbt_findnode(), dns_rbt_fullnamefromnode(), DNS_RBT_NSEC_HAS_NSEC, DNS_RBT_NSEC_NORMAL, DNS_RBT_NSEC_NSEC, DNS_RBT_NSEC_NSEC3, DNS_RBTFIND_EMPTYDATA, dns_rpz_delete(), INSIST, ISC_FALSE, ISC_LINK_LINKED, ISC_LOG_WARNING, isc_log_write(), ISC_R_SUCCESS, ISC_R_UNEXPECTED, isc_result_totext(), name, dns_rbtnode::nsec, and dns_rbtnode::rpz.

Referenced by cleanup_dead_nodes(), and decrement_reference().

static void cleanup_dead_nodes ( dns_rbtdb_t rbtdb,
int  bucketnum 
) [static]

Clean up dead nodes. These are nodes which have no references, and have no data. They are dead but we could not or chose not to delete them when we deleted all the data at that node because we did not want to wait for the tree write lock.

The caller must hold a tree write lock and bucketnum'th node (write) lock.

Definition at line 1956 of file rbtdb.c.

References rdatasetheader::count, dns_rbtnode::data, delete_node(), dns_rbtnode_refcurrent, INSIST, ISC_LIST_HEAD, ISC_LIST_UNLINK, and rdatasetheader::node.

Referenced by addrdataset(), cleanup_dead_nodes_callback(), closeversion(), and reactivate_node().

static void new_reference ( dns_rbtdb_t rbtdb,
dns_rbtnode_t node 
) [inline, static]

Definition at line 1982 of file rbtdb.c.

References dns_rbtnode_refincrement0, INSIST, ISC_LINK_LINKED, isc_refcount_increment0, and dns_rbtnode::locknum.

Referenced by bind_rdataset(), cache_find(), cache_findzonecut(), cache_zonecut_callback(), dbiterator_current(), decrement_reference(), expire_header(), find_closest_nsec(), find_coveringnsec(), find_deepest_zonecut(), getoriginnode(), prune_tree(), reactivate_node(), resign_delete(), zone_find(), and zone_zonecut_callback().

static void reactivate_node ( dns_rbtdb_t rbtdb,
dns_rbtnode_t node,
isc_rwlocktype_t  treelocktype 
) [inline, static]

Definition at line 2007 of file rbtdb.c.

References cleanup_dead_nodes(), ISC_FALSE, ISC_LINK_LINKED, ISC_LIST_EMPTY, ISC_LIST_UNLINK, isc_rwlocktype_read, isc_rwlocktype_write, ISC_TRUE, dns_rbtnode::locknum, new_reference(), NODE_STRONGLOCK, NODE_STRONGUNLOCK, NODE_WEAKLOCK, NODE_WEAKUNLOCK, and POST.

Referenced by findnodeintree(), and reference_iter_node().

static isc_boolean_t decrement_reference ( dns_rbtdb_t rbtdb,
dns_rbtnode_t node,
rbtdb_serial_t  least_serial,
isc_rwlocktype_t  nlock,
isc_rwlocktype_t  tlock,
isc_boolean_t  pruning 
) [static]

Definition at line 2060 of file rbtdb.c.

References attach(), clean_cache_node(), clean_zone_node(), dns_rbtnode::data, delete_node(), dns_rbtnode::dirty, DNS_EVENT_RBTPRUNE, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, DNS_NAME_FORMATSIZE, dns_rbt_formatnodename(), dns_rbtnode_refdecrement, dns_rbtnode::down, INSIST, IS_CACHE, isc_event_allocate(), ISC_FALSE, ISC_LINK_LINKED, ISC_LIST_APPEND, ISC_LOG_DEBUG, ISC_LOG_INFO, isc_log_wouldlog(), isc_log_write(), ISC_R_LOCKBUSY, ISC_R_SUCCESS, isc_refcount_decrement, isc_rwlock_downgrade(), isc_rwlock_trylock(), isc_rwlock_tryupgrade(), isc_rwlocktype_none, isc_rwlocktype_read, isc_rwlocktype_write, isc_task_send(), ISC_TF, ISC_TRUE, KEEP_NODE, dns_rbtnode::left, rbtdb_nodelock_t::lock, dns_rbtnode::locknum, new_reference(), NODE_WEAKDOWNGRADE, NODE_WEAKLOCK, NODE_WEAKUNLOCK, dns_rbtnode::parent, prune_tree(), RBTDB_LOCK, RBTDB_UNLOCK, rbtdb_nodelock_t::references, dns_rbtnode::right, RUNTIME_CHECK, and RWUNLOCK.

Referenced by cache_find(), closeversion(), dereference_iter_node(), detachnode(), expire_header(), flush_deletions(), prune_tree(), and zone_find().

static void make_least_version ( dns_rbtdb_t rbtdb,
rbtdb_version_t version,
rbtdb_changedlist_t *  cleanup_list 
) [inline, static]

Definition at line 2318 of file rbtdb.c.

References rbtdb_version::changed_list, ISC_LIST_INIT, and rbtdb_version::serial.

Referenced by closeversion().

static void cleanup_nondirty ( rbtdb_version_t version,
rbtdb_changedlist_t *  cleanup_list 
) [inline, static]

Definition at line 2331 of file rbtdb.c.

References APPEND, rbtdb_version::changed_list, rbtdb_changed::dirty, HEAD, NEXT, and UNLINK.

Referenced by closeversion().

static void iszonesecure ( dns_db_t db,
rbtdb_version_t version,
dns_dbnode_t origin 
) [static]

Walk the origin node looking for NSEC3PARAM records. Cache the nsec3 parameters.

Definition at line 2362 of file rbtdb.c.

References dns_db_findrdataset(), DNS_RDATA_INIT, dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_next(), dns_zonekey_iszonekey(), rbtdb_version::havensec3, ISC_FALSE, ISC_R_SUCCESS, ISC_TRUE, rbtdb_version::secure, and setnsec3parameters().

Referenced by addrdataset(), closeversion(), deleterdataset(), endload(), and subtractrdataset().

static void cleanup_dead_nodes_callback ( isc_task_t task,
isc_event_t event 
) [static]

Definition at line 2511 of file rbtdb.c.

References cleanup_dead_nodes(), isc_event_free(), ISC_FALSE, ISC_LIST_HEAD, isc_refcount_decrement, isc_rwlocktype_write, isc_task_send(), ISC_TRUE, maybe_free_rbtdb(), NODE_LOCK, NODE_UNLOCK, RWLOCK, and RWUNLOCK.

Referenced by closeversion().

static void closeversion ( dns_db_t db,
dns_dbversion_t **  versionp,
isc_boolean_t  commit 
) [static]

Definition at line 2539 of file rbtdb.c.

References APPENDLIST, rbtdb_version::changed_list, cleanup_dead_nodes(), cleanup_dead_nodes_callback(), cleanup_nondirty(), rbtdb_version::commit_ok, decrement_reference(), DNS_EVENT_RBTDEADNODES, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_ZONE, dns_result_totext(), EMPTY, HEAD, header, IGNORE, INSIST, IS_CACHE, isc_event_allocate(), ISC_FALSE, ISC_LIST_INIT, ISC_LIST_UNLINK, ISC_LOG_ERROR, isc_log_write(), isc_mem_put, ISC_R_SUCCESS, isc_refcount_decrement, isc_refcount_increment, isc_refcount_increment0, isc_rwlocktype_none, isc_rwlocktype_read, isc_rwlocktype_write, isc_task_send(), ISC_TRUE, iszonesecure(), dns_rbtnode::locknum, make_least_version(), NEXT, rbtdb_changed::node, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, PREPEND, PREV, rbtdb_version::rbtdb, RBTDB_LOCK, RBTDB_UNLOCK, rbtdb_version::references, REQUIRE, resign_insert(), rbtdb_version::resigned_list, rollback_node(), RWLOCK, RWUNLOCK, rbtdb_version::serial, rdatasetheader::serial, UNLINK, VALID_RBTDB, version, and rbtdb_version::writer.

Referenced by ATF_TC_BODY(), ATF_TP_ADD_TCS(), rdatasetiter_destroy(), zone_find(), zone_findrdataset(), and zone_get_from_db().

static isc_result_t add_wildcard_magic ( dns_rbtdb_t rbtdb,
dns_name_t name 
) [static]

Definition at line 2823 of file rbtdb.c.

References dns_name_countlabels(), dns_name_getlabelsequence(), dns_name_init(), dns_rbt_addnode(), DNS_RBT_NSEC_NORMAL, dns_rbtnode::find_callback, INSIST, ISC_R_EXISTS, ISC_R_SUCCESS, rdatasetheader::node, dns_rbtnode::nsec, and dns_rbtnode::wild.

Referenced by add_empty_wildcards(), findnodeintree(), and loading_addrdataset().

static isc_result_t add_empty_wildcards ( dns_rbtdb_t rbtdb,
dns_name_t name 
) [static]

Definition at line 2846 of file rbtdb.c.

References add_wildcard_magic(), dns_name_countlabels(), dns_name_getlabelsequence(), dns_name_init(), dns_name_iswildcard(), dns_rbt_addnode(), DNS_RBT_NSEC_NORMAL, ISC_R_EXISTS, ISC_R_SUCCESS, rdatasetheader::node, and dns_rbtnode::nsec.

Referenced by findnodeintree(), and loading_addrdataset().

static isc_result_t findnodeintree ( dns_rbtdb_t rbtdb,
dns_rbt_t tree,
dns_name_t name,
isc_boolean_t  create,
dns_dbnode_t **  nodep 
) [static]

Definition at line 2876 of file rbtdb.c.

References add_empty_wildcards(), add_wildcard_magic(), dns_fixedname_init, dns_fixedname_name, dns_lctx, DNS_LOGCATEGORY_RPZ, DNS_LOGMODULE_RBTDB, dns_name_hash(), dns_name_init(), dns_name_iswildcard(), DNS_R_PARTIALMATCH, dns_rbt_addnode(), dns_rbt_findnode(), dns_rbt_fullnamefromnode(), dns_rbt_namefromnode(), DNS_RBT_NSEC_NSEC3, DNS_RBTFIND_EMPTYDATA, dns_rpz_add(), DNS_RPZ_ERROR_LEVEL, dns_rbtnode::hashval, INSIST, isc_log_write(), ISC_R_EXISTS, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_result_totext(), isc_rwlocktype_read, isc_rwlocktype_write, ISC_TRUE, dns_rbtnode::locknum, rdatasetheader::node, dns_rbtnode::nsec, reactivate_node(), dns_rbtnode::rpz, RWLOCK, and RWUNLOCK.

Referenced by findnode(), and findnsec3node().

static isc_result_t findnode ( dns_db_t db,
dns_name_t name,
isc_boolean_t  create,
dns_dbnode_t **  nodep 
) [static]

Definition at line 2973 of file rbtdb.c.

References findnodeintree(), REQUIRE, and VALID_RBTDB.

static isc_result_t findnsec3node ( dns_db_t db,
dns_name_t name,
isc_boolean_t  create,
dns_dbnode_t **  nodep 
) [static]

Definition at line 2984 of file rbtdb.c.

References findnodeintree(), REQUIRE, and VALID_RBTDB.

static isc_result_t zone_zonecut_callback ( dns_rbtnode_t node,
dns_name_t name,
void *  arg 
) [static]

Definition at line 2995 of file rbtdb.c.

References rbtdb_search_t::copy_name, dns_rbtnode::data, DNS_DBFIND_GLUEOK, DNS_DBFIND_NOWILD, dns_fixedname_name, dns_name_copy(), DNS_R_CONTINUE, DNS_R_PARTIALMATCH, rdatasetheader::down, header, IGNORE, IS_CACHE, IS_STUB, ISC_FALSE, ISC_R_SUCCESS, isc_rwlocktype_read, ISC_TRUE, dns_rbtnode::locknum, rbtdb_search_t::need_cleanup, new_reference(), rdatasetheader::next, NODE_LOCK, NODE_UNLOCK, NONEXISTENT, rbtdb_search_t::options, rbtdb_search_t::rbtdb, RBTDB_RDATATYPE_SIGDNAME, RUNTIME_CHECK, search(), rbtdb_search_t::serial, rdatasetheader::serial, rdatasetheader::type, dns_rbtnode::wild, rbtdb_search_t::wild, rbtdb_search_t::zonecut, rbtdb_search_t::zonecut_name, rbtdb_search_t::zonecut_rdataset, and rbtdb_search_t::zonecut_sigrdataset.

Referenced by zone_find().

static void bind_rdataset ( dns_rbtdb_t rbtdb,
dns_rbtnode_t node,
rdatasetheader_t header,
isc_stdtime_t  now,
dns_rdataset_t rdataset 
) [inline, static]

Definition at line 3139 of file rbtdb.c.

References dns_rdataset::attributes, rdatasetheader::closest, rdatasetheader::count, dns_rdataset::count, dns_rdataset::covers, DNS_RDATASETATTR_CLOSEST, DNS_RDATASETATTR_NEGATIVE, DNS_RDATASETATTR_NOQNAME, DNS_RDATASETATTR_NXDOMAIN, DNS_RDATASETATTR_OPTOUT, DNS_RDATASETATTR_PREFETCH, DNS_RDATASETATTR_RESIGN, INSIST, ISC_UINT32_MAX, dns_rdataset::methods, NEGATIVE, new_reference(), rdatasetheader::noqname, NXDOMAIN, OPTOUT, PREFETCH, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::private5, dns_rdataset::private6, dns_rdataset::private7, dns_rdataset::privateuint4, RBTDB_RDATATYPE_BASE, RBTDB_RDATATYPE_EXT, rdataset_methods, dns_rdataset::rdclass, rdatasetheader::rdh_ttl, rdatasetheader::resign, dns_rdataset::resign, RESIGN, rdatasetheader::trust, dns_rdataset::trust, dns_rdataset::ttl, rdatasetheader::type, and dns_rdataset::type.

static isc_result_t setup_delegation ( rbtdb_search_t search,
dns_dbnode_t **  nodep,
dns_name_t foundname,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [inline, static]

Definition at line 3209 of file rbtdb.c.

References bind_rdataset(), rbtdb_search_t::copy_name, dns_fixedname_name, dns_name_copy(), DNS_R_DELEGATION, DNS_R_DNAME, ISC_FALSE, ISC_R_SUCCESS, isc_rwlocktype_read, dns_rbtnode::locknum, rbtdb_search_t::need_cleanup, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, rbtdb_search_t::now, rbtdb_search_t::rbtdb, rdatasetheader::type, rbtdb_search_t::zonecut, rbtdb_search_t::zonecut_name, rbtdb_search_t::zonecut_rdataset, and rbtdb_search_t::zonecut_sigrdataset.

Referenced by cache_find(), and zone_find().

static isc_boolean_t valid_glue ( rbtdb_search_t search,
dns_name_t name,
rbtdb_rdatatype_t  type,
dns_rbtnode_t node 
) [inline, static]

Definition at line 3266 of file rbtdb.c.

References isc_region::base, rdatasetheader::count, dns_name_compare(), dns_name_fromregion(), dns_name_init(), header, ISC_FALSE, ISC_TRUE, isc_region::length, rbtdb_search_t::zonecut, and rbtdb_search_t::zonecut_rdataset.

Referenced by zone_find().

static isc_boolean_t activeempty ( rbtdb_search_t search,
dns_rbtnodechain_t chain,
dns_name_t name 
) [inline, static]

Definition at line 3331 of file rbtdb.c.

References answer, dns_rbtnode::data, dns_fixedname_init, dns_fixedname_name, dns_name_concatenate(), dns_name_init(), dns_name_issubdomain(), DNS_R_NEWORIGIN, dns_rbtnodechain_current(), dns_rbtnodechain_next(), EXISTS, header, IGNORE, ISC_FALSE, ISC_R_SUCCESS, isc_rwlocktype_read, ISC_TRUE, dns_rbtnode::locknum, rdatasetheader::next, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, origin, rbtdb_search_t::rbtdb, rbtdb_search_t::serial, and rdatasetheader::serial.

Referenced by find_wildcard(), and zone_find().

static isc_boolean_t activeemtpynode ( rbtdb_search_t search,
dns_name_t qname,
dns_name_t wname 
) [inline, static]

Definition at line 3383 of file rbtdb.c.

References answer, rbtdb_search_t::chain, dns_rbtnode::data, dns_fixedname_init, dns_fixedname_name, dns_name_clone(), dns_name_concatenate(), dns_name_countlabels(), dns_name_equal(), dns_name_getlabelsequence(), dns_name_init(), dns_name_issubdomain(), DNS_R_NEWORIGIN, dns_rbtnodechain_current(), dns_rbtnodechain_next(), dns_rbtnodechain_prev(), EXISTS, header, IGNORE, ISC_FALSE, ISC_R_SUCCESS, isc_rwlocktype_read, ISC_TRUE, dns_rbtnode::locknum, name, rdatasetheader::next, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, origin, rbtdb_search_t::rbtdb, rbtdb_search_t::serial, and rdatasetheader::serial.

Referenced by find_wildcard().

static isc_result_t find_wildcard ( rbtdb_search_t search,
dns_rbtnode_t **  nodep,
dns_name_t qname 
) [inline, static]

Definition at line 3498 of file rbtdb.c.

References activeempty(), activeemtpynode(), rbtdb_search_t::chain, dns_rbtnode::data, dns_fixedname_init, dns_fixedname_name, dns_name_concatenate(), dns_name_init(), DNS_R_PARTIALMATCH, dns_rbt_findnode(), dns_rbt_namefromnode(), DNS_RBTFIND_EMPTYDATA, dns_rbtnodechain_init(), dns_wildcardname, EXISTS, header, IGNORE, ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_read, ISC_TRUE, dns_rbtnodechain::level_matches, dns_rbtnodechain::levels, dns_rbtnode::locknum, name, rdatasetheader::next, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, rbtdb_search_t::rbtdb, rbtdb_search_t::serial, rdatasetheader::serial, dns_rbtnode::wild, and wild.

Referenced by zone_find().

static isc_boolean_t matchparams ( rdatasetheader_t header,
rbtdb_search_t search 
) [static]

Definition at line 3654 of file rbtdb.c.

References isc_region::base, rdatasetheader::count, dns_rdata_fromregion(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), rbtdb_version::hash, INSIST, ISC_FALSE, ISC_R_SUCCESS, ISC_TRUE, rbtdb_version::iterations, isc_region::length, rbtdb_search_t::rbtdb, rbtdb_search_t::rbtversion, REQUIRE, rbtdb_version::salt, rbtdb_version::salt_length, and rdatasetheader::type.

Referenced by find_closest_nsec(), and zone_find().

static isc_result_t previous_closest_nsec ( dns_rdatatype_t  type,
rbtdb_search_t search,
dns_name_t name,
dns_name_t origin,
dns_rbtnode_t **  nodep,
dns_rbtnodechain_t nsecchain,
isc_boolean_t firstp 
) [inline, static]

Definition at line 3701 of file rbtdb.c.

References rbtdb_search_t::chain, dns_fixedname_init, dns_fixedname_name, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, dns_name_concatenate(), DNS_R_BADDB, DNS_R_NEWORIGIN, DNS_R_PARTIALMATCH, dns_rbt_findnode(), DNS_RBTFIND_NOOPTIONS, dns_rbtnodechain_current(), dns_rbtnodechain_init(), dns_rbtnodechain_prev(), ISC_FALSE, ISC_LOG_ERROR, isc_log_write(), ISC_R_NOMORE, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_result_totext(), rbtdb_search_t::rbtdb, and REQUIRE.

Referenced by find_closest_nsec().

static isc_result_t find_closest_nsec ( rbtdb_search_t search,
dns_dbnode_t **  nodep,
dns_name_t foundname,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset,
dns_rbt_t tree,
dns_db_secure_t  secure 
) [inline, static]

Definition at line 3812 of file rbtdb.c.

References bind_rdataset(), rbtdb_search_t::chain, dns_rbtnode::data, dns_fixedname_init, dns_fixedname_name, dns_name_concatenate(), DNS_R_BADDB, DNS_R_NEWORIGIN, dns_rbtnodechain_current(), dns_rbtnodechain_invalidate(), dns_rbtnodechain_last(), rdatasetheader::down, rbtdb_version::havensec3, header, IGNORE, ISC_FALSE, ISC_R_NOMORE, ISC_R_SUCCESS, isc_rwlocktype_read, ISC_TF, ISC_TRUE, dns_rbtnode::locknum, matchparams(), name, new_reference(), rdatasetheader::next, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, NONEXISTENT, rbtdb_search_t::now, origin, previous_closest_nsec(), rbtdb_search_t::rbtdb, RBTDB_RDATATYPE_SIGNSEC, RBTDB_RDATATYPE_SIGNSEC3, rbtdb_search_t::rbtversion, rbtdb_search_t::serial, rdatasetheader::serial, and rdatasetheader::type.

Referenced by zone_find().

static isc_result_t zone_find ( dns_db_t db,
dns_name_t name,
dns_dbversion_t version,
dns_rdatatype_t  type,
unsigned int  options,
isc_stdtime_t  now,
dns_dbnode_t **  nodep,
dns_name_t foundname,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 3998 of file rbtdb.c.

References activeempty(), dns_name::attributes, bind_rdataset(), rbtdb_search_t::chain, closeversion(), rbtdb_search_t::copy_name, currentversion(), dns_rbtnode::data, decrement_reference(), DNS_DBFIND_FORCENSEC, DNS_DBFIND_FORCENSEC3, DNS_DBFIND_GLUEOK, DNS_DBFIND_VALIDATEGLUE, dns_fixedname_init, dns_name_copy(), DNS_NAMEATTR_WILDCARD, DNS_R_BADDB, DNS_R_CNAME, DNS_R_EMPTYNAME, DNS_R_EMPTYWILD, DNS_R_GLUE, DNS_R_NXDOMAIN, DNS_R_NXRRSET, DNS_R_PARTIALMATCH, DNS_R_ZONECUT, dns_rbt_findnode(), DNS_RBTFIND_EMPTYDATA, dns_rbtnodechain_init(), dns_rbtnodechain_reset(), dns_rdatatype_atparent(), rdatasetheader::down, dns_rbtnode::find_callback, find_closest_nsec(), find_wildcard(), rbtdb_version::havensec3, header, IGNORE, INSIST, IS_STUB, ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_none, isc_rwlocktype_read, ISC_TRUE, dns_rbtnode::locknum, matchparams(), rbtdb_search_t::need_cleanup, new_reference(), rdatasetheader::next, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, NONEXISTENT, rbtdb_search_t::now, rbtdb_search_t::options, rbtdb_search_t::rbtdb, RBTDB_RDATATYPE_SIGCNAME, RBTDB_RDATATYPE_SIGNSEC, RBTDB_RDATATYPE_VALUE, rbtdb_search_t::rbtversion, REQUIRE, RWLOCK, RWUNLOCK, search(), rbtdb_version::secure, rdatasetheader::serial, rbtdb_version::serial, rbtdb_search_t::serial, setup_delegation(), rdatasetheader::type, UNUSED, valid_glue(), VALID_RBTDB, rbtdb_search_t::wild, wild, zone_zonecut_callback(), rbtdb_search_t::zonecut, rbtdb_search_t::zonecut_name, rbtdb_search_t::zonecut_rdataset, and rbtdb_search_t::zonecut_sigrdataset.

static isc_result_t zone_findzonecut ( dns_db_t db,
dns_name_t name,
unsigned int  options,
isc_stdtime_t  now,
dns_dbnode_t **  nodep,
dns_name_t foundname,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 4507 of file rbtdb.c.

References FATAL_ERROR, ISC_R_NOTIMPLEMENTED, and UNUSED.

static isc_result_t cache_zonecut_callback ( dns_rbtnode_t node,
dns_name_t name,
void *  arg 
) [static]

Definition at line 4528 of file rbtdb.c.

References clean_stale_headers(), dns_rbtnode::data, DNS_DBFIND_PENDINGOK, DNS_R_CONTINUE, DNS_R_PARTIALMATCH, dns_rbtnode_refcurrent, DNS_TRUST_PENDING, EXISTS, free_rdataset(), header, INSIST, ISC_LINK_LINKED, ISC_R_SUCCESS, isc_rwlocktype_read, isc_rwlocktype_write, ISC_TRUE, dns_rbtnode::locknum, mark_stale_header(), mctx, rbtdb_search_t::need_cleanup, new_reference(), rdatasetheader::next, NODE_LOCK, NODE_TRYUPGRADE, NODE_UNLOCK, rbtdb_search_t::now, rbtdb_search_t::options, rbtdb_search_t::rbtdb, RBTDB_RDATATYPE_SIGDNAME, RBTDB_VIRTUAL, rdatasetheader::rdh_ttl, REQUIRE, search(), rdatasetheader::trust, rdatasetheader::type, UNUSED, rbtdb_search_t::zonecut, rbtdb_search_t::zonecut_rdataset, and rbtdb_search_t::zonecut_sigrdataset.

Referenced by cache_find().

static isc_result_t find_deepest_zonecut ( rbtdb_search_t search,
dns_rbtnode_t node,
dns_dbnode_t **  nodep,
dns_name_t foundname,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [inline, static]

Definition at line 4643 of file rbtdb.c.

References bind_rdataset(), rbtdb_search_t::chain, clean_stale_headers(), dns_rbtnode::data, dns_name_concatenate(), dns_name_copy(), dns_name_init(), DNS_R_DELEGATION, dns_rbt_namefromnode(), dns_rbtnode_refcurrent, EXISTS, free_rdataset(), header, ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_read, isc_rwlocktype_write, ISC_TRUE, dns_rbtnodechain::level_matches, dns_rbtnodechain::levels, dns_rbtnode::locknum, mark_stale_header(), name, need_headerupdate(), new_reference(), rdatasetheader::next, NODE_LOCK, NODE_TRYUPGRADE, NODE_UNLOCK, rbtdb_search_t::now, POST, rbtdb_search_t::rbtdb, RBTDB_RDATATYPE_SIGNS, RBTDB_VIRTUAL, rdatasetheader::rdh_ttl, rdatasetheader::type, and update_header().

Referenced by cache_find(), and cache_findzonecut().

static isc_result_t find_coveringnsec ( rbtdb_search_t search,
dns_dbnode_t **  nodep,
isc_stdtime_t  now,
dns_name_t foundname,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 4816 of file rbtdb.c.

References bind_rdataset(), rbtdb_search_t::chain, clean_stale_headers(), dns_rbtnode::data, dns_fixedname_init, dns_fixedname_name, dns_name_concatenate(), DNS_R_COVERINGNSEC, dns_rbtnode_refcurrent, dns_rbtnodechain_current(), dns_rbtnodechain_prev(), free_rdataset(), header, ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_read, isc_rwlocktype_write, ISC_TRUE, dns_rbtnode::locknum, mark_stale_header(), name, new_reference(), rdatasetheader::next, rdatasetheader::node, NODE_LOCK, NODE_TRYUPGRADE, NODE_UNLOCK, NONEXISTENT, origin, rbtdb_search_t::rbtdb, RBTDB_RDATATYPE_BASE, RBTDB_RDATATYPE_VALUE, RBTDB_VIRTUAL, rdatasetheader::rdh_ttl, and rdatasetheader::type.

Referenced by cache_find().

static void rpz_attach ( dns_db_t db,
dns_rpz_zones_t rpzs,
dns_rpz_num_t  rpz_num 
) [static]

Definition at line 4937 of file rbtdb.c.

References dns_rpz_attach_rpzs(), DNS_RPZ_INVALID_NUM, isc_rwlocktype_write, REQUIRE, RWLOCK, RWUNLOCK, and VALID_RBTDB.

static isc_result_t rpz_ready ( dns_db_t db  )  [static]

Definition at line 4954 of file rbtdb.c.

References DNS_RPZ_INVALID_NUM, dns_rpz_ready(), INSIST, ISC_R_SUCCESS, isc_rwlocktype_write, REQUIRE, RWLOCK, RWUNLOCK, and VALID_RBTDB.

Referenced by rpz_find_p(), and rpz_rrset_find().

static isc_result_t cache_find ( dns_db_t db,
dns_name_t name,
dns_dbversion_t version,
dns_rdatatype_t  type,
unsigned int  options,
isc_stdtime_t  now,
dns_dbnode_t **  nodep,
dns_name_t foundname,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 4974 of file rbtdb.c.

References bind_rdataset(), cache_zonecut_callback(), rbtdb_search_t::chain, clean_stale_headers(), rbtdb_search_t::copy_name, dns_rbtnode::data, decrement_reference(), DNS_DBFIND_ADDITIONALOK, DNS_DBFIND_COVERINGNSEC, DNS_DBFIND_GLUEOK, DNS_DBFIND_PENDINGOK, dns_fixedname_init, DNS_R_CNAME, DNS_R_COVERINGNSEC, DNS_R_DELEGATION, DNS_R_NCACHENXDOMAIN, DNS_R_NCACHENXRRSET, DNS_R_PARTIALMATCH, dns_rbt_findnode(), DNS_RBTFIND_EMPTYDATA, dns_rbtnode_refcurrent, dns_rbtnodechain_init(), dns_rbtnodechain_reset(), DNS_TRUST_ADDITIONAL, dns_trust_glue, DNS_TRUST_PENDING, EXISTS, find_coveringnsec(), find_deepest_zonecut(), free_rdataset(), header, INSIST, ISC_FALSE, ISC_LINK_LINKED, ISC_R_SUCCESS, isc_rwlocktype_none, isc_rwlocktype_read, isc_rwlocktype_write, isc_stdtime_get(), ISC_TRUE, dns_rbtnode::locknum, mark_stale_header(), mctx, rbtdb_search_t::need_cleanup, need_headerupdate(), NEGATIVE, new_reference(), rdatasetheader::next, rdatasetheader::node, NODE_LOCK, NODE_TRYUPGRADE, NODE_UNLOCK, rbtdb_search_t::now, NXDOMAIN, rbtdb_search_t::options, POST, rbtdb_search_t::rbtdb, RBTDB_RDATATYPE_BASE, RBTDB_RDATATYPE_NCACHEANY, RBTDB_RDATATYPE_SIGCNAME, RBTDB_RDATATYPE_SIGNS, RBTDB_RDATATYPE_VALUE, RBTDB_VIRTUAL, rbtdb_search_t::rbtversion, rdatasetheader::rdh_ttl, REQUIRE, RWLOCK, RWUNLOCK, search(), rbtdb_search_t::serial, setup_delegation(), rdatasetheader::trust, rdatasetheader::type, UNUSED, update(), update_cachestats(), update_header(), VALID_RBTDB, rbtdb_search_t::wild, rbtdb_search_t::zonecut, and rbtdb_search_t::zonecut_name.

static isc_result_t cache_findzonecut ( dns_db_t db,
dns_name_t name,
unsigned int  options,
isc_stdtime_t  now,
dns_dbnode_t **  nodep,
dns_name_t foundname,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 5319 of file rbtdb.c.

References bind_rdataset(), rbtdb_search_t::chain, clean_stale_headers(), rbtdb_search_t::copy_name, dns_rbtnode::data, DNS_DBFIND_NOEXACT, dns_fixedname_init, DNS_R_DELEGATION, DNS_R_PARTIALMATCH, dns_rbt_findnode(), DNS_RBTFIND_EMPTYDATA, DNS_RBTFIND_NOEXACT, dns_rbtnode_refcurrent, dns_rbtnodechain_init(), dns_rbtnodechain_reset(), EXISTS, find_deepest_zonecut(), free_rdataset(), header, INSIST, ISC_FALSE, ISC_LINK_LINKED, ISC_R_SUCCESS, isc_rwlocktype_read, isc_rwlocktype_write, isc_stdtime_get(), dns_rbtnode::locknum, mark_stale_header(), mctx, rbtdb_search_t::need_cleanup, need_headerupdate(), new_reference(), rdatasetheader::next, rdatasetheader::node, NODE_LOCK, NODE_TRYUPGRADE, NODE_UNLOCK, rbtdb_search_t::now, rbtdb_search_t::options, POST, rbtdb_search_t::rbtdb, RBTDB_RDATATYPE_SIGNS, RBTDB_VIRTUAL, rbtdb_search_t::rbtversion, rdatasetheader::rdh_ttl, REQUIRE, RWLOCK, RWUNLOCK, search(), rbtdb_search_t::serial, rdatasetheader::type, update_header(), VALID_RBTDB, rbtdb_search_t::wild, rbtdb_search_t::zonecut, and rbtdb_search_t::zonecut_name.

static void attachnode ( dns_db_t db,
dns_dbnode_t source,
dns_dbnode_t **  targetp 
) [static]

Definition at line 5493 of file rbtdb.c.

References dns_rbtnode_refincrement, INSIST, dns_rbtnode::locknum, rdatasetheader::node, NODE_STRONGLOCK, NODE_STRONGUNLOCK, REQUIRE, and VALID_RBTDB.

static void detachnode ( dns_db_t db,
dns_dbnode_t **  targetp 
) [static]

Definition at line 5510 of file rbtdb.c.

References decrement_reference(), dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, dns_name_dynamic(), dns_name_format(), DNS_NAME_FORMATSIZE, rbtdb_nodelock_t::exiting, free_rbtdb(), ISC_FALSE, ISC_LOG_DEBUG, isc_log_write(), isc_refcount_current, isc_rwlocktype_none, isc_rwlocktype_read, isc_rwlocktype_write, ISC_TRUE, rbtdb_nodelock_t::lock, dns_rbtnode::locknum, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, RBTDB_LOCK, RBTDB_UNLOCK, rbtdb_nodelock_t::references, REQUIRE, and VALID_RBTDB.

static isc_result_t expirenode ( dns_db_t db,
dns_dbnode_t node,
isc_stdtime_t  now 
) [static]

Definition at line 5559 of file rbtdb.c.

References dns_rbtnode::data, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, DNS_NAME_FORMATSIZE, dns_rbt_formatnodename(), dns_rbtnode::down, header, ISC_FALSE, ISC_LOG_DEBUG, isc_log_wouldlog(), isc_log_write(), isc_mem_isovermem(), ISC_R_SUCCESS, isc_random_get(), isc_rwlocktype_write, isc_stdtime_get(), ISC_TF, dns_rbtnode::locknum, mark_stale_header(), rdatasetheader::next, NODE_LOCK, NODE_UNLOCK, RBTDB_VIRTUAL, rdatasetheader::rdh_ttl, REQUIRE, RETAIN, set_ttl(), and VALID_RBTDB.

Referenced by dbiterator_current().

static void printnode ( dns_db_t db,
dns_dbnode_t node,
FILE *  out 
) [static]

Definition at line 5657 of file rbtdb.c.

References rdatasetheader::attributes, dns_rbtnode::data, dns_rbtnode_refcurrent, rdatasetheader::down, ISC_FALSE, isc_rwlocktype_read, ISC_TRUE, dns_rbtnode::locknum, rdatasetheader::next, NODE_LOCK, NODE_UNLOCK, rdatasetheader::rdh_ttl, REQUIRE, rdatasetheader::resign, rdatasetheader::serial, rdatasetheader::trust, rdatasetheader::type, and VALID_RBTDB.

static isc_result_t createiterator ( dns_db_t db,
unsigned int  options,
dns_dbiterator_t **  iteratorp 
) [static]

Definition at line 5702 of file rbtdb.c.

References rbtdb_dbiterator::chain, dns_dbiterator::cleaning, rbtdb_dbiterator::common, rbtdb_dbiterator::current, dns_dbiterator::db, dbiterator_methods, rbtdb_dbiterator::delete, rbtdb_dbiterator::deletions, dns_db_attach(), DNS_DB_NONSEC3, DNS_DB_NSEC3ONLY, DNS_DB_RELATIVENAMES, DNS_DBITERATOR_MAGIC, dns_fixedname_init, dns_rbtnodechain_init(), ISC_FALSE, isc_mem_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlocktype_none, ISC_TF, ISC_TRUE, dns_dbiterator::magic, dns_db::mctx, dns_dbiterator::methods, rbtdb_dbiterator::name, rbtdb_dbiterator::node, rbtdb_dbiterator::nonsec3, rbtdb_dbiterator::nsec3chain, rbtdb_dbiterator::nsec3only, rbtdb_dbiterator::origin, rbtdb_dbiterator::paused, dns_dbiterator::relative_names, REQUIRE, rbtdb_dbiterator::result, rbtdb_dbiterator::tree_locked, and VALID_RBTDB.

static isc_result_t zone_findrdataset ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
dns_rdatatype_t  type,
dns_rdatatype_t  covers,
isc_stdtime_t  now,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 5743 of file rbtdb.c.

References bind_rdataset(), closeversion(), currentversion(), dns_rbtnode::data, rdatasetheader::down, header, IGNORE, INSIST, ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_read, ISC_TRUE, dns_rbtnode::locknum, rdatasetheader::next, NODE_LOCK, NODE_UNLOCK, NONEXISTENT, rbtdb_version::rbtdb, RBTDB_RDATATYPE_VALUE, REQUIRE, rbtdb_version::serial, rdatasetheader::serial, rdatasetheader::type, and VALID_RBTDB.

static isc_result_t cache_findrdataset ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
dns_rdatatype_t  type,
dns_rdatatype_t  covers,
isc_stdtime_t  now,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 5830 of file rbtdb.c.

References bind_rdataset(), dns_rbtnode::data, DNS_R_NCACHENXDOMAIN, DNS_R_NCACHENXRRSET, EXISTS, header, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_read, isc_rwlocktype_write, isc_stdtime_get(), dns_rbtnode::locknum, mark_stale_header(), NEGATIVE, rdatasetheader::next, NODE_LOCK, NODE_TRYUPGRADE, NODE_UNLOCK, NXDOMAIN, RBTDB_RDATATYPE_NCACHEANY, RBTDB_RDATATYPE_VALUE, RBTDB_VIRTUAL, rdatasetheader::rdh_ttl, REQUIRE, rdatasetheader::type, UNUSED, update_cachestats(), and VALID_RBTDB.

static isc_result_t allrdatasets ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
isc_stdtime_t  now,
dns_rdatasetiter_t **  iteratorp 
) [static]

Definition at line 5925 of file rbtdb.c.

References dns_db::attributes, rbtdb_rdatasetiter::common, rbtdb_rdatasetiter::current, currentversion(), dns_rdatasetiter::db, DNS_DBATTR_CACHE, dns_rbtnode_refincrement, DNS_RDATASETITER_MAGIC, INSIST, isc_mem_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_refcount_increment, isc_stdtime_get(), dns_rbtnode::locknum, dns_rdatasetiter::magic, dns_rdatasetiter::methods, dns_rdatasetiter::node, NODE_STRONGLOCK, NODE_STRONGUNLOCK, dns_rdatasetiter::now, rbtdb_version::rbtdb, rdatasetiter_methods, rbtdb_version::references, REQUIRE, VALID_RBTDB, and dns_rdatasetiter::version.

static isc_boolean_t cname_and_other_data ( dns_rbtnode_t node,
rbtdb_serial_t  serial 
) [static]

Definition at line 5980 of file rbtdb.c.

References dns_rbtnode::data, rdatasetheader::down, header, IGNORE, ISC_FALSE, ISC_TRUE, rdatasetheader::next, NONEXISTENT, RBTDB_RDATATYPE_BASE, rdatasetheader::serial, and rdatasetheader::type.

Referenced by add32().

static isc_result_t add32 ( dns_rbtdb_t rbtdb,
dns_rbtnode_t rbtnode,
rbtdb_version_t rbtversion,
rdatasetheader_t newheader,
unsigned int  options,
isc_boolean_t  loading,
dns_rdataset_t addedrdataset,
isc_stdtime_t  now 
) [static]

Definition at line 6086 of file rbtdb.c.

References add_changed(), bind_rdataset(), cname_and_other_data(), rdatasetheader::covers, dns_rbtnode::data, rbtdb_changed::dirty, dns_rbtnode::dirty, DNS_DBADD_EXACT, DNS_DBADD_EXACTTTL, DNS_DBADD_FORCE, DNS_DBADD_MERGE, DNS_DBADD_PREFETCH, DNS_R_CNAMEANDOTHER, DNS_R_NOTEXACT, DNS_R_UNCHANGED, dns_rdataslab_equal(), dns_rdataslab_equalx(), DNS_RDATASLAB_EXACT, DNS_RDATASLAB_FORCE, dns_rdataslab_merge(), dns_trust_ultimate, rdatasetheader::down, EXISTS, free_rdataset(), header, IGNORE, init_rdataset(), INSIST, IS_CACHE, ISC_FALSE, isc_heap_insert(), ISC_LIST_PREPEND, ISC_R_NOMEMORY, ISC_R_SUCCESS, ISC_TRUE, dns_rbtnode::locknum, mark_stale_header(), NEGATIVE, rdatasetheader::next, rdatasetheader::node, NONEXISTENT, RBTDB_RDATATYPE_BASE, RBTDB_RDATATYPE_EXT, RBTDB_RDATATYPE_NCACHEANY, RBTDB_RDATATYPE_SIGDDS, RBTDB_RDATATYPE_VALUE, rdatasetheader::rdh_ttl, REQUIRE, RESIGN, resign_delete(), resign_insert(), rdatasetheader::serial, rbtdb_version::serial, set_ttl(), rdatasetheader::trust, rdatasetheader::type, and update_newheader().

Referenced by addrdataset(), deleterdataset(), and loading_addrdataset().

static isc_boolean_t delegating_type ( dns_rbtdb_t rbtdb,
dns_rbtnode_t node,
rbtdb_rdatatype_t  type 
) [inline, static]

Definition at line 6540 of file rbtdb.c.

References IS_CACHE, IS_STUB, ISC_FALSE, and ISC_TRUE.

Referenced by addrdataset(), and loading_addrdataset().

static isc_result_t addnoqname ( dns_rbtdb_t rbtdb,
rdatasetheader_t newheader,
dns_rdataset_t rdataset 
) [inline, static]

Definition at line 6556 of file rbtdb.c.

References isc_region::base, cleanup(), dns_name_dup(), dns_name_init(), dns_rdataset_disassociate(), dns_rdataset_getnoqname(), dns_rdataset_init(), dns_rdataslab_fromrdataset(), free_noqname(), isc_mem_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, mctx, noqname::name, name, noqname::neg, noqname::negsig, rdatasetheader::noqname, r, RUNTIME_CHECK, dns_rdataset::type, and noqname::type.

Referenced by addrdataset().

static isc_result_t addclosest ( dns_rbtdb_t rbtdb,
rdatasetheader_t newheader,
dns_rdataset_t rdataset 
) [inline, static]

Definition at line 6607 of file rbtdb.c.

References isc_region::base, cleanup(), rdatasetheader::closest, dns_name_dup(), dns_name_init(), dns_rdataset_disassociate(), dns_rdataset_getclosest(), dns_rdataset_init(), dns_rdataslab_fromrdataset(), free_noqname(), isc_mem_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, mctx, noqname::name, name, noqname::neg, noqname::negsig, r, RUNTIME_CHECK, dns_rdataset::type, and noqname::type.

Referenced by addrdataset().

static isc_result_t addrdataset ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
isc_stdtime_t  now,
dns_rdataset_t rdataset,
unsigned int  options,
dns_rdataset_t addedrdataset 
) [static]

Definition at line 6660 of file rbtdb.c.

References add32(), addclosest(), rdatasetheader::additional_auth, rdatasetheader::additional_glue, addnoqname(), dns_rdataset::attributes, rdatasetheader::attributes, isc_region::base, cleanup_dead_nodes(), rdatasetheader::closest, rdatasetheader::count, dns_rdataset::covers, delegating_type(), dns_fixedname_init, dns_fixedname_name, dns_rbt_addnode(), dns_rbt_fullnamefromnode(), DNS_RBT_NSEC_HAS_NSEC, DNS_RBT_NSEC_NSEC, DNS_RBT_NSEC_NSEC3, dns_rdataset_getownercase(), DNS_RDATASETATTR_CLOSEST, DNS_RDATASETATTR_NEGATIVE, DNS_RDATASETATTR_NOQNAME, DNS_RDATASETATTR_NXDOMAIN, DNS_RDATASETATTR_OPTOUT, DNS_RDATASETATTR_PREFETCH, DNS_RDATASETATTR_RESIGN, dns_rdataslab_fromrdataset(), expire_header(), expire_ttl, dns_rbtnode::find_callback, fixed, free_rdataset(), header, init_count, init_rdataset(), INSIST, IS_CACHE, ISC_FALSE, isc_heap_element(), isc_mem_isovermem(), ISC_R_EXISTS, ISC_R_SUCCESS, isc_rwlocktype_write, isc_stdtime_get(), ISC_TRUE, iszonesecure(), rdatasetheader::last_used, dns_rbtnode::locknum, name, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, rdatasetheader::noqname, dns_rbtnode::nsec, overmem_purge(), rbtdb_version::rbtdb, RBTDB_RDATATYPE_VALUE, RBTDB_VIRTUAL, RDATASET_ATTR_NEGATIVE, RDATASET_ATTR_NXDOMAIN, RDATASET_ATTR_OPTOUT, RDATASET_ATTR_PREFETCH, RDATASET_ATTR_RESIGN, RDATASET_ATTR_STATCOUNT, rdatasetheader::rdh_ttl, REQUIRE, dns_rdataset::resign, rdatasetheader::resign, RWLOCK, RWUNLOCK, rbtdb_version::serial, rdatasetheader::serial, set_ttl(), setownercase(), dns_rdataset::trust, rdatasetheader::trust, dns_rdataset::ttl, rdatasetheader::type, dns_rdataset::type, update_rrsetstats(), VALID_RBTDB, and zone_methods.

static isc_result_t subtractrdataset ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
dns_rdataset_t rdataset,
unsigned int  options,
dns_rdataset_t newrdataset 
) [static]

Definition at line 6860 of file rbtdb.c.

References add_changed(), rdatasetheader::additional_auth, rdatasetheader::additional_glue, dns_rdataset::attributes, rdatasetheader::attributes, isc_region::base, bind_rdataset(), rdatasetheader::closest, rdatasetheader::count, dns_rdataset::covers, dns_rbtnode::data, rbtdb_changed::dirty, dns_rbtnode::dirty, DNS_DBSUB_EXACT, DNS_DBSUB_WANTOLD, DNS_R_NOTEXACT, DNS_R_NXRRSET, DNS_R_UNCHANGED, DNS_RBT_NSEC_NSEC3, DNS_RDATASETATTR_RESIGN, DNS_RDATASLAB_EXACT, dns_rdataslab_fromrdataset(), dns_rdataslab_subtract(), rdatasetheader::down, EXISTS, free_rdataset(), header, IGNORE, init_count, init_rdataset(), INSIST, IS_CACHE, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlocktype_write, ISC_TRUE, iszonesecure(), rdatasetheader::last_used, dns_rbtnode::locknum, new_rdataset(), rdatasetheader::next, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, rdatasetheader::noqname, dns_rbtnode::nsec, rbtdb_version::rbtdb, RBTDB_RDATATYPE_VALUE, RDATASET_ATTR_NONEXISTENT, RDATASET_ATTR_RESIGN, rdatasetheader::rdh_ttl, REQUIRE, dns_rdataset::resign, rdatasetheader::resign, resign_delete(), rbtdb_version::serial, rdatasetheader::serial, set_ttl(), rdatasetheader::trust, dns_rdataset::ttl, rdatasetheader::type, dns_rdataset::type, update_newheader(), VALID_RBTDB, and zone_methods.

Referenced by ATF_TP_ADD_TCS().

static isc_result_t deleterdataset ( dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
dns_rdatatype_t  type,
dns_rdatatype_t  covers 
) [static]

Definition at line 7051 of file rbtdb.c.

References add32(), rdatasetheader::additional_auth, rdatasetheader::additional_glue, rdatasetheader::attributes, rdatasetheader::closest, rdatasetheader::count, DNS_DBADD_FORCE, init_rdataset(), INSIST, IS_CACHE, ISC_FALSE, ISC_R_NOMEMORY, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, isc_rwlocktype_write, iszonesecure(), rdatasetheader::last_used, dns_rbtnode::locknum, new_rdataset(), rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, rdatasetheader::noqname, rbtdb_version::rbtdb, RBTDB_RDATATYPE_VALUE, RDATASET_ATTR_NONEXISTENT, REQUIRE, rbtdb_version::serial, rdatasetheader::serial, set_ttl(), rdatasetheader::trust, rdatasetheader::type, and VALID_RBTDB.

static isc_result_t loadnode ( dns_rbtdb_t rbtdb,
dns_name_t name,
dns_rbtnode_t **  nodep,
isc_boolean_t  hasnsec 
) [static]

Definition at line 7111 of file rbtdb.c.

References dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, dns_rbt_addnode(), dns_rbt_deletenode(), DNS_RBT_NSEC_HAS_NSEC, DNS_RBT_NSEC_NSEC, dns_rpz_add(), dns_rpz_delete(), ISC_FALSE, ISC_LOG_WARNING, isc_log_write(), ISC_R_EXISTS, ISC_R_SUCCESS, isc_result_totext(), rdatasetheader::node, and dns_rbtnode::nsec.

Referenced by loading_addrdataset().

static isc_result_t loading_addrdataset ( void *  arg,
dns_name_t name,
dns_rdataset_t rdataset 
) [static]

Definition at line 7215 of file rbtdb.c.

References add32(), add_empty_wildcards(), add_wildcard_magic(), rdatasetheader::additional_auth, rdatasetheader::additional_glue, dns_rdataset::attributes, rdatasetheader::attributes, isc_region::base, rdatasetheader::closest, rdatasetheader::count, dns_rdataset::covers, delegating_type(), DNS_DBADD_MERGE, dns_name_equal(), dns_name_hash(), dns_name_init(), dns_name_iswildcard(), DNS_R_INVALIDNS, DNS_R_INVALIDNSEC3, DNS_R_NOTZONETOP, DNS_R_UNCHANGED, dns_rbt_addnode(), dns_rbt_namefromnode(), DNS_RBT_NSEC_NSEC3, DNS_RDATASETATTR_RESIGN, dns_rdataslab_fromrdataset(), dns_rbtnode::find_callback, dns_rbtnode::hashval, init_count, init_rdataset(), IS_CACHE, ISC_FALSE, ISC_R_EXISTS, ISC_R_SUCCESS, ISC_TRUE, rdatasetheader::last_used, loadnode(), dns_rbtnode::locknum, rdatasetheader::node, rdatasetheader::noqname, rbtdb_load_t::now, dns_rbtnode::nsec, rbtdb_load_t::rbtdb, RBTDB_RDATATYPE_VALUE, RDATASET_ATTR_RESIGN, dns_rdataset::resign, rdatasetheader::resign, rdatasetheader::serial, set_ttl(), setownercase(), dns_rdataset::trust, rdatasetheader::trust, dns_rdataset::ttl, rdatasetheader::type, and dns_rdataset::type.

Referenced by beginload().

static isc_result_t rbt_datafixer ( dns_rbtnode_t rbtnode,
void *  base,
size_t  filesize,
void *  arg,
isc_uint64_t crc 
) [static]

Definition at line 7323 of file rbtdb.c.

References dns_rbtnode::data, dns_rbt_serialize_align(), dns_rdataslab_size(), header, rdatasetheader::is_mmapped, isc_crc64_update(), isc_heap_insert(), ISC_R_INVALIDFILE, ISC_R_SUCCESS, dns_rbtnode::locknum, rdatasetheader::next, rdatasetheader::next_is_relative, rdatasetheader::node, rdatasetheader::node_is_relative, REQUIRE, rdatasetheader::resign, RESIGN, and rdatasetheader::serial.

Referenced by deserialize32().

static isc_result_t deserialize32 ( void *  arg,
FILE *  f,
off_t  offset 
) [static]

Definition at line 7377 of file rbtdb.c.

References delete_callback(), dns_rbt_deserialize_tree(), dns_rbt_destroy(), header, isc_file_getsizefd(), isc_file_mmap(), ISC_R_FAILURE, ISC_R_SUCCESS, MAP_FILE, rbtdb_file_header::nsec, rbtdb_file_header::nsec3, rbt_datafixer(), rbtdb_load_t::rbtdb, REQUIRE, rbtdb_file_header::tree, and VALID_RBTDB.

Referenced by beginload().

static isc_result_t beginload ( dns_db_t db,
dns_rdatacallbacks_t callbacks 
) [static]

Definition at line 7471 of file rbtdb.c.

References dns_rdatacallbacks::add, dns_rdatacallbacks::add_private, dns_rdatacallbacks::deserialize, deserialize32(), dns_rdatacallbacks::deserialize_private, DNS_CALLBACK_VALID, dns_rpz_beginload(), IS_CACHE, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlocktype_write, isc_stdtime_get(), loading_addrdataset(), rbtdb_load_t::now, rbtdb_load_t::rbtdb, RBTDB_ATTR_LOADED, RBTDB_ATTR_LOADING, RBTDB_LOCK, RBTDB_UNLOCK, REQUIRE, and VALID_RBTDB.

static isc_result_t endload ( dns_db_t db,
dns_rdatacallbacks_t callbacks 
) [static]

Definition at line 7518 of file rbtdb.c.

References dns_rdatacallbacks::add, dns_rdatacallbacks::add_private, dns_rdatacallbacks::deserialize, dns_rdatacallbacks::deserialize_private, DNS_CALLBACK_VALID, IS_CACHE, isc_mem_put, ISC_R_SUCCESS, isc_rwlocktype_write, iszonesecure(), rbtdb_load_t::rbtdb, RBTDB_ATTR_LOADED, RBTDB_ATTR_LOADING, RBTDB_LOCK, RBTDB_UNLOCK, REQUIRE, and VALID_RBTDB.

static isc_result_t rbt_datawriter ( FILE *  rbtfile,
unsigned char *  data,
void *  arg,
isc_uint64_t crc 
) [static]

Definition at line 7560 of file rbtdb.c.

References CHECK, dns_rbt_serialize_align(), dns_rdataslab_size(), rdatasetheader::down, header, IGNORE, isc_crc64_update(), ISC_R_RANGE, ISC_R_SUCCESS, isc_stdio_tell(), isc_stdio_write(), rdatasetheader::next, rdatasetheader::next_is_relative, rdatasetheader::node, rdatasetheader::node_is_relative, NONEXISTENT, REQUIRE, rbtdb_version::serial, rdatasetheader::serial, and version.

Referenced by serialize().

static isc_result_t rbtdb_zero_header ( FILE *  rbtfile  )  [static]

Definition at line 7655 of file rbtdb.c.

References buffer, isc_stdio_write(), and RBTDB_HEADER_LENGTH.

Referenced by serialize().

static void init_file_version ( void   )  [static]

Definition at line 7669 of file rbtdb.c.

References dns_major, dns_mapapi, FILE_VERSION, and INSIST.

Referenced by rbtdb_write_header().

static isc_result_t rbtdb_write_header ( FILE *  rbtfile,
off_t  tree_location,
off_t  nsec_location,
off_t  nsec3_location 
) [static]

Definition at line 7685 of file rbtdb.c.

References rbtdb_file_header::bigendian, FILE_VERSION, header, init_file_version(), isc_once_do, ISC_R_SUCCESS, isc_stdio_write(), rbtdb_file_header::nsec, rbtdb_file_header::nsec3, once, rbtdb_file_header::ptrsize, RUNTIME_CHECK, rbtdb_file_header::tree, rbtdb_file_header::version1, and rbtdb_file_header::version2.

Referenced by serialize().

static isc_result_t serialize ( dns_db_t db,
dns_dbversion_t ver,
FILE *  rbtfile 
) [static]

Definition at line 7709 of file rbtdb.c.

References CHECK, dns_rbt_serialize_tree(), isc_file_isplainfilefd(), isc_stdio_seek(), isc_stdio_tell(), rbt_datawriter(), rbtdb_write_header(), rbtdb_zero_header(), REQUIRE, VALID_RBTDB, and version.

Referenced by ATF_TP_ADD_TCS().

static isc_result_t dump ( dns_db_t db,
dns_dbversion_t version,
const char *  filename,
dns_masterformat_t  masterformat 
) [static]

Definition at line 7752 of file rbtdb.c.

References dns_master_dump2(), dns_master_style_default, INSIST, rbtdb_version::rbtdb, REQUIRE, and VALID_RBTDB.

Referenced by ATF_TC_BODY(), ATF_TP_ADD_TCS(), and ns_server_nta().

static isc_boolean_t issecure ( dns_db_t db  )  [static]

Definition at line 7786 of file rbtdb.c.

References isc_rwlocktype_read, ISC_TF, REQUIRE, RWLOCK, RWUNLOCK, secure(), and VALID_RBTDB.

static isc_boolean_t isdnssec ( dns_db_t db  )  [static]

Definition at line 7802 of file rbtdb.c.

References isc_rwlocktype_read, ISC_TF, REQUIRE, RWLOCK, RWUNLOCK, and VALID_RBTDB.

Referenced by update_action().

static unsigned int nodecount ( dns_db_t db  )  [static]

Definition at line 7818 of file rbtdb.c.

References rdatasetheader::count, dns_rbt_nodecount(), isc_rwlocktype_read, REQUIRE, RWLOCK, RWUNLOCK, and VALID_RBTDB.

Referenced by dns_rbt_printdot().

static unsigned int hashsize ( dns_db_t db  )  [static]

Definition at line 7834 of file rbtdb.c.

References rdatasetheader::count, dns_rbt_hashsize(), isc_rwlocktype_read, REQUIRE, RWLOCK, RWUNLOCK, and VALID_RBTDB.

static void settask ( dns_db_t db,
isc_task_t task 
) [static]

Definition at line 7850 of file rbtdb.c.

References isc_rwlocktype_write, isc_task_attach(), isc_task_detach(), RBTDB_LOCK, RBTDB_UNLOCK, REQUIRE, and VALID_RBTDB.

static isc_boolean_t ispersistent ( dns_db_t db  )  [static]

Definition at line 7866 of file rbtdb.c.

References ISC_FALSE, and UNUSED.

static isc_result_t getoriginnode ( dns_db_t db,
dns_dbnode_t **  nodep 
) [static]

Definition at line 7872 of file rbtdb.c.

References INSIST, IS_CACHE, ISC_R_NOTFOUND, ISC_R_SUCCESS, dns_rbtnode::locknum, new_reference(), NODE_STRONGLOCK, NODE_STRONGUNLOCK, REQUIRE, and VALID_RBTDB.

Referenced by ATF_TP_ADD_TCS().

static isc_result_t getnsec3parameters ( dns_db_t db,
dns_dbversion_t version,
dns_hash_t hash,
isc_uint8_t flags,
isc_uint16_t iterations,
unsigned char *  salt,
size_t *  salt_length 
) [static]

Definition at line 7897 of file rbtdb.c.

References rbtdb_version::flags, rbtdb_version::hash, rbtdb_version::havensec3, INSIST, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_read, rbtdb_version::iterations, rbtdb_version::rbtdb, REQUIRE, RWLOCK, RWUNLOCK, rbtdb_version::salt, rbtdb_version::salt_length, and VALID_RBTDB.

Referenced by ATF_TC_BODY(), and ATF_TP_ADD_TCS().

static isc_result_t setsigningtime ( dns_db_t db,
dns_rdataset_t rdataset,
isc_stdtime_t  resign 
) [static]

Definition at line 7937 of file rbtdb.c.

References rdatasetheader::attributes, header, rdatasetheader::heap_index, INSIST, IS_CACHE, isc_heap_decreased(), isc_heap_delete(), isc_heap_increased(), ISC_R_SUCCESS, isc_rwlocktype_write, dns_rbtnode::locknum, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, dns_rdataset::private3, RDATASET_ATTR_RESIGN, REQUIRE, RESIGN, rdatasetheader::resign, resign_insert(), and VALID_RBTDB.

static isc_result_t getsigningtime ( dns_db_t db,
dns_rdataset_t rdataset,
dns_name_t foundname 
) [static]

Definition at line 7977 of file rbtdb.c.

References bind_rdataset(), dns_rbt_fullnamefromnode(), header, isc_heap_element(), ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_rwlocktype_read, isc_serial_lt(), dns_rbtnode::locknum, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, REQUIRE, rdatasetheader::resign, RWLOCK, RWUNLOCK, and VALID_RBTDB.

static void resigned ( dns_db_t db,
dns_rdataset_t rdataset,
dns_dbversion_t version 
) [static]

Definition at line 8030 of file rbtdb.c.

References header, rdatasetheader::heap_index, INSIST, isc_rwlocktype_write, dns_rbtnode::locknum, dns_rdataset::methods, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, dns_rdataset::private2, dns_rdataset::private3, rbtdb_version::rbtdb, rdataset_methods, REQUIRE, resign_delete(), RWLOCK, RWUNLOCK, VALID_RBTDB, and rbtdb_version::writer.

Referenced by ATF_TC_BODY(), and ATF_TP_ADD_TCS().

static isc_result_t setcachestats ( dns_db_t db,
isc_stats_t stats 
) [static]

Definition at line 8068 of file rbtdb.c.

References IS_CACHE, ISC_R_SUCCESS, isc_stats_attach(), REQUIRE, and VALID_RBTDB.

static dns_stats_t* getrrsetstats ( dns_db_t db  )  [static]

Definition at line 8080 of file rbtdb.c.

References IS_CACHE, REQUIRE, and VALID_RBTDB.

isc_result_t dns_rbtdb_create ( isc_mem_t mctx,
dns_name_t base,
dns_dbtype_t  type,
dns_rdataclass_t  rdclass,
unsigned int  argc,
char *  argv[],
void *  driverarg,
dns_db_t **  dbp 
)

Create a new database of type "rbt" (or "rbt64"). Called via dns_db_create(); see documentation for that function for more details.

If argv[0] is set, it points to a valid memory context to be used for allocation of heap memory. Generally this is used for cache databases only.

Requires:

Definition at line 8187 of file rbtdb.c.

References allocate_version(), cache_methods, DEFAULT_CACHE_NODE_LOCK_COUNT, DEFAULT_NODE_LOCK_COUNT, delete_callback(), DNS_DB_MAGIC, DNS_DBATTR_CACHE, DNS_DBATTR_STUB, dns_dbtype_cache, dns_dbtype_stub, dns_name_dupwithoffsets(), dns_name_hash(), dns_name_init(), dns_rbt_addnode(), dns_rbt_create(), DNS_RBT_LOCKLENGTH, dns_rbt_namefromnode(), DNS_RBT_NSEC_NORMAL, DNS_RBT_NSEC_NSEC3, dns_rdatasetstats_create(), DNS_RPZ_INVALID_NUM, dns_stats_detach(), free_rbtdb(), dns_rbtnode::hashval, INSIST, IS_CACHE, ISC_FALSE, isc_heap_create(), isc_heap_destroy(), ISC_LIST_INIT, isc_mem_attach(), isc_mem_get, isc_mem_put, isc_ondestroy_init(), ISC_R_EXISTS, ISC_R_NOMEMORY, ISC_R_RANGE, ISC_R_SUCCESS, isc_refcount_decrement, isc_refcount_destroy, isc_refcount_init(), isc_rwlock_destroy(), isc_rwlock_init(), ISC_TRUE, dns_rbtnode::locknum, mctx, name, NODE_DESTROYLOCK, NODE_INITLOCK, dns_rbtnode::nsec, origin, PREPEND, RBTDB_DESTROYLOCK, RBTDB_INITLOCK, RBTDB_MAGIC, rdclass, resign_sooner(), set_index(), sooner(), ttl_sooner(), rdatasetheader::type, UNUSED, and zone_methods.

Referenced by ISC_LIST().

static void reference_iter_node ( rbtdb_dbiterator_t rbtdbiter  )  [inline, static]

Definition at line 8983 of file rbtdb.c.

References rbtdb_dbiterator::common, dns_dbiterator::db, INSIST, isc_rwlocktype_none, rbtdb_dbiterator::node, rdatasetheader::node, reactivate_node(), and rbtdb_dbiterator::tree_locked.

Referenced by dbiterator_first(), dbiterator_last(), dbiterator_next(), dbiterator_prev(), and dbiterator_seek().

static void dereference_iter_node ( rbtdb_dbiterator_t rbtdbiter  )  [inline, static]

Definition at line 8995 of file rbtdb.c.

References rbtdb_dbiterator::common, dns_dbiterator::db, decrement_reference(), ISC_FALSE, isc_rwlocktype_read, dns_rbtnode::locknum, rbtdb_dbiterator::node, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, and rbtdb_dbiterator::tree_locked.

Referenced by dbiterator_destroy(), dbiterator_first(), dbiterator_last(), dbiterator_next(), dbiterator_prev(), and dbiterator_seek().

static void flush_deletions ( rbtdb_dbiterator_t rbtdbiter  )  [static]

Definition at line 9013 of file rbtdb.c.

References rbtdb_dbiterator::common, dns_dbiterator::db, decrement_reference(), rbtdb_dbiterator::delete, rbtdb_dbiterator::deletions, dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, dns_rbt_nodecount(), ISC_FALSE, ISC_LOG_DEBUG, isc_log_write(), isc_rwlocktype_none, isc_rwlocktype_read, isc_rwlocktype_write, ISC_TRUE, dns_rbtnode::locknum, rdatasetheader::node, NODE_LOCK, NODE_UNLOCK, RWLOCK, RWUNLOCK, and rbtdb_dbiterator::tree_locked.

Referenced by dbiterator_current(), dbiterator_destroy(), and dbiterator_pause().

static void resume_iteration ( rbtdb_dbiterator_t rbtdbiter  )  [inline, static]

Definition at line 9065 of file rbtdb.c.

References rbtdb_dbiterator::common, dns_dbiterator::db, ISC_FALSE, isc_rwlocktype_none, isc_rwlocktype_read, rbtdb_dbiterator::paused, REQUIRE, RWLOCK, and rbtdb_dbiterator::tree_locked.

Referenced by dbiterator_current(), dbiterator_first(), dbiterator_last(), dbiterator_next(), dbiterator_prev(), and dbiterator_seek().

static void acache_callback ( dns_acacheentry_t entry,
void **  arg 
) [static]

Definition at line 9564 of file rbtdb.c.

References acache_cbarg_t, acachectl::cbarg, rdatasetheader::count, dns_acache_detachentry(), dns_db_detach(), dns_db_detachnode(), dns_rdatasetadditional_fromauth, dns_rdatasetadditional_fromglue, acachectl::entry, INSIST, isc_mem_put, isc_rwlocktype_write, dns_rbtnode::locknum, NODE_LOCK, NODE_UNLOCK, and REQUIRE.

Referenced by rdataset_setadditional().

static void acache_cancelentry ( isc_mem_t mctx,
dns_acacheentry_t entry,
acache_cbarg_t **  cbargp 
) [static]

Definition at line 9614 of file rbtdb.c.

References acache_cbarg_t, dns_acache_cancelentry(), dns_db_detach(), dns_db_detachnode(), isc_mem_put, and REQUIRE.

Referenced by rdataset_putadditional(), and rdataset_setadditional().


Variable Documentation

acache_cbarg_t

Definition at line 486 of file rbtdb.c.

Referenced by acache_callback(), acache_cancelentry(), rdataset_putadditional(), and rdataset_setadditional().

dns_db_secure_t

Definition at line 566 of file rbtdb.c.

dns_rdatasetmethods_t rdataset_methods [static]

Initial value:

Definition at line 766 of file rbtdb.c.

dns_rdatasetmethods_t slab_methods [static]

Initial value:

 {
        rdataset_disassociate,
        rdataset_first,
        rdataset_next,
        rdataset_current,
        rdataset_clone,
        rdataset_count,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL
}

Definition at line 787 of file rbtdb.c.

Referenced by rdataset_getclosest(), and rdataset_getnoqname().

dns_rdatasetitermethods_t rdatasetiter_methods [static]

Initial value:

Definition at line 814 of file rbtdb.c.

dns_dbiteratormethods_t dbiterator_methods [static]

Initial value:

Definition at line 840 of file rbtdb.c.

Referenced by createiterator().

char FILE_VERSION[32] = "\0" [static]

Definition at line 886 of file rbtdb.c.

unsigned int init_count [static]

'init_count' is used to initialize 'newheader->count' which inturn is used to determine where in the cycle rrset-order cyclic starts. We don't lock this as we don't care about simultaneous updates.

Note: Both init_count and header->count can be ISC_UINT32_MAX. The count on the returned rdataset however can't be as that indicates that the database does not implement cyclic processing.

Definition at line 899 of file rbtdb.c.

Referenced by addrdataset(), loading_addrdataset(), and subtractrdataset().

static dns_dbmethods_t zone_methods [static]

Definition at line 6657 of file rbtdb.c.

Referenced by addrdataset(), dns_rbtdb_create(), and subtractrdataset().

isc_once_t once = ISC_ONCE_INIT [static]

Definition at line 7666 of file rbtdb.c.

dns_dbmethods_t cache_methods [static]

Definition at line 8135 of file rbtdb.c.

Referenced by dns_rbtdb_create().


Generated on Tue Apr 28 17:41:12 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha