|
unbound 0.1
|
This file contains functions to read and write the cache(s) to text format. More...
#include "config.h"#include <openssl/ssl.h>#include "daemon/cachedump.h"#include "daemon/remote.h"#include "daemon/worker.h"#include "services/cache/rrset.h"#include "services/cache/dns.h"#include "services/cache/infra.h"#include "services/outside_network.h"#include "util/data/msgreply.h"#include "util/regional.h"#include "util/net_help.h"#include "util/data/dname.h"#include "util/config_file.h"#include "iterator/iterator.h"#include "iterator/iter_delegpt.h"#include "iterator/iter_utils.h"#include "iterator/iter_fwd.h"#include "iterator/iter_hints.h"#include "sldns/sbuffer.h"#include "sldns/wire2str.h"#include "sldns/str2wire.h"Data Structures | |
| struct | dump_info |
| Struct for dump information. More... | |
Functions | |
| static void | spool_txt_printf (struct config_strlist_head *txt, const char *format,...) |
| Print item to spool list. | |
| static void static void | spool_txt_string (struct config_strlist_head *txt, char *str) |
| Append to strlist at end, and log error if out of memory. | |
| static void | spool_txt_vmsg (struct config_strlist_head *txt, const char *format, va_list args) |
| Spool txt to spool list. | |
| static void | dump_rrset_line (struct config_strlist_head *txt, struct ub_packed_rrset_key *k, time_t now, size_t i) |
| dump one rrset zonefile line | |
| static void | dump_rrset (struct config_strlist_head *txt, struct ub_packed_rrset_key *k, struct packed_rrset_data *d, time_t now) |
| dump rrset key and data info | |
| static int | spool_strlist (RES *ssl, struct config_strlist *list) |
| Spool strlist to the output. | |
| static int | dump_lruhash (struct lruhash *table, void(*func)(struct lruhash_entry *, struct config_strlist_head *, void *), RES *ssl, void *arg) |
| dump lruhash cache and call callback for every item. | |
| static int | dump_slabhash (struct slabhash *sh, void(*func)(struct lruhash_entry *, struct config_strlist_head *, void *), RES *ssl, void *arg) |
| dump slabhash cache and call callback for every item. | |
| static void | dump_rrset_entry (struct lruhash_entry *e, struct config_strlist_head *txt, void *arg) |
| Dump the rrset cache entry. | |
| static int | dump_rrset_cache (RES *ssl, struct worker *worker) |
| dump rrset cache | |
| static void | dump_msg_ref (struct config_strlist_head *txt, struct ub_packed_rrset_key *k) |
| dump message to rrset reference | |
| static void | dump_msg (struct config_strlist_head *txt, struct query_info *k, struct reply_info *d, time_t now) |
| dump message entry | |
| static int | copy_msg (struct regional *region, struct lruhash_entry *e, struct query_info **k, struct reply_info **d) |
| copy msg to worker pad | |
| static void | dump_msg_entry (struct lruhash_entry *e, struct config_strlist_head *txt, void *arg) |
| Dump the msg entry. | |
| static int | dump_msg_cache (RES *ssl, struct worker *worker) |
| dump msg cache | |
| int | dump_cache (RES *ssl, struct worker *worker) |
| Dump cache(s) to text. | |
| static int | ssl_read_buf (RES *ssl, sldns_buffer *buf) |
| read a line from ssl into buffer | |
| static int | read_fixed (RES *ssl, sldns_buffer *buf, const char *str) |
| check fixed text on line | |
| static int | load_rr (RES *ssl, sldns_buffer *buf, struct regional *region, struct ub_packed_rrset_key *rk, struct packed_rrset_data *d, unsigned int i, int is_rrsig, int *go_on, time_t now) |
| load an RR into rrset | |
| static int | move_into_cache (struct ub_packed_rrset_key *k, struct packed_rrset_data *d, struct worker *worker) |
| move entry into cache | |
| static int | load_rrset (RES *ssl, sldns_buffer *buf, struct worker *worker) |
| load an rrset entry | |
| static int | load_rrset_cache (RES *ssl, struct worker *worker) |
| load rrset cache | |
| static char * | load_qinfo (char *str, struct query_info *qinfo, struct regional *region) |
| read qinfo from next three words | |
| static int | load_ref (RES *ssl, sldns_buffer *buf, struct worker *worker, struct regional *region, struct ub_packed_rrset_key **rrset, int *go_on) |
| load a msg rrset reference | |
| static int | load_msg (RES *ssl, sldns_buffer *buf, struct worker *worker) |
| load a msg entry | |
| static int | load_msg_cache (RES *ssl, struct worker *worker) |
| load msg cache | |
| int | load_cache (RES *ssl, struct worker *worker) |
| Load cache(s) from text. | |
| static void | print_dp_details (RES *ssl, struct worker *worker, struct delegpt *dp) |
| print details on a delegation point | |
| static void | print_dp_main (RES *ssl, struct delegpt *dp, struct dns_msg *msg) |
| print main dp info | |
| int | print_deleg_lookup (RES *ssl, struct worker *worker, uint8_t *nm, size_t nmlen, int ATTR_UNUSED(nmlabs)) |
This file contains functions to read and write the cache(s) to text format.
|
static |
Print item to spool list.
On alloc failure the list is as before.
References spool_txt_printf(), and spool_txt_vmsg().
Referenced by dump_msg(), dump_msg_ref(), dump_rrset(), and spool_txt_printf().
|
static |
Append to strlist at end, and log error if out of memory.
References cfg_strlist_append(), log_err(), and spool_txt_string().
Referenced by dump_msg_ref(), dump_rrset_line(), spool_txt_string(), and spool_txt_vmsg().
|
static |
Spool txt to spool list.
References spool_txt_string(), and spool_txt_vmsg().
Referenced by spool_txt_printf(), and spool_txt_vmsg().
|
static |
dump one rrset zonefile line
References dump_rrset_line(), packed_rr_to_string(), and spool_txt_string().
Referenced by dump_rrset(), and dump_rrset_line().
|
static |
dump rrset key and data info
References packed_rrset_data::count, dump_rrset(), dump_rrset_line(), packed_rrset_key::flags, ub_packed_rrset_key::id, PACKED_RRSET_NSEC_AT_APEX, ub_packed_rrset_key::rk, packed_rrset_data::rrsig_count, packed_rrset_data::security, spool_txt_printf(), packed_rrset_data::trust, and packed_rrset_data::ttl.
Referenced by dump_rrset(), dump_rrset_entry(), and print_dp_main().
|
static |
Spool strlist to the output.
References config_strlist::next, spool_strlist(), ssl_printf(), and config_strlist::str.
Referenced by dump_lruhash(), print_dp_main(), and spool_strlist().
|
static |
dump lruhash cache and call callback for every item.
References lruhash::array, config_delstrlist(), dump_lruhash(), config_strlist_head::first, lruhash_entry::hash, lruhash::lock, lruhash_bin::lock, lruhash_bin::overflow_list, lruhash_entry::overflow_next, lruhash::size_mask, and spool_strlist().
Referenced by dump_lruhash(), and dump_slabhash().
|
static |
dump slabhash cache and call callback for every item.
References slabhash::array, dump_lruhash(), dump_slabhash(), and slabhash::size.
Referenced by dump_msg_cache(), dump_rrset_cache(), and dump_slabhash().
|
static |
Dump the rrset cache entry.
References lruhash_entry::data, dump_rrset(), dump_rrset_entry(), worker::env, lruhash_entry::key, lruhash_entry::lock, module_env::now, and dump_info::worker.
Referenced by dump_rrset_cache(), and dump_rrset_entry().
|
static |
dump rrset cache
References dump_rrset_cache(), dump_rrset_entry(), dump_slabhash(), worker::env, module_env::rrset_cache, dump_info::ssl, ssl_printf(), rrset_cache::table, and dump_info::worker.
Referenced by dump_cache(), and dump_rrset_cache().
|
static |
dump message to rrset reference
References packed_rrset_key::dname, packed_rrset_key::dname_len, dump_msg_ref(), packed_rrset_key::flags, ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, sldns_wire2str_class(), sldns_wire2str_dname(), sldns_wire2str_type(), spool_txt_printf(), spool_txt_string(), and packed_rrset_key::type.
Referenced by dump_msg(), and dump_msg_ref().
|
static |
dump message entry
References reply_info::an_numrrsets, reply_info::ar_numrrsets, dump_msg(), dump_msg_ref(), reply_info::flags, reply_info::ns_numrrsets, query_info::qclass, reply_info::qdcount, query_info::qname, query_info::qname_len, query_info::qtype, reply_info::reason_bogus, reply_info::reason_bogus_str, reply_info::ref, rrset_array_lock(), rrset_array_unlock(), reply_info::rrset_count, reply_info::rrsets, reply_info::security, sldns_wire2str_class(), sldns_wire2str_dname(), sldns_wire2str_type(), spool_txt_printf(), and reply_info::ttl.
Referenced by dump_msg(), and dump_msg_entry().
|
static |
copy msg to worker pad
References copy_msg(), lruhash_entry::data, lruhash_entry::key, regional_alloc_init(), RR_COUNT_MAX, and reply_info::rrset_count.
Referenced by copy_msg(), and dump_msg_entry().
|
static |
Dump the msg entry.
References copy_msg(), dump_msg(), dump_msg_entry(), worker::env, lruhash_entry::lock, log_err(), module_env::now, regional_free_all(), worker::scratchpad, and dump_info::worker.
Referenced by dump_msg_cache(), and dump_msg_entry().
|
static |
dump msg cache
References dump_msg_cache(), dump_msg_entry(), dump_slabhash(), worker::env, module_env::msg_cache, dump_info::ssl, ssl_printf(), and dump_info::worker.
Referenced by dump_cache(), and dump_msg_cache().
| int dump_cache | ( | RES * | ssl, |
| struct worker * | worker ) |
Dump cache(s) to text.
| ssl | to print to |
| worker | worker that is available (buffers, etc) and has ptrs to the caches. |
References dump_cache(), dump_msg_cache(), dump_rrset_cache(), dump_info::ssl, and ssl_printf().
Referenced by dump_cache(), and execute_cmd().
|
static |
read a line from ssl into buffer
References sldns_buffer_begin(), sldns_buffer_capacity(), dump_info::ssl, and ssl_read_buf().
Referenced by load_msg_cache(), load_ref(), load_rr(), load_rrset_cache(), read_fixed(), and ssl_read_buf().
|
static |
check fixed text on line
References read_fixed(), sldns_buffer_begin(), dump_info::ssl, and ssl_read_buf().
Referenced by load_cache(), load_msg_cache(), load_rrset_cache(), and read_fixed().
|
static |
load an RR into rrset
References packed_rrset_key::dname, packed_rrset_key::dname_len, LDNS_RR_BUF_SIZE, LDNS_RR_TYPE_RRSIG, load_rr(), log_warn(), regional_alloc_init(), ub_packed_rrset_key::rk, packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, packed_rrset_key::rrset_class, sldns_buffer_begin(), sldns_buffer_clear(), sldns_get_errorstr_parse(), sldns_str2wire_rr_buf(), sldns_wirerr_get_class(), sldns_wirerr_get_rdatalen(), sldns_wirerr_get_rdatawl(), sldns_wirerr_get_ttl(), sldns_wirerr_get_type(), dump_info::ssl, ssl_read_buf(), and packed_rrset_key::type.
Referenced by load_rr(), and load_rrset().
|
static |
move entry into cache
References worker::alloc, alloc_special_obtain(), packed_rrset_data::count, lruhash_entry::data, packed_rrset_key::dname, packed_rrset_key::dname_len, ub_packed_rrset_key::entry, worker::env, lruhash_entry::hash, rrset_ref::id, ub_packed_rrset_key::id, rrset_ref::key, log_warn(), memdup(), move_into_cache(), module_env::now, packed_rrset_ptr_fixup(), ub_packed_rrset_key::rk, packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, module_env::rrset_cache, rrset_cache_update_unlock(), rrset_key_hash(), packed_rrset_data::rrsig_count, and ub_packed_rrset_parsedelete().
Referenced by load_rrset(), and move_into_cache().
|
static |
load an rrset entry
References packed_rrset_data::count, worker::env, packed_rrset_key::flags, load_rr(), load_rrset(), log_warn(), move_into_cache(), module_env::now, PACKED_RRSET_NSEC_AT_APEX, regional_alloc_zero(), regional_free_all(), ub_packed_rrset_key::rk, RR_COUNT_MAX, packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, packed_rrset_data::rrsig_count, worker::scratchpad, packed_rrset_data::security, sldns_buffer_begin(), packed_rrset_data::trust, and packed_rrset_data::ttl.
Referenced by load_rrset(), and load_rrset_cache().
|
static |
load rrset cache
References worker::env, load_rrset(), load_rrset_cache(), read_fixed(), module_env::scratch_buffer, sldns_buffer_begin(), and ssl_read_buf().
Referenced by load_cache(), and load_rrset_cache().
|
static |
read qinfo from next three words
References LDNS_RR_BUF_SIZE, load_qinfo(), query_info::local_alias, log_warn(), query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, regional_alloc_init(), packed_rrset_data::rr_len, sldns_get_errorstr_parse(), sldns_str2wire_rr_question_buf(), sldns_wirerr_get_class(), and sldns_wirerr_get_type().
Referenced by load_msg(), load_qinfo(), and load_ref().
|
static |
load a msg rrset reference
References ub_packed_rrset_key::entry, worker::env, load_qinfo(), load_ref(), lruhash_entry::lock, log_warn(), module_env::now, packed_rrset_copy_region(), query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, module_env::rrset_cache, rrset_cache_lookup(), sldns_buffer_begin(), and ssl_read_buf().
Referenced by load_msg(), and load_ref().
|
static |
load a msg entry
References reply_info::an_numrrsets, reply_info::ar_numrrsets, dns_cache_store(), worker::env, reply_info::flags, load_msg(), load_qinfo(), load_ref(), log_warn(), module_env::now, reply_info::ns_numrrsets, reply_info::prefetch_ttl, PREFETCH_TTL_CALC, reply_info::qdcount, reply_info::reason_bogus, reply_info::reason_bogus_str, regional_alloc_zero(), regional_free_all(), regional_strdup(), RR_COUNT_MAX, reply_info::rrset_count, reply_info::rrsets, worker::scratchpad, reply_info::security, SERVE_EXPIRED_TTL, reply_info::serve_expired_ttl, sldns_buffer_begin(), and reply_info::ttl.
Referenced by load_msg(), and load_msg_cache().
|
static |
load msg cache
References worker::env, load_msg(), load_msg_cache(), read_fixed(), module_env::scratch_buffer, sldns_buffer_begin(), and ssl_read_buf().
Referenced by load_cache(), and load_msg_cache().
| int load_cache | ( | RES * | ssl, |
| struct worker * | worker ) |
Load cache(s) from text.
| ssl | to read from |
| worker | worker that is available (buffers, etc) and has ptrs to the caches. |
References worker::env, load_cache(), load_msg_cache(), load_rrset_cache(), read_fixed(), and module_env::scratch_buffer.
Referenced by execute_cmd(), and load_cache().
print details on a delegation point
References delegpt_addr::addr, addr_to_str(), delegpt_addr::addrlen, delegpt_addr::bogus, worker::env, module_env::infra_cache, infra_get_host_rto(), infra_get_lame_rtt(), infra_host(), delegpt_addr::lame, LDNS_RR_TYPE_A, delegpt::name, delegpt::namelen, delegpt_addr::next_target, module_env::now, print_dp_details(), rtt_info::rto, rtt_notimeout(), rtt_info::rttvar, rtt_info::srtt, ssl_printf(), delegpt::target_list, and USEFUL_SERVER_TOP_TIMEOUT.
Referenced by print_dp_details().
print main dp info
References delegpt::bogus, config_delstrlist(), lruhash_entry::data, delegpt_count_addr(), delegpt_count_ns(), dump_rrset(), ub_packed_rrset_key::entry, config_strlist_head::first, print_dp_main(), dns_msg::rep, reply_info::rrset_count, reply_info::rrsets, sec_status_bogus, packed_rrset_data::security, spool_strlist(), and ssl_printf().
Referenced by print_dp_main().