|
unbound 0.1
|
This file contains the functions for an authority zone. More...
#include "config.h"#include "services/authzone.h"#include "util/data/dname.h"#include "util/data/msgparse.h"#include "util/data/msgreply.h"#include "util/data/msgencode.h"#include "util/data/packed_rrset.h"#include "util/regional.h"#include "util/net_help.h"#include "util/netevent.h"#include "util/config_file.h"#include "util/log.h"#include "util/module.h"#include "util/random.h"#include "util/timeval_func.h"#include "services/cache/dns.h"#include "services/outside_network.h"#include "services/listen_dnsport.h"#include "services/mesh.h"#include "sldns/rrdef.h"#include "sldns/pkthdr.h"#include "sldns/sbuffer.h"#include "sldns/str2wire.h"#include "sldns/wire2str.h"#include "sldns/parseutil.h"#include "sldns/keyraw.h"#include "validator/val_nsec3.h"#include "validator/val_nsec.h"#include "validator/val_secalgo.h"#include "validator/val_sigcrypt.h"#include "validator/val_anchor.h"#include "validator/val_utils.h"#include <ctype.h>Macros | |
| #define | N3HASHBUFLEN 32 |
| bytes to use for NSEC3 hash buffer. | |
| #define | MAX_CNAME_CHAIN 8 |
| max number of CNAMEs we are willing to follow (in one answer) | |
| #define | AUTH_PROBE_TIMEOUT 100 |
| timeout for probe packets for SOA | |
| #define | AUTH_PROBE_TIMEOUT_STOP 1000 |
| when to stop with SOA probes (when exponential timeouts exceed this) | |
| #define | AUTH_TRANSFER_TIMEOUT 10000 |
| #define | AUTH_TRANSFER_MAX_BACKOFF 86400 |
| #define | AUTH_HTTP_PORT 80 |
| #define | AUTH_HTTPS_PORT 443 |
| #define | MAX_INCLUDE_DEPTH 10 |
| #define | NUM_TIMEOUTS_FALLBACK_IXFR 3 |
| number of timeouts before we fallback from IXFR to AXFR, because some versions of servers (eg. | |
| #define | NUM_IXFR_BEFORE_AXFR 5 |
| number of IXFRs before an AXFR is performed, to consolidate RPZ memory. | |
| #define | AUTH_XFR_DECOMPRESS_PACKET_LIMIT 128000 |
| The max number of decompression pointers that are allowed in a received xfr packet. | |
| #define | SERIAL_BITS 32 |
Functions | |
| static void | xfr_set_timeout (struct auth_xfer *xfr, struct module_env *env, int failure, int lookup_only) |
| pick up nextprobe task to start waiting to perform transfer actions | |
| static void | xfr_probe_send_or_end (struct auth_xfer *xfr, struct module_env *env) |
| move to sending the probe packets, next if fails. | |
| static int | xfr_start_probe (struct auth_xfer *xfr, struct module_env *env, struct auth_master *spec) |
| pick up probe task with specified(or NULL) destination first, or transfer task if nothing to probe, or false if already in progress | |
| static void | probe_copy_masters_for_allow_notify (struct auth_xfer *xfr) |
| copy the master addresses from the task_probe lookups to the allow_notify list of masters | |
| void | auth_xfer_delete (struct auth_xfer *xfr) |
| delete xfer structure (not its tree entry) | |
| static struct dns_msg * | msg_create (struct regional *region, struct query_info *qinfo) |
| create new dns_msg | |
| static int | msg_grow_array (struct regional *region, struct dns_msg *msg) |
| grow rrset array by one in msg | |
| static time_t | get_rrset_ttl (struct ub_packed_rrset_key *k) |
| get ttl of rrset | |
| static struct ub_packed_rrset_key * | auth_packed_rrset_copy_region (struct auth_zone *z, struct auth_data *node, struct auth_rrset *rrset, struct regional *region) |
| Copy rrset into region from domain-datanode and packet rrset. | |
| static void | msg_ttl (struct dns_msg *msg) |
| fix up msg->rep TTL and prefetch ttl | |
| static int | msg_rrset_duplicate (struct dns_msg *msg, uint8_t *nm, size_t nmlen, uint16_t type, uint16_t dclass) |
| see if rrset is a duplicate in the answer message | |
| static int | msg_add_rrset_an (struct auth_zone *z, struct regional *region, struct dns_msg *msg, struct auth_data *node, struct auth_rrset *rrset) |
| add rrset to answer section (no auth, add rrsets yet) | |
| static int | msg_add_rrset_ns (struct auth_zone *z, struct regional *region, struct dns_msg *msg, struct auth_data *node, struct auth_rrset *rrset) |
| add rrset to authority section (no additional section rrsets yet) | |
| static int | msg_add_rrset_ar (struct auth_zone *z, struct regional *region, struct dns_msg *msg, struct auth_data *node, struct auth_rrset *rrset) |
| add rrset to additional section | |
| struct auth_zones * | auth_zones_create (void) |
| Create auth zones structure. | |
| int | auth_zone_cmp (const void *z1, const void *z2) |
| compare auth_zones for sorted rbtree | |
| int | auth_data_cmp (const void *z1, const void *z2) |
| compare auth_data for sorted rbtree | |
| int | auth_xfer_cmp (const void *z1, const void *z2) |
| compare auth_xfer for sorted rbtree | |
| static void | auth_rrset_delete (struct auth_rrset *rrset) |
| delete auth rrset node | |
| static void | auth_data_delete (struct auth_data *n) |
| delete auth data domain node | |
| static void | auth_data_del (rbnode_type *n, void *ATTR_UNUSED(arg)) |
| helper traverse to delete zones | |
| static void | auth_chunk_list_delete (struct auth_chunk *first) |
| delete chunklist | |
| static void | auth_zone_delete (struct auth_zone *z, struct auth_zones *az) |
| delete an auth zone structure (tree remove must be done elsewhere) | |
| struct auth_zone * | auth_zone_create (struct auth_zones *az, uint8_t *nm, size_t nmlen, uint16_t dclass) |
| create an auth zone. | |
| struct auth_zone * | auth_zone_find (struct auth_zones *az, uint8_t *nm, size_t nmlen, uint16_t dclass) |
| find an auth zone by name (exact match by name or NULL returned) | |
| struct auth_xfer * | auth_xfer_find (struct auth_zones *az, uint8_t *nm, size_t nmlen, uint16_t dclass) |
| find an xfer zone by name (exact match by name or NULL returned) | |
| static int | auth_zone_find_less_equal (struct auth_zones *az, uint8_t *nm, size_t nmlen, uint16_t dclass, struct auth_zone **z) |
| find an auth zone or sorted less-or-equal, return true if exact | |
| struct auth_zone * | auth_zones_find_zone (struct auth_zones *az, uint8_t *name, size_t name_len, uint16_t dclass) |
| find the auth zone that is above the given name | |
| static struct auth_zone * | auth_zones_find_or_add_zone (struct auth_zones *az, char *name) |
| find or create zone with name str. | |
| static struct auth_xfer * | auth_zones_find_or_add_xfer (struct auth_zones *az, struct auth_zone *z) |
| find or create xfer zone with name str. | |
| int | auth_zone_set_zonefile (struct auth_zone *z, char *zonefile) |
| set auth zone zonefile string. | |
| int | auth_zone_set_fallback (struct auth_zone *z, char *fallbackstr) |
| set auth zone fallback. | |
| static struct auth_data * | az_domain_create (struct auth_zone *z, uint8_t *nm, size_t nmlen) |
| create domain with the given name | |
| static struct auth_data * | az_find_name (struct auth_zone *z, uint8_t *nm, size_t nmlen) |
| find domain with exactly the given name | |
| static void | az_find_domain (struct auth_zone *z, struct query_info *qinfo, int *node_exact, struct auth_data **node) |
| Find domain name (or closest match). | |
| static struct auth_data * | az_domain_find_or_create (struct auth_zone *z, uint8_t *dname, size_t dname_len) |
| find or create domain with name in zone | |
| static struct auth_rrset * | az_domain_rrset (struct auth_data *n, uint16_t t) |
| find rrset of given type in the domain | |
| static void | domain_remove_rrset (struct auth_data *node, uint16_t rr_type) |
| remove rrset of this type from domain | |
| static int | az_rrset_find_rrsig (struct packed_rrset_data *d, uint8_t *rdata, size_t len, size_t *index) |
| find an rrsig index in the rrset. | |
| static int | rdata_duplicate (struct packed_rrset_data *d, uint8_t *rdata, size_t len) |
| see if rdata is duplicate | |
| static uint16_t | rrsig_rdata_get_type_covered (uint8_t *rdata, size_t rdatalen) |
| get rrsig type covered from rdata. | |
| static int | rrset_remove_rr (struct auth_rrset *rrset, size_t index) |
| remove RR from existing RRset. | |
| static int | rrset_add_rr (struct auth_rrset *rrset, uint32_t rr_ttl, uint8_t *rdata, size_t rdatalen, int insert_sig) |
| add RR to existing RRset. | |
| static struct auth_rrset * | rrset_create (struct auth_data *node, uint16_t rr_type, uint32_t rr_ttl, uint8_t *rdata, size_t rdatalen) |
| Create new rrset for node with packed rrset with one RR element. | |
| static size_t | rrsig_num_that_cover (struct auth_rrset *rrsig, uint16_t rr_type, size_t *sigsz) |
| count number (and size) of rrsigs that cover a type | |
| static int | rrset_moveover_rrsigs (struct auth_data *node, uint16_t rr_type, struct auth_rrset *rrset, struct auth_rrset *rrsig) |
| See if rrsig set has covered sigs for rrset and move them over. | |
| static int | rrsigs_copy_from_rrset_to_rrsigset (struct auth_rrset *rrset, struct auth_rrset *rrsigset) |
| copy the rrsigs from the rrset to the rrsig rrset, because the rrset is going to be deleted. | |
| static int | az_domain_add_rr (struct auth_data *node, uint16_t rr_type, uint32_t rr_ttl, uint8_t *rdata, size_t rdatalen, int *duplicate) |
| Add rr to node, ignores duplicate RRs, rdata points to buffer with rdatalen octets, starts with 2bytelength. | |
| static int | az_insert_rr (struct auth_zone *z, uint8_t *rr, size_t rr_len, size_t dname_len, int *duplicate) |
| insert RR into zone, ignore duplicates | |
| static int | az_domain_remove_rr (struct auth_data *node, uint16_t rr_type, uint8_t *rdata, size_t rdatalen, int *nonexist) |
| Remove rr from node, ignores nonexisting RRs, rdata points to buffer with rdatalen octets, starts with 2bytelength. | |
| static int | az_remove_rr (struct auth_zone *z, uint8_t *rr, size_t rr_len, size_t dname_len, int *nonexist) |
| remove RR from zone, ignore if it does not exist, false on alloc failure | |
| static int | decompress_rr_into_buffer (struct sldns_buffer *buf, uint8_t *pkt, size_t pktlen, uint8_t *dname, uint16_t rr_type, uint16_t rr_class, uint32_t rr_ttl, uint8_t *rr_data, uint16_t rr_rdlen, int *budget, int limit) |
| decompress an RR into the buffer where it'll be an uncompressed RR with uncompressed dname and uncompressed rdata (dnames) | |
| static int | az_insert_rr_decompress (struct auth_zone *z, uint8_t *pkt, size_t pktlen, struct sldns_buffer *scratch_buffer, uint8_t *dname, uint16_t rr_type, uint16_t rr_class, uint32_t rr_ttl, uint8_t *rr_data, uint16_t rr_rdlen, int *duplicate, int *budget, int limit) |
| insert RR into zone, from packet, decompress RR, if duplicate is nonNULL set the flag but otherwise ignore duplicates | |
| static int | az_remove_rr_decompress (struct auth_zone *z, uint8_t *pkt, size_t pktlen, struct sldns_buffer *scratch_buffer, uint8_t *dname, uint16_t rr_type, uint16_t rr_class, uint32_t rr_ttl, uint8_t *rr_data, uint16_t rr_rdlen, int *nonexist, int *budget, int limit) |
| remove RR from zone, from packet, decompress RR, if nonexist is nonNULL set the flag but otherwise ignore nonexisting entries | |
| static int | az_parse_file (struct auth_zone *z, FILE *in, uint8_t *rr, size_t rrbuflen, struct sldns_file_parse_state *state, char *fname, int depth, struct config_file *cfg) |
| Parse zonefile. | |
| void | auth_zone_clear_data (struct auth_zone *z) |
| Clear data in auth zone. | |
| int | auth_zone_read_zonefile (struct auth_zone *z, struct config_file *cfg) |
| read auth zone from zonefile. | |
| static int | write_out (FILE *out, const char *str, size_t len) |
| write buffer to file and check return codes | |
| static int | auth_rr_to_string (uint8_t *nm, size_t nmlen, uint16_t tp, uint16_t cl, struct packed_rrset_data *data, size_t i, char *s, size_t buflen) |
| convert auth rr to string | |
| static int | auth_zone_write_rrset (struct auth_zone *z, struct auth_data *node, struct auth_rrset *r, FILE *out) |
| write rrset to file | |
| static int | auth_zone_write_domain (struct auth_zone *z, struct auth_data *n, FILE *out) |
| write domain to file | |
| int | auth_zone_write_file (struct auth_zone *z, const char *fname) |
| Write auth zone data to file, in zonefile format. | |
| static void | zonemd_offline_verify (struct auth_zone *z, struct module_env *env_for_val, struct module_stack *mods) |
| offline verify for zonemd, while reading a zone file to immediately spot bad hashes in zonefile as they are read. | |
| static int | auth_zones_read_zones (struct auth_zones *az, struct config_file *cfg, struct module_env *env, struct module_stack *mods) |
| read all auth zones from file (if they have) | |
| static int | zonemd_fetch_parameters (struct auth_rrset *zonemd_rrset, size_t i, uint32_t *serial, int *scheme, int *hashalgo, uint8_t **hash, size_t *hashlen) |
| fetch the content of a ZONEMD RR from the rdata | |
| static int | zonemd_is_duplicate_scheme_hash (struct auth_rrset *zonemd_rrset, size_t index, int scheme, int hashalgo) |
| See if the ZONEMD scheme, hash occurs more than once. | |
| static int | auth_zone_zonemd_check_hash (struct auth_zone *z, struct module_env *env, char **reason) |
| Check ZONEMDs if present for the auth zone. | |
| struct auth_rrset * | auth_zone_get_soa_rrset (struct auth_zone *z) |
| find the apex SOA RRset, if it exists | |
| int | auth_zone_get_serial (struct auth_zone *z, uint32_t *serial) |
| find serial number of zone or false if none | |
| int | xfr_find_soa (struct auth_zone *z, struct auth_xfer *xfr) |
| Find auth_zone SOA and populate the values in xfr(soa values). | |
| static int | auth_xfer_setup (struct auth_zone *z, struct auth_xfer *x) |
| Setup auth_xfer zone This populates the have_zone, soa values, and so on times. | |
| static int | auth_zones_setup_zones (struct auth_zones *az) |
| Setup all zones. | |
| static int | auth_zones_cfg (struct auth_zones *az, struct config_auth *c) |
| set config items and create zones | |
| static void | az_setall_deleted (struct auth_zones *az) |
| set all auth zones deleted, then in auth_zones_cfg, it marks them as nondeleted (if they are still in the config), and then later we can find deleted zones | |
| static void | az_delete_deleted_zones (struct auth_zones *az) |
| find zones that are marked deleted and delete them. | |
| int | auth_zones_apply_cfg (struct auth_zones *az, struct config_file *cfg, int setup, int readauth, int *is_rpz, struct module_env *env, struct module_stack *mods) |
| Apply configuration to auth zones. | |
| static void | auth_chunks_delete (struct auth_transfer *at) |
| delete chunks | |
| static void | auth_free_master_addrs (struct auth_addr *list) |
| free master addr list | |
| static void | auth_free_masters (struct auth_master *list) |
| free the masters list | |
| static void | auth_zone_del (rbnode_type *n, void *ATTR_UNUSED(arg)) |
| helper traverse to delete zones | |
| static void | auth_xfer_del (rbnode_type *n, void *ATTR_UNUSED(arg)) |
| helper traverse to delete xfer zones | |
| void | auth_zones_delete (struct auth_zones *az) |
| Delete auth zones structure. | |
| static int | domain_has_only_nsec3 (struct auth_data *n) |
| true if domain has only nsec3 | |
| static struct auth_data * | az_find_wildcard_domain (struct auth_zone *z, uint8_t *nm, size_t nmlen) |
| see if the domain has a wildcard child '*.domain' | |
| static struct auth_data * | az_find_wildcard (struct auth_zone *z, struct query_info *qinfo, struct auth_data *ce) |
| find wildcard between qname and cename | |
| static struct auth_data * | az_find_candidate_ce (struct auth_zone *z, struct query_info *qinfo, struct auth_data *n) |
| domain is not exact, find first candidate ce (name that matches a part of qname) in tree | |
| static struct auth_data * | az_domain_go_up (struct auth_zone *z, struct auth_data *n) |
| go up the auth tree to next existing name. | |
| static int | az_find_ce (struct auth_zone *z, struct query_info *qinfo, struct auth_data *node, int node_exact, struct auth_data **ce, struct auth_rrset **rrset) |
| Find the closest encloser, an name that exists and is above the qname. | |
| static int | az_add_additionals_from (struct auth_zone *z, struct regional *region, struct dns_msg *msg, struct auth_rrset *rrset, size_t offset) |
| add additional A/AAAA from domain names in rrset rdata (+offset) offset is number of bytes in rdata where the dname is located. | |
| static int | az_add_negative_soa (struct auth_zone *z, struct regional *region, struct dns_msg *msg) |
| add negative SOA record (with negative TTL) | |
| static int | az_empty_nonterminal (struct auth_zone *z, struct query_info *qinfo, struct auth_data *node) |
| See if the query goes to empty nonterminal (that has no auth_data, but there are nodes underneath. | |
| static size_t | synth_cname_buf (uint8_t *qname, size_t qname_len, size_t dname_len, uint8_t *dtarg, size_t dtarglen, uint8_t *buf, size_t buflen) |
| create synth cname target name in buffer, or fail if too long | |
| static int | create_synth_cname (uint8_t *qname, size_t qname_len, struct regional *region, struct auth_data *node, struct auth_rrset *dname, uint16_t dclass, struct ub_packed_rrset_key **cname) |
| create synthetic CNAME rrset for in a DNAME answer in region, false on alloc failure, cname==NULL when name too long. | |
| static int | add_synth_cname (struct auth_zone *z, uint8_t *qname, size_t qname_len, struct regional *region, struct dns_msg *msg, struct auth_data *dname, struct auth_rrset *rrset) |
| add a synthesized CNAME to the answer section | |
| static void | az_change_dnames (struct dns_msg *msg, uint8_t *oldname, uint8_t *newname, size_t newlen, int an_only) |
| Change a dname to a different one, for wildcard namechange. | |
| static struct auth_rrset * | az_find_nsec_cover (struct auth_zone *z, struct auth_data **node) |
| find NSEC record covering the query, with the given node in the zone | |
| static int | az_nsec_wildcard_denial (struct auth_zone *z, struct regional *region, struct dns_msg *msg, uint8_t *cenm, size_t cenmlen) |
| Find NSEC and add for wildcard denial. | |
| static int | az_nsec3_param (struct auth_zone *z, int *algo, size_t *iter, uint8_t **salt, size_t *saltlen) |
| Find the NSEC3PARAM rrset (if any) and if true you have the parameters. | |
| static size_t | az_nsec3_hash (uint8_t *buf, size_t buflen, uint8_t *nm, size_t nmlen, int algo, size_t iter, uint8_t *salt, size_t saltlen) |
| Hash a name with nsec3param into buffer, it has zone name appended. | |
| static int | az_nsec3_hashname (struct auth_zone *z, uint8_t *hashname, size_t *hashnmlen, uint8_t *nm, size_t nmlen, int algo, size_t iter, uint8_t *salt, size_t saltlen) |
| Hash name and return b32encoded hashname for lookup, zone name appended. | |
| static struct auth_data * | az_nsec3_findnode (struct auth_zone *z, uint8_t *hashnm, size_t hashnmlen) |
| Find the datanode that covers the nsec3hash-name. | |
| static struct auth_data * | az_nsec3_find_cover (struct auth_zone *z, uint8_t *nm, size_t nmlen, int algo, size_t iter, uint8_t *salt, size_t saltlen) |
| Find cover for hashed(nm, nmlen) (or NULL). | |
| static struct auth_data * | az_nsec3_find_exact (struct auth_zone *z, uint8_t *nm, size_t nmlen, int algo, size_t iter, uint8_t *salt, size_t saltlen) |
| Find exact match for hashed(nm, nmlen) NSEC3 record or NULL. | |
| static void | az_nsec3_get_nextcloser (uint8_t *cenm, uint8_t *qname, size_t qname_len, uint8_t **nx, size_t *nxlen) |
| Return nextcloser name (as a ref into the qname). | |
| static struct auth_data * | az_nsec3_find_ce (struct auth_zone *z, uint8_t **cenm, size_t *cenmlen, int *no_exact_ce, int algo, size_t iter, uint8_t *salt, size_t saltlen) |
| Find the closest encloser that has exact NSEC3. | |
| static int | az_nsec3_insert (struct auth_zone *z, struct regional *region, struct dns_msg *msg, struct auth_data *node) |
| static int | az_add_nsec3_proof (struct auth_zone *z, struct regional *region, struct dns_msg *msg, uint8_t *cenm, size_t cenmlen, uint8_t *qname, size_t qname_len, int nodataproof, int ceproof, int nxproof, int wcproof) |
| add NSEC3 records to the zone for the nsec3 proof. | |
| static int | az_generate_positive_answer (struct auth_zone *z, struct regional *region, struct dns_msg *msg, struct auth_data *node, struct auth_rrset *rrset) |
| generate answer for positive answer | |
| static int | az_generate_any_answer (struct auth_zone *z, struct regional *region, struct dns_msg *msg, struct auth_data *node) |
| generate answer for type ANY answer | |
| static int | follow_cname_chain (struct auth_zone *z, uint16_t qtype, struct regional *region, struct dns_msg *msg, struct packed_rrset_data *d) |
| follow cname chain and add more data to the answer section | |
| static int | az_generate_cname_answer (struct auth_zone *z, struct query_info *qinfo, struct regional *region, struct dns_msg *msg, struct auth_data *node, struct auth_rrset *rrset) |
| generate answer for cname answer | |
| static int | az_generate_notype_answer (struct auth_zone *z, struct regional *region, struct dns_msg *msg, struct auth_data *node) |
| generate answer for notype answer | |
| static int | az_generate_referral_answer (struct auth_zone *z, struct regional *region, struct dns_msg *msg, struct auth_data *ce, struct auth_rrset *rrset) |
| generate answer for referral answer | |
| static int | az_generate_dname_answer (struct auth_zone *z, struct query_info *qinfo, struct regional *region, struct dns_msg *msg, struct auth_data *ce, struct auth_rrset *rrset) |
| generate answer for DNAME answer | |
| static int | az_generate_wildcard_answer (struct auth_zone *z, struct query_info *qinfo, struct regional *region, struct dns_msg *msg, struct auth_data *ce, struct auth_data *wildcard, struct auth_data *node) |
| generate answer for wildcard answer | |
| static int | az_generate_nxdomain_answer (struct auth_zone *z, struct regional *region, struct dns_msg *msg, struct auth_data *ce, struct auth_data *node) |
| generate answer for nxdomain answer | |
| static int | az_generate_answer_with_node (struct auth_zone *z, struct query_info *qinfo, struct regional *region, struct dns_msg *msg, struct auth_data *node) |
| Create answers when an exact match exists for the domain name. | |
| static int | az_generate_answer_nonexistnode (struct auth_zone *z, struct query_info *qinfo, struct regional *region, struct dns_msg *msg, struct auth_data *ce, struct auth_rrset *rrset, struct auth_data *node) |
| Generate answer without an existing-node that we can use. | |
| static int | auth_zone_generate_answer (struct auth_zone *z, struct query_info *qinfo, struct regional *region, struct dns_msg **msg, int *fallback) |
| Lookup answer in a zone. | |
| int | auth_zones_lookup (struct auth_zones *az, struct query_info *qinfo, struct regional *region, struct dns_msg **msg, int *fallback, uint8_t *dp_nm, size_t dp_nmlen) |
| Use auth zones to lookup the answer to a query. | |
| static void | auth_answer_encode (struct query_info *qinfo, struct module_env *env, struct edns_data *edns, struct comm_reply *repinfo, sldns_buffer *buf, struct regional *temp, struct dns_msg *msg) |
| encode auth answer | |
| static void | auth_error_encode (struct query_info *qinfo, struct module_env *env, struct edns_data *edns, struct comm_reply *repinfo, sldns_buffer *buf, struct regional *temp, int rcode) |
| encode auth error answer | |
| int | auth_zones_downstream_answer (struct auth_zones *az, struct module_env *env, struct query_info *qinfo, struct edns_data *edns, struct comm_reply *repinfo, struct sldns_buffer *buf, struct regional *temp) |
| Answer query from auth zone. | |
| int | auth_zones_can_fallback (struct auth_zones *az, uint8_t *nm, size_t nmlen, uint16_t dclass) |
| see if the auth zone for the name can fallback | |
| int | auth_zone_parse_notify_serial (sldns_buffer *pkt, uint32_t *serial) |
| process notify packet and read serial number from SOA. | |
| static void | addr_port_to_str (struct sockaddr_storage *addr, socklen_t addrlen, char *buf, size_t len) |
| print addr to str, and if not 53, append "@port_number", for logs. | |
| static int | addr_in_list (struct auth_addr *list, struct sockaddr_storage *addr, socklen_t addrlen) |
| see if addr appears in the list | |
| static int | addr_matches_master (struct auth_master *master, struct sockaddr_storage *addr, socklen_t addrlen, struct auth_master **fromhost) |
| check if an address matches a master specification (or one of its addresses in the addr list) | |
| static int | az_xfr_allowed_notify (struct auth_xfer *xfr, struct sockaddr_storage *addr, socklen_t addrlen, struct auth_master **fromhost) |
| check access list for notifies | |
| static int | xfr_serial_means_update (struct auth_xfer *xfr, uint32_t serial) |
| see if the serial means the zone has to be updated, i.e. | |
| static void | xfr_note_notify_serial (struct auth_xfer *xfr, int has_serial, uint32_t serial) |
| note notify serial, updates the notify information in the xfr struct | |
| static void | xfr_process_notify (struct auth_xfer *xfr, struct module_env *env, int has_serial, uint32_t serial, struct auth_master *fromhost) |
| process a notify serial, start new probe or note serial. | |
| int | auth_zones_notify (struct auth_zones *az, struct module_env *env, uint8_t *nm, size_t nmlen, uint16_t dclass, struct sockaddr_storage *addr, socklen_t addrlen, int has_serial, uint32_t serial, int *refused) |
| process notify for auth zones. | |
| int | auth_zones_startprobesequence (struct auth_zones *az, struct module_env *env, uint8_t *nm, size_t nmlen, uint16_t dclass) |
| for the zone and if not already going, starts the probe sequence. | |
| static void | auth_xfer_set_expired (struct auth_xfer *xfr, struct module_env *env, int expired) |
| set a zone expired | |
| static struct auth_master * | find_master_by_host (struct auth_master *list, char *host) |
| find master (from notify or probe) in list of masters | |
| static void | xfr_masterlist_free_addrs (struct auth_master *list) |
| delete the looked up auth_addrs for all the masters in the list | |
| static struct auth_addr * | auth_addr_list_copy (struct auth_addr *source) |
| copy a list of auth_addrs | |
| static struct auth_master * | auth_master_copy (struct auth_master *o) |
| copy a master to a new structure, NULL on alloc failure | |
| static int | auth_master_copy_and_append (struct auth_master *p, struct auth_master **list, struct auth_master **last) |
| append the master to the copied list. | |
| static void | xfr_transfer_start_lookups (struct auth_xfer *xfr) |
| start the lookups for task_transfer | |
| static void | xfr_transfer_move_to_next_lookup (struct auth_xfer *xfr, struct module_env *env) |
| move to the next lookup of hostname for task_transfer | |
| static void | xfr_probe_start_lookups (struct auth_xfer *xfr) |
| start the lookups for task_probe | |
| static void | xfr_probe_move_to_next_lookup (struct auth_xfer *xfr, struct module_env *env) |
| move to the next lookup of hostname for task_probe | |
| static void | xfr_transfer_start_list (struct auth_xfer *xfr, struct auth_master *spec) |
| start the iteration of the task_transfer list of masters | |
| static void | xfr_probe_start_list (struct auth_xfer *xfr, struct auth_master *spec) |
| start the iteration of the task_probe list of masters | |
| static struct auth_master * | xfr_transfer_current_master (struct auth_xfer *xfr) |
| pick up the master that is being scanned right now, task_transfer | |
| static struct auth_master * | xfr_probe_current_master (struct auth_xfer *xfr) |
| pick up the master that is being scanned right now, task_probe | |
| static int | xfr_transfer_end_of_list (struct auth_xfer *xfr) |
| true if at end of list, task_transfer | |
| static int | xfr_probe_end_of_list (struct auth_xfer *xfr) |
| true if at end of list, task_probe | |
| static void | xfr_transfer_nextmaster (struct auth_xfer *xfr) |
| move to next master in list, task_transfer | |
| static void | xfr_probe_nextmaster (struct auth_xfer *xfr) |
| move to next master in list, task_probe | |
| static void | xfr_create_soa_probe_packet (struct auth_xfer *xfr, sldns_buffer *buf, uint16_t id) |
| create SOA probe packet for xfr | |
| static void | xfr_create_ixfr_packet (struct auth_xfer *xfr, sldns_buffer *buf, uint16_t id, struct auth_master *master) |
| create IXFR/AXFR packet for xfr | |
| static int | check_packet_ok (sldns_buffer *pkt, uint16_t qtype, struct auth_xfer *xfr, uint32_t *serial) |
| check if returned packet is OK | |
| static int | chunkline_get_line (struct auth_chunk **chunk, size_t *chunk_pos, sldns_buffer *buf, int *eof) |
| read one line from chunks into buffer at current position | |
| int | chunkline_count_parens (sldns_buffer *buf, size_t start) |
| count number of open and closed parenthesis in a chunkline | |
| static void | chunkline_remove_trailcomment (sldns_buffer *buf, size_t start) |
| remove trailing ;... comment from a line in the chunkline buffer | |
| static int | chunkline_is_comment_line_or_empty (sldns_buffer *buf) |
| see if a chunkline is a comment line (or empty line) | |
| static int | chunkline_get_line_collated (struct auth_chunk **chunk, size_t *chunk_pos, sldns_buffer *buf, int *eof) |
| find a line with ( ) collated | |
| static int | http_parse_origin (sldns_buffer *buf, struct sldns_file_parse_state *pstate) |
| process $ORIGIN for http, 0 nothing, 1 done, 2 error | |
| static int | http_parse_ttl (sldns_buffer *buf, struct sldns_file_parse_state *pstate) |
| process $TTL for http, 0 nothing, 1 done, 2 error | |
| static void | chunkline_newline_removal (sldns_buffer *buf) |
| remove newlines from collated line | |
| static int | chunkline_non_comment_RR (struct auth_chunk **chunk, size_t *chunk_pos, sldns_buffer *buf, struct sldns_file_parse_state *pstate) |
| find noncomment RR line in chunks, collates lines if ( ) format | |
| static int | http_zonefile_syntax_check (struct auth_xfer *xfr, sldns_buffer *buf) |
| check syntax of chunklist zonefile, parse first RR, return false on failure and return a string in the scratch buffer (first RR string) on failure. | |
| static size_t | chunklist_sum (struct auth_chunk *list) |
| sum sizes of chunklist | |
| static int | http_parse_add_rr (struct auth_xfer *xfr, struct auth_zone *z, sldns_buffer *buf, struct sldns_file_parse_state *pstate) |
| for http download, parse and add RR to zone | |
| static void | chunk_rrlist_start (struct auth_xfer *xfr, struct auth_chunk **rr_chunk, int *rr_num, size_t *rr_pos) |
| RR list iterator, returns RRs from answer section one by one from the dns packets in the chunklist. | |
| static int | chunk_rrlist_end (struct auth_chunk *rr_chunk, int rr_num) |
| RR list iterator, see if we are at the end of the list. | |
| static void | chunk_rrlist_gonext (struct auth_chunk **rr_chunk, int *rr_num, size_t *rr_pos, size_t rr_nextpos, int *budget) |
| RR list iterator, move to next RR. | |
| static int | chunk_rrlist_get_current (struct auth_chunk *rr_chunk, int rr_num, size_t rr_pos, uint8_t **rr_dname, uint16_t *rr_type, uint16_t *rr_class, uint32_t *rr_ttl, uint16_t *rr_rdlen, uint8_t **rr_rdata, size_t *rr_nextpos) |
| RR iterator, get current RR information, false on parse error. | |
| static void | log_rrlist_position (const char *label, struct auth_chunk *rr_chunk, uint8_t *rr_dname, uint16_t rr_type, size_t rr_counter) |
| print log message where we are in parsing the zone transfer | |
| static int | ixfr_start_serial (struct auth_chunk *rr_chunk, int rr_num, size_t rr_pos, uint8_t *rr_dname, uint16_t rr_type, uint16_t rr_class, uint32_t rr_ttl, uint16_t rr_rdlen, uint8_t *rr_rdata, size_t rr_nextpos, uint32_t transfer_serial, uint32_t xfr_serial, int *budget) |
| check that start serial is OK for ixfr. | |
| static int | apply_ixfr (struct auth_xfer *xfr, struct auth_zone *z, struct sldns_buffer *scratch_buffer) |
| apply IXFR to zone in memory. | |
| static int | apply_axfr (struct auth_xfer *xfr, struct auth_zone *z, struct sldns_buffer *scratch_buffer) |
| apply AXFR to zone in memory. | |
| static int | apply_http (struct auth_xfer *xfr, struct auth_zone *z, struct sldns_buffer *scratch_buffer, char *etag) |
| apply HTTP to zone in memory. | |
| static int | auth_zone_write_chunks (struct auth_chunk *chunk_list, const char *fname) |
| write http chunks to zonefile to create downloaded file | |
| static void | zone_write_after_update (struct auth_zone *z, struct module_env *env, struct auth_chunk *chunk_list) |
| write to zonefile after zone has been updated, z has rdlock by caller. | |
| static void | zone_write_after_update_reacq (uint8_t *bakname, size_t baknamelen, uint16_t bakdclass, struct module_env *env, struct auth_chunk *chunk_list) |
| write to zonefile after zone has updated, reacquires z readlock. | |
| static void | xfr_write_after_update (struct auth_xfer *xfr, struct module_env *env, struct auth_chunk *chunk_list) |
| write to zonefile after zone has been updated | |
| static int | xfr_process_reacquire_locks (struct auth_xfer *xfr, struct module_env *env, struct auth_zone **z) |
| reacquire locks and structures. | |
| static int | xfr_process_chunk_list (struct auth_xfer *xfr, struct module_env *env, int *ixfr_fail, char *etag) |
| process chunk list and update zone in memory, return false if it did not work | |
| static void | xfr_stop_lookup (struct auth_master **lookup_target, void *lookup_unique_info, int lookup_aaaa, uint16_t dclass, struct mesh_area *mesh, mesh_cb_func_type cb, void *cb_arg) |
| Stop lookup using callback. | |
| static void | xfr_transfer_disown (struct auth_xfer *xfr) |
| disown task_transfer. | |
| static int | xfr_transfer_lookup_host (struct auth_xfer *xfr, struct module_env *env) |
| lookup a host name for its addresses, if needed | |
| static int | xfr_transfer_init_fetch (struct auth_xfer *xfr, struct module_env *env) |
| initiate TCP to the target and fetch zone. | |
| static void | xfr_transfer_nexttarget_or_end (struct auth_xfer *xfr, struct module_env *env) |
| perform next lookup, next transfer TCP, or end and resume wait time task | |
| static void | xfr_master_add_addrs (struct auth_master *m, struct ub_packed_rrset_key *rrset, uint16_t rrtype) |
| add addrs from A or AAAA rrset to the master | |
| static int | xfer_target_equals_answer_name (struct auth_master *lookup_target, struct ub_packed_rrset_key *answer, struct query_info *rq, struct reply_info *rep) |
| check if the lookup target name equals the found answer name. | |
| void | auth_xfer_transfer_lookup_callback (void *arg, int rcode, sldns_buffer *buf, enum sec_status sec, char *why_bogus, int ATTR_UNUSED(was_ratelimited)) |
| callback for task_transfer lookup of host name, of A or AAAA | |
| static int | check_xfer_packet (sldns_buffer *pkt, struct auth_xfer *xfr, int *gonextonfail, int *transferdone) |
| check if xfer (AXFR or IXFR) packet is OK. | |
| static int | xfer_link_data (sldns_buffer *pkt, struct auth_xfer *xfr) |
| Link the data from this packet into the worklist of transferred data. | |
| static void | process_list_end_transfer (struct auth_xfer *xfr, struct module_env *env, char *etag) |
| task transfer. | |
| void | auth_xfer_transfer_timer_callback (void *arg) |
| callback for the task_transfer timer | |
| static int | auth_xfer_transfer_time_taken (struct auth_xfer *xfr, struct module_env *env) |
| return the time taken by the transfer | |
| int | auth_xfer_transfer_tcp_callback (struct comm_point *c, void *arg, int err, struct comm_reply *ATTR_UNUSED(repinfo)) |
| callback for task_transfer tcp connections | |
| int | auth_xfer_transfer_http_callback (struct comm_point *c, void *arg, int err, struct comm_reply *repinfo) |
| callback for task_transfer http connections | |
| static void | xfr_start_transfer (struct auth_xfer *xfr, struct module_env *env, struct auth_master *master) |
| start transfer task by this worker , xfr is locked. | |
| static void | xfr_probe_disown (struct auth_xfer *xfr) |
| disown task_probe. | |
| static int | xfr_probe_send_probe (struct auth_xfer *xfr, struct module_env *env, int timeout) |
| send the UDP probe to the master, this is part of task_probe | |
| void | auth_xfer_probe_timer_callback (void *arg) |
| callback for task_probe timer | |
| int | auth_xfer_probe_udp_callback (struct comm_point *c, void *arg, int err, struct comm_reply *repinfo) |
| callback for task_probe udp packets | |
| static int | xfr_probe_lookup_host (struct auth_xfer *xfr, struct module_env *env) |
| lookup a host name for its addresses, if needed | |
| static int | have_probe_targets (struct auth_master *list) |
| return true if there are probe (SOA UDP query) targets in the master list | |
| void | auth_xfer_probe_lookup_callback (void *arg, int rcode, sldns_buffer *buf, enum sec_status sec, char *why_bogus, int ATTR_UNUSED(was_ratelimited)) |
| callback for task_probe lookup of host name, of A or AAAA | |
| static void | xfr_nextprobe_disown (struct auth_xfer *xfr) |
| disown task_nextprobe. | |
| void | auth_xfer_timer (void *arg) |
| xfer nextprobe timeout callback, this is part of task_nextprobe | |
| void | auth_zone_pickup_initial_zone (struct auth_zone *z, struct module_env *env) |
| Initial pick up of the auth zone, it sets the acquired time. | |
| void | auth_xfer_pickup_initial_zone (struct auth_xfer *x, struct module_env *env) |
| Initial pick up of the auth zone nextprobe timeout and that turns into further zone transfer work, if any. | |
| void | auth_xfer_pickup_initial (struct auth_zones *az, struct module_env *env) |
| initial pick up of worker timeouts, ties events to worker event loop | |
| void | auth_zones_cleanup (struct auth_zones *az) |
| Cleanup auth zones. | |
| static struct auth_xfer * | auth_xfer_new (struct auth_zone *z) |
| malloc the xfer and tasks | |
| struct auth_xfer * | auth_xfer_create (struct auth_zones *az, struct auth_zone *z) |
| Create auth_xfer structure. | |
| static struct auth_master * | auth_master_new (struct auth_master ***list) |
| create new auth_master structure | |
| static char * | dup_prefix (char *str, size_t num) |
| dup_prefix : create string from initial part of other string, malloced | |
| static char * | dup_all (char *str) |
| dup string and print error on error | |
| static char * | str_find_first_of_chars (char *s, char a, char b) |
| find first of two characters | |
| static int | parse_url (char *url, char **host, char **file, int *port, int *ssl) |
| parse URL into host and file parts, false on malloc or parse error | |
| int | xfer_set_masters (struct auth_master **list, struct config_auth *c, int with_http) |
| Set masters in auth xfer structure from config. | |
| int | compare_serial (uint32_t a, uint32_t b) |
| int | zonemd_hashalgo_supported (int hashalgo) |
| returns true if a zonemd hash algo is supported | |
| int | zonemd_scheme_supported (int scheme) |
| returns true if a zonemd scheme is supported | |
| static struct secalgo_hash * | zonemd_digest_init (int hashalgo, char **reason) |
| initialize hash for hashing with zonemd hash algo | |
| static int | zonemd_digest_update (int hashalgo, struct secalgo_hash *h, uint8_t *data, size_t len, char **reason) |
| update the hash for zonemd | |
| static int | zonemd_digest_finish (int hashalgo, struct secalgo_hash *h, uint8_t *result, size_t hashlen, size_t *resultlen, char **reason) |
| finish the hash for zonemd | |
| static size_t | authdata_rrsets_to_list (struct auth_rrset **array, size_t arraysize, struct auth_rrset *first) |
| add rrsets from node to the list | |
| static int | rrlist_compare (const void *arg1, const void *arg2) |
| compare rr list entries | |
| static void | addrrsigtype_if_needed (struct auth_rrset **array, size_t arraysize, size_t *rrnum, struct auth_data *node) |
| add type RRSIG to rr list if not one there already, this is to perform RRSIG collate processing at that point. | |
| static int | zonemd_simple_rrset (struct auth_zone *z, int hashalgo, struct secalgo_hash *h, struct auth_data *node, struct auth_rrset *rrset, struct regional *region, struct sldns_buffer *buf, char **reason) |
| collate the RRs in an RRset using the simple scheme | |
| static size_t | zonemd_simple_count_rrsig (struct auth_rrset *rrset, struct auth_rrset **rrlist, size_t rrnum, struct auth_zone *z, struct auth_data *node) |
| count number of RRSIGs in a domain name rrset list | |
| static int | zonemd_simple_rrsig_allocs (struct regional *region, struct packed_rrset_data *data, size_t count) |
| allocate sparse rrset data for the number of entries in tepm region | |
| static void | add_rrlist_rrsigs_into_data (struct packed_rrset_data *data, size_t *done, struct auth_rrset **rrlist, size_t rrnum, struct auth_zone *z, struct auth_data *node) |
| add the RRSIGs from the rrs in the domain into the data | |
| static void | add_rrset_into_data (struct packed_rrset_data *data, size_t *done, struct auth_rrset *rrset, struct auth_zone *z, struct auth_data *node) |
| static int | zonemd_simple_rrsig (struct auth_zone *z, int hashalgo, struct secalgo_hash *h, struct auth_data *node, struct auth_rrset *rrset, struct auth_rrset **rrlist, size_t rrnum, struct regional *region, struct sldns_buffer *buf, char **reason) |
| collate the RRSIGs using the simple scheme | |
| static int | zonemd_simple_domain (struct auth_zone *z, int hashalgo, struct secalgo_hash *h, struct auth_data *node, struct regional *region, struct sldns_buffer *buf, char **reason) |
| collate a domain's rrsets using the simple scheme | |
| static int | zonemd_simple_collate (struct auth_zone *z, int hashalgo, struct secalgo_hash *h, struct regional *region, struct sldns_buffer *buf, char **reason) |
| collate the zone using the simple scheme | |
| int | auth_zone_generate_zonemd_hash (struct auth_zone *z, int scheme, int hashalgo, uint8_t *hash, size_t hashlen, size_t *resultlen, struct regional *region, struct sldns_buffer *buf, char **reason) |
| Generate ZONEMD digest for the auth zone. | |
| int | auth_zone_generate_zonemd_check (struct auth_zone *z, int scheme, int hashalgo, uint8_t *hash, size_t hashlen, struct regional *region, struct sldns_buffer *buf, char **reason) |
| Check ZONEMD digest for the auth zone. | |
| static void | auth_zone_log (uint8_t *name, enum verbosity_value level, const char *format,...) ATTR_FORMAT(printf |
| log auth zone message with zone name in front. | |
| static int | zonemd_dnssec_verify_rrset (struct auth_zone *z, struct module_env *env, struct module_stack *mods, struct ub_packed_rrset_key *dnskey, struct auth_data *node, struct auth_rrset *rrset, char **why_bogus, uint8_t *sigalg, char *reasonbuf, size_t reasonlen) |
| ZONEMD, dnssec verify the rrset with the dnskey. | |
| static int | nsec3_of_param_has_type (struct auth_rrset *nsec3, int algo, size_t iter, uint8_t *salt, size_t saltlen, uint16_t rrtype) |
| check for nsec3, the RR with params equal, if bitmap has the type | |
| static int | zonemd_check_dnssec_absence (struct auth_zone *z, struct module_env *env, struct module_stack *mods, struct ub_packed_rrset_key *dnskey, struct auth_data *apex, char **reason, char **why_bogus, uint8_t *sigalg, char *reasonbuf, size_t reasonlen) |
| Verify the absence of ZONEMD with DNSSEC by checking NSEC, NSEC3 type flag. | |
| static int | zonemd_check_dnssec_soazonemd (struct auth_zone *z, struct module_env *env, struct module_stack *mods, struct ub_packed_rrset_key *dnskey, struct auth_data *apex, struct auth_rrset *zonemd_rrset, char **reason, char **why_bogus, uint8_t *sigalg, char *reasonbuf, size_t reasonlen) |
| Verify the SOA and ZONEMD DNSSEC signatures. | |
| static void | auth_zone_zonemd_fail (struct auth_zone *z, struct module_env *env, char *reason, char *why_bogus, char **result) |
| Fail the ZONEMD verification. | |
| static void | auth_zone_verify_zonemd_with_key (struct auth_zone *z, struct module_env *env, struct module_stack *mods, struct ub_packed_rrset_key *dnskey, int is_insecure, char **result, uint8_t *sigalg) |
| Verify the zonemd with DNSSEC and hash check, with given key. | |
| static struct ub_packed_rrset_key * | zonemd_get_dnskey_from_anchor (struct auth_zone *z, struct module_env *env, struct module_stack *mods, struct trust_anchor *anchor, int *is_insecure, char **why_bogus, struct ub_packed_rrset_key *keystorage, char *reasonbuf, size_t reasonlen) |
| verify the zone DNSKEY rrset from the trust anchor This is possible because the anchor is for the zone itself, and can thus apply straight to the zone DNSKEY set. | |
| static struct ub_packed_rrset_key * | auth_zone_verify_zonemd_key_with_ds (struct auth_zone *z, struct module_env *env, struct module_stack *mods, struct ub_packed_rrset_key *ds, int *is_insecure, char **why_bogus, struct ub_packed_rrset_key *keystorage, uint8_t *sigalg, char *reasonbuf, size_t reasonlen) |
| verify the DNSKEY from the zone with looked up DS record | |
| void | auth_zonemd_dnskey_lookup_callback (void *arg, int rcode, sldns_buffer *buf, enum sec_status sec, char *why_bogus, int ATTR_UNUSED(was_ratelimited)) |
| callback for ZONEMD lookup of DNSKEY | |
| static int | zonemd_lookup_dnskey (struct auth_zone *z, struct module_env *env) |
| lookup DNSKEY for ZONEMD verification | |
| void | auth_zone_verify_zonemd (struct auth_zone *z, struct module_env *env, struct module_stack *mods, char **result, int offline, int only_online) |
| Perform ZONEMD checks and verification for the auth zone. | |
| void | auth_zones_pickup_zonemd_verify (struct auth_zones *az, struct module_env *env) |
| Check the ZONEMD records that need online DNSSEC chain lookups, for them spawn the lookup process to get it checked out. | |
| static size_t | auth_rrset_get_mem (struct auth_rrset *rrset) |
| Get memory usage of auth rrset. | |
| static size_t | auth_data_get_mem (struct auth_data *node) |
| Get memory usage of auth data. | |
| static size_t | auth_zone_get_mem (struct auth_zone *z) |
| Get memory usage of auth zone. | |
| static size_t | auth_addrs_get_mem (struct auth_addr *list) |
| Get memory usage of list of auth addr. | |
| static size_t | auth_primaries_get_mem (struct auth_master *list) |
| Get memory usage of list of primaries for auth xfer. | |
| static size_t | auth_chunks_get_mem (struct auth_chunk *list) |
| Get memory usage or list of auth chunks. | |
| static size_t | auth_xfer_get_mem (struct auth_xfer *xfr) |
| Get memory usage of auth xfer. | |
| static size_t | az_ztree_get_mem (struct auth_zones *az) |
| Get memory usage of auth zones ztree. | |
| static size_t | az_xtree_get_mem (struct auth_zones *az) |
| Get memory usage of auth zones xtree. | |
| size_t | auth_zones_get_mem (struct auth_zones *zones) |
| Get memory usage for auth zones. | |
| void | xfr_disown_tasks (struct auth_xfer *xfr, struct worker *worker) |
| Disown tasks from the xfr that belong to this worker. | |
This file contains the functions for an authority zone.
This zone is queried by the iterator, just like a stub or forward zone, but then the data is locally held.
| #define N3HASHBUFLEN 32 |
bytes to use for NSEC3 hash buffer.
20 for sha1
Referenced by az_nsec3_hash(), and az_nsec3_hashname().
| #define MAX_CNAME_CHAIN 8 |
max number of CNAMEs we are willing to follow (in one answer)
Referenced by follow_cname_chain().
| #define AUTH_PROBE_TIMEOUT 100 |
timeout for probe packets for SOA
Referenced by xfr_probe_send_or_end(), and xfr_probe_send_probe().
| #define AUTH_PROBE_TIMEOUT_STOP 1000 |
when to stop with SOA probes (when exponential timeouts exceed this)
Referenced by auth_xfer_probe_timer_callback().
| #define NUM_TIMEOUTS_FALLBACK_IXFR 3 |
number of timeouts before we fallback from IXFR to AXFR, because some versions of servers (eg.
dnsmasq) drop IXFR packets.
Referenced by auth_xfer_transfer_tcp_callback(), and auth_xfer_transfer_timer_callback().
| #define NUM_IXFR_BEFORE_AXFR 5 |
number of IXFRs before an AXFR is performed, to consolidate RPZ memory.
Referenced by xfr_create_ixfr_packet().
| #define AUTH_XFR_DECOMPRESS_PACKET_LIMIT 128000 |
The max number of decompression pointers that are allowed in a received xfr packet.
The parse fails if the limit is exceeded. For a lot of PTR records, with compression for a deep zone, that is about 20x pointers per RR, of about 16 bytes, more than 4000*20 = 80000.
Referenced by apply_axfr(), apply_ixfr(), and check_xfer_packet().
|
static |
pick up nextprobe task to start waiting to perform transfer actions
for task_nextprobe.
determine next timeout for auth_xfer. Also (re)sets timer.
| xfr | task structure |
| env | module environment, with worker and time. |
| failure | set true if timer should be set for failure retry. |
| lookup_only | only perform lookups when timer done, 0 sec timeout |
References auth_xfer_timer(), auth_nextprobe::backoff, comm_timer_create(), comm_timer_set(), dname_str(), auth_xfer::expiry, auth_xfer::have_zone, LDNS_MAX_DOMAINLEN, auth_xfer::lease_time, log_assert, log_err(), auth_probe::masters, auth_xfer::name, auth_nextprobe::next_probe, module_env::now, auth_probe::only_lookup, auth_xfer::refresh, auth_xfer::retry, auth_xfer::task_nextprobe, auth_xfer::task_probe, auth_nextprobe::timer, VERB_ALGO, verbose(), verbosity, module_env::worker, module_env::worker_base, and xfr_set_timeout().
Referenced by auth_xfer_pickup_initial_zone(), process_list_end_transfer(), xfr_probe_send_or_end(), xfr_set_timeout(), and xfr_transfer_nexttarget_or_end().
|
static |
move to sending the probe packets, next if fails.
task_probe
References AUTH_PROBE_TIMEOUT, dname_str(), auth_probe::have_new_lease, have_probe_targets(), auth_xfer::have_zone, LDNS_MAX_DOMAINLEN, auth_xfer::lease_time, auth_xfer::lock, auth_probe::lookup_target, auth_probe::masters, auth_xfer::name, module_env::now, auth_probe::only_lookup, probe_copy_masters_for_allow_notify(), auth_xfer::task_nextprobe, auth_xfer::task_probe, auth_xfer::task_transfer, VERB_ALGO, verbose(), verbosity, xfr_probe_disown(), xfr_probe_end_of_list(), xfr_probe_lookup_host(), xfr_probe_move_to_next_lookup(), xfr_probe_nextmaster(), xfr_probe_send_or_end(), xfr_probe_send_probe(), xfr_set_timeout(), and xfr_start_transfer().
Referenced by auth_xfer_probe_lookup_callback(), auth_xfer_probe_timer_callback(), auth_xfer_probe_udp_callback(), xfr_probe_send_or_end(), and xfr_start_probe().
|
static |
pick up probe task with specified(or NULL) destination first, or transfer task if nothing to probe, or false if already in progress
start task_probe if possible, if no masters for probe start task_transfer returns true if task has been started, and false if the task is already in progress.
References auth_probe::cp, auth_probe::have_new_lease, have_probe_targets(), auth_probe::masters, auth_probe::only_lookup, auth_xfer::task_probe, auth_xfer::task_transfer, module_env::worker, xfr_probe_send_or_end(), xfr_probe_start_list(), xfr_probe_start_lookups(), xfr_start_probe(), and xfr_start_transfer().
Referenced by auth_xfer_timer(), process_list_end_transfer(), xfr_process_notify(), and xfr_start_probe().
|
static |
copy the master addresses from the task_probe lookups to the allow_notify list of masters
References auth_xfer::allow_notify_list, auth_free_masters(), auth_master_copy_and_append(), auth_master::http, auth_master::list, auth_probe::masters, auth_transfer::masters, auth_master::next, probe_copy_masters_for_allow_notify(), auth_xfer::task_probe, and auth_xfer::task_transfer.
Referenced by auth_zones_cfg(), probe_copy_masters_for_allow_notify(), xfr_probe_send_or_end(), and xfr_transfer_init_fetch().
| void auth_xfer_delete | ( | struct auth_xfer * | xfr | ) |
delete xfer structure (not its tree entry)
Delete auth xfer structure.
delete xfer structure (not its tree entry)
| xfr | delete this xfer and its tasks. |
References auth_xfer::allow_notify_list, auth_chunks_delete(), auth_free_masters(), auth_xfer_delete(), auth_transfer::chunks_first, comm_point_delete(), comm_timer_delete(), auth_probe::cp, auth_transfer::cp, auth_xfer::lock, auth_probe::masters, auth_transfer::masters, auth_xfer::name, auth_xfer::task_nextprobe, auth_xfer::task_probe, auth_xfer::task_transfer, auth_nextprobe::timer, auth_probe::timer, and auth_transfer::timer.
Referenced by auth_xfer_del(), auth_xfer_delete(), auth_zonemd_dnskey_lookup_callback(), az_delete_deleted_zones(), fr_worker_auth_cha(), and fr_worker_auth_del().
|
static |
create new dns_msg
References reply_info::authoritative, BIT_AA, BIT_QR, reply_info::flags, query_info::local_alias, msg_create(), query_info::qclass, reply_info::qdcount, dns_msg::qinfo, query_info::qname, query_info::qname_len, query_info::qtype, reply_info::reason_bogus, regional_alloc(), regional_alloc_init(), regional_alloc_zero(), and dns_msg::rep.
Referenced by auth_zone_generate_answer(), and msg_create().
grow rrset array by one in msg
References msg_grow_array(), regional_alloc_zero(), dns_msg::rep, reply_info::rrset_count, and reply_info::rrsets.
Referenced by add_synth_cname(), msg_add_rrset_an(), msg_add_rrset_ar(), msg_add_rrset_ns(), and msg_grow_array().
|
static |
get ttl of rrset
References lruhash_entry::data, ub_packed_rrset_key::entry, get_rrset_ttl(), and packed_rrset_data::ttl.
Referenced by az_add_negative_soa(), get_rrset_ttl(), and msg_ttl().
|
static |
Copy rrset into region from domain-datanode and packet rrset.
References auth_packed_rrset_copy_region(), auth_rrset::data, lruhash_entry::data, auth_zone::dclass, packed_rrset_key::dname, packed_rrset_key::dname_len, ub_packed_rrset_key::entry, lruhash_entry::hash, lruhash_entry::key, auth_data::name, auth_data::namelen, packed_rrset_copy_region(), ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, rrset_key_hash(), auth_rrset::type, and packed_rrset_key::type.
Referenced by auth_packed_rrset_copy_region(), msg_add_rrset_an(), msg_add_rrset_ar(), and msg_add_rrset_ns().
|
static |
fix up msg->rep TTL and prefetch ttl
References get_rrset_ttl(), msg_ttl(), reply_info::prefetch_ttl, PREFETCH_TTL_CALC, dns_msg::rep, reply_info::rrset_count, reply_info::rrsets, SERVE_EXPIRED_TTL, reply_info::serve_expired_ttl, and reply_info::ttl.
Referenced by add_synth_cname(), msg_add_rrset_an(), msg_add_rrset_ar(), msg_add_rrset_ns(), and msg_ttl().
|
static |
see if rrset is a duplicate in the answer message
References packed_rrset_key::dname, packed_rrset_key::dname_len, msg_rrset_duplicate(), query_dname_compare(), dns_msg::rep, ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, reply_info::rrset_count, reply_info::rrsets, and packed_rrset_key::type.
Referenced by msg_add_rrset_an(), msg_add_rrset_ar(), msg_add_rrset_ns(), and msg_rrset_duplicate().
|
static |
add rrset to answer section (no auth, add rrsets yet)
References reply_info::an_numrrsets, reply_info::ar_numrrsets, auth_packed_rrset_copy_region(), auth_zone::dclass, log_assert, msg_add_rrset_an(), msg_grow_array(), msg_rrset_duplicate(), msg_ttl(), auth_data::name, auth_data::namelen, reply_info::ns_numrrsets, dns_msg::rep, reply_info::rrset_count, reply_info::rrsets, and auth_rrset::type.
Referenced by az_generate_any_answer(), az_generate_cname_answer(), az_generate_dname_answer(), az_generate_positive_answer(), az_generate_wildcard_answer(), follow_cname_chain(), and msg_add_rrset_an().
|
static |
add rrset to authority section (no additional section rrsets yet)
References reply_info::ar_numrrsets, auth_packed_rrset_copy_region(), auth_zone::dclass, log_assert, msg_add_rrset_ns(), msg_grow_array(), msg_rrset_duplicate(), msg_ttl(), auth_data::name, auth_data::namelen, reply_info::ns_numrrsets, dns_msg::rep, reply_info::rrset_count, reply_info::rrsets, and auth_rrset::type.
Referenced by az_add_negative_soa(), az_generate_notype_answer(), az_generate_nxdomain_answer(), az_generate_referral_answer(), az_generate_wildcard_answer(), az_nsec_wildcard_denial(), and msg_add_rrset_ns().
|
static |
add rrset to additional section
References reply_info::ar_numrrsets, auth_packed_rrset_copy_region(), auth_zone::dclass, msg_add_rrset_ar(), msg_grow_array(), msg_rrset_duplicate(), msg_ttl(), auth_data::name, auth_data::namelen, dns_msg::rep, reply_info::rrset_count, reply_info::rrsets, and auth_rrset::type.
Referenced by az_add_additionals_from(), and msg_add_rrset_ar().
| struct auth_zones * auth_zones_create | ( | void | ) |
Create auth zones structure.
References auth_xfer_cmp(), auth_zone_cmp(), auth_zones_create(), auth_zones::lock, log_err(), rbtree_init(), auth_zones::rpz_first, auth_zones::rpz_lock, auth_zones::xtree, and auth_zones::ztree.
Referenced by auth_zones_create(), check_auth(), check_queries(), check_read_exact(), daemon_init(), fr_construct_from_config(), ub_ctx_create_nopipe(), zonemd_check_test(), zonemd_generate_test(), and zonemd_verify_test().
| int auth_zone_cmp | ( | const void * | z1, |
| const void * | z2 ) |
compare auth_zones for sorted rbtree
References auth_zone_cmp(), auth_zone::dclass, dname_lab_cmp(), auth_zone::name, and auth_zone::namelabs.
Referenced by auth_zone_cmp(), auth_zones_create(), and fptr_whitelist_rbtree_cmp().
| int auth_data_cmp | ( | const void * | z1, |
| const void * | z2 ) |
compare auth_data for sorted rbtree
References auth_data_cmp(), dname_canon_lab_cmp(), auth_data::name, and auth_data::namelabs.
Referenced by auth_data_cmp(), auth_zone_clear_data(), auth_zone_create(), auth_zone_read_zonefile(), and fptr_whitelist_rbtree_cmp().
| int auth_xfer_cmp | ( | const void * | z1, |
| const void * | z2 ) |
compare auth_xfer for sorted rbtree
References auth_xfer_cmp(), auth_xfer::dclass, dname_lab_cmp(), auth_xfer::name, and auth_xfer::namelabs.
Referenced by auth_xfer_cmp(), auth_zones_create(), and fptr_whitelist_rbtree_cmp().
|
static |
delete auth rrset node
References auth_rrset_delete(), and auth_rrset::data.
Referenced by auth_data_delete(), auth_rrset_delete(), and domain_remove_rrset().
|
static |
delete auth data domain node
References auth_data_delete(), auth_rrset_delete(), auth_data::name, auth_rrset::next, and auth_data::rrsets.
Referenced by auth_data_del(), auth_data_delete(), az_insert_rr(), and az_remove_rr().
|
static |
helper traverse to delete zones
References auth_data_del(), auth_data_delete(), and rbnode_type::key.
Referenced by auth_data_del(), auth_zone_clear_data(), auth_zone_delete(), and auth_zone_read_zonefile().
|
static |
delete chunklist
References auth_chunk_list_delete(), auth_chunk::data, and auth_chunk::next.
Referenced by auth_chunk_list_delete(), auth_chunks_delete(), auth_zone_delete(), auth_zonemd_dnskey_lookup_callback(), xfr_process_chunk_list(), and zone_write_after_update().
|
static |
delete an auth zone structure (tree remove must be done elsewhere)
References auth_chunk_list_delete(), auth_data_del(), auth_zone_delete(), auth_zone::data, auth_zone::lock, auth_zone::name, auth_zone::perform_write_chunk_list, auth_zone::rpz, auth_zone::rpz_az_next, auth_zone::rpz_az_prev, rpz_delete(), auth_zones::rpz_first, auth_zones::rpz_lock, traverse_postorder(), and auth_zone::zonefile.
Referenced by auth_zone_create(), auth_zone_del(), auth_zone_delete(), and az_delete_deleted_zones().
| struct auth_zone * auth_zone_create | ( | struct auth_zones * | az, |
| uint8_t * | nm, | ||
| size_t | nmlen, | ||
| uint16_t | dclass ) |
create an auth zone.
returns wrlocked zone. caller must have wrlock on az. returns NULL on malloc failure
References auth_data_cmp(), auth_zone_create(), auth_zone_delete(), auth_zone::data, auth_zone::dclass, dname_count_labels(), rbnode_type::key, auth_zone::lock, log_warn(), auth_zone::max_transfer_size, auth_zone::max_transfer_time, memdup(), auth_zone::name, auth_zone::namelabs, auth_zone::namelen, auth_zone::node, rbtree_init(), rbtree_insert(), auth_zone::rpz_az_next, auth_zone::rpz_az_prev, and auth_zones::ztree.
Referenced by auth_zone_create(), auth_zones_find_or_add_zone(), and authtest_addzone().
| struct auth_zone * auth_zone_find | ( | struct auth_zones * | az, |
| uint8_t * | nm, | ||
| size_t | nmlen, | ||
| uint16_t | dclass ) |
find an auth zone by name (exact match by name or NULL returned)
References auth_zone_find(), auth_zone::dclass, dname_count_labels(), rbnode_type::key, auth_zone::name, auth_zone::namelabs, auth_zone::namelen, auth_zone::node, rbtree_search(), and auth_zones::ztree.
Referenced by auth_xfer_set_expired(), auth_zone_find(), auth_zones_can_fallback(), auth_zones_check_changes(), auth_zones_find_or_add_zone(), auth_zones_find_zone(), auth_zones_lookup(), do_auth_zone_reload(), do_rpz_enable_disable(), xfr_process_reacquire_locks(), xfr_write_after_update(), and zone_write_after_update_reacq().
| struct auth_xfer * auth_xfer_find | ( | struct auth_zones * | az, |
| uint8_t * | nm, | ||
| size_t | nmlen, | ||
| uint16_t | dclass ) |
find an xfer zone by name (exact match by name or NULL returned)
References auth_xfer_find(), auth_xfer::dclass, dname_count_labels(), rbnode_type::key, auth_xfer::name, auth_xfer::namelabs, auth_xfer::namelen, auth_xfer::node, rbtree_search(), and auth_zones::xtree.
Referenced by auth_xfer_find(), auth_zones_check_changes(), auth_zones_find_or_add_xfer(), auth_zones_notify(), auth_zones_setup_zones(), auth_zones_startprobesequence(), az_delete_deleted_zones(), do_auth_zone_reload(), and fr_pickup_auth_locks().
|
static |
find an auth zone or sorted less-or-equal, return true if exact
References auth_zone_find_less_equal(), auth_zone::dclass, dname_count_labels(), rbnode_type::key, auth_zone::name, auth_zone::namelabs, auth_zone::namelen, auth_zone::node, rbtree_find_less_equal(), and auth_zones::ztree.
Referenced by auth_zone_find_less_equal(), and auth_zones_find_zone().
| struct auth_zone * auth_zones_find_zone | ( | struct auth_zones * | az, |
| uint8_t * | name, | ||
| size_t | name_len, | ||
| uint16_t | dclass ) |
find the auth zone that is above the given name
Find the auth zone that is above the given qname.
find the auth zone that is above the given name
Return NULL when there is no auth_zone above the give name, otherwise returns the closest auth_zone above the qname that pertains to it.
| az | auth zones structure. |
| name | query to look up for. |
| name_len | length of name. |
| dclass | class of zone to find. |
References auth_zone_find(), auth_zone_find_less_equal(), auth_zones_find_zone(), auth_zone::dclass, dname_count_size_labels(), dname_get_shared_topdomain(), dname_is_root(), dname_remove_label(), and auth_zone::name.
Referenced by auth_zone_delegpt(), auth_zones_downstream_answer(), and auth_zones_find_zone().
|
static |
find or create zone with name str.
caller must have lock on az. returns a wrlocked zone
References auth_zone_create(), auth_zone_find(), auth_zones_find_or_add_zone(), LDNS_MAX_DOMAINLEN, LDNS_RR_CLASS_IN, auth_zone::lock, log_err(), auth_zone::name, and sldns_str2wire_dname_buf().
Referenced by auth_zones_cfg(), and auth_zones_find_or_add_zone().
|
static |
find or create xfer zone with name str.
caller must have lock on az. returns a locked xfer
References auth_xfer_create(), auth_xfer_find(), auth_zones_find_or_add_xfer(), auth_zone::dclass, auth_xfer::lock, auth_zone::name, and auth_zone::namelen.
Referenced by auth_zones_cfg(), and auth_zones_find_or_add_xfer().
| int auth_zone_set_zonefile | ( | struct auth_zone * | z, |
| char * | zonefile ) |
set auth zone zonefile string.
caller must have lock on zone
References auth_zone_set_zonefile(), log_err(), and auth_zone::zonefile.
Referenced by auth_zone_set_zonefile(), auth_zones_cfg(), and authtest_addzone().
| int auth_zone_set_fallback | ( | struct auth_zone * | z, |
| char * | fallbackstr ) |
set auth zone fallback.
caller must have lock on zone
caller must have lock on zone. fallbackstr is "yes" or "no". false on parse failure.
References auth_zone_set_fallback(), auth_zone::fallback_enabled, and log_err().
Referenced by auth_zone_set_fallback().
create domain with the given name
References az_domain_create(), auth_zone::data, dname_count_labels(), rbnode_type::key, log_warn(), memdup(), auth_data::name, auth_data::namelabs, auth_data::namelen, auth_data::node, and rbtree_insert().
Referenced by az_domain_create(), and az_domain_find_or_create().
find domain with exactly the given name
References az_find_name(), auth_zone::data, dname_count_labels(), rbnode_type::key, auth_zone::name, auth_zone::namelabs, auth_zone::namelen, auth_zone::node, and rbtree_search().
Referenced by auth_zone_get_serial(), auth_zone_get_soa_rrset(), auth_zone_verify_zonemd_key_with_ds(), auth_zone_verify_zonemd_with_key(), auth_zone_zonemd_check_hash(), az_add_additionals_from(), az_add_negative_soa(), az_domain_find_or_create(), az_domain_go_up(), az_find_candidate_ce(), az_find_name(), az_find_nsec_cover(), az_find_wildcard_domain(), az_nsec3_find_exact(), az_nsec3_param(), az_remove_rr(), follow_cname_chain(), xfr_find_soa(), and zonemd_get_dnskey_from_anchor().
|
static |
Find domain name (or closest match).
References az_find_domain(), auth_zone::data, dname_count_labels(), rbnode_type::key, auth_zone::name, auth_zone::namelabs, auth_zone::namelen, auth_zone::node, query_info::qname, query_info::qname_len, and rbtree_find_less_equal().
Referenced by auth_zone_generate_answer(), az_find_domain(), az_nsec3_findnode(), and az_nsec_wildcard_denial().
|
static |
find or create domain with name in zone
References az_domain_create(), az_domain_find_or_create(), and az_find_name().
Referenced by az_domain_find_or_create(), and az_insert_rr().
|
static |
find rrset of given type in the domain
References az_domain_rrset(), auth_rrset::next, auth_data::rrsets, and auth_rrset::type.
Referenced by addrrsigtype_if_needed(), auth_zone_get_serial(), auth_zone_get_soa_rrset(), auth_zone_verify_zonemd_key_with_ds(), auth_zone_verify_zonemd_with_key(), auth_zone_write_domain(), auth_zone_zonemd_check_hash(), az_add_additionals_from(), az_add_negative_soa(), az_domain_add_rr(), az_domain_remove_rr(), az_domain_rrset(), az_find_ce(), az_find_nsec_cover(), az_generate_answer_with_node(), az_generate_any_answer(), az_generate_notype_answer(), az_generate_referral_answer(), az_generate_wildcard_answer(), az_nsec3_find_cover(), az_nsec3_find_exact(), az_nsec3_findnode(), az_nsec3_param(), follow_cname_chain(), xfr_find_soa(), zonemd_check_dnssec_absence(), zonemd_check_dnssec_soazonemd(), and zonemd_get_dnskey_from_anchor().
|
static |
remove rrset of this type from domain
References auth_rrset_delete(), domain_remove_rrset(), auth_rrset::next, auth_data::rrsets, and auth_rrset::type.
Referenced by az_domain_remove_rr(), domain_remove_rrset(), and rrset_moveover_rrsigs().
|
static |
find an rrsig index in the rrset.
returns true if found
References az_rrset_find_rrsig(), packed_rrset_data::count, packed_rrset_data::rr_data, packed_rrset_data::rr_len, and packed_rrset_data::rrsig_count.
Referenced by az_domain_remove_rr(), and az_rrset_find_rrsig().
|
static |
see if rdata is duplicate
References packed_rrset_data::count, rdata_duplicate(), packed_rrset_data::rr_data, packed_rrset_data::rr_len, and packed_rrset_data::rrsig_count.
Referenced by az_domain_add_rr(), rdata_duplicate(), and rrsigs_copy_from_rrset_to_rrsigset().
|
static |
get rrsig type covered from rdata.
| rdata | rdata in wireformat, starting with 16bit rdlength. |
| rdatalen | length of rdata buffer. |
References rrsig_rdata_get_type_covered().
Referenced by az_domain_add_rr(), az_domain_remove_rr(), rrset_moveover_rrsigs(), rrsig_num_that_cover(), rrsig_rdata_get_type_covered(), and zonemd_simple_count_rrsig().
|
static |
remove RR from existing RRset.
Also sig, if it is a signature. reallocates the packed rrset for a new one, false on alloc failure
References packed_rrset_data::count, auth_rrset::data, log_err(), packed_rrset_ptr_fixup(), packed_rrset_sizeof(), packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, rrset_remove_rr(), packed_rrset_data::rrsig_count, packed_rrset_data::security, packed_rrset_data::trust, and packed_rrset_data::ttl.
Referenced by az_domain_remove_rr(), and rrset_remove_rr().
|
static |
add RR to existing RRset.
If insert_sig is true, add to rrsigs. This reallocates the packed rrset for a new one
References packed_rrset_data::count, auth_rrset::data, log_err(), packed_rrset_ptr_fixup(), packed_rrset_sizeof(), packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, rrset_add_rr(), packed_rrset_data::rrsig_count, and packed_rrset_data::ttl.
Referenced by az_domain_add_rr(), rrset_add_rr(), and rrsigs_copy_from_rrset_to_rrsigset().
|
static |
Create new rrset for node with packed rrset with one RR element.
References packed_rrset_data::count, auth_rrset::data, log_err(), auth_rrset::next, packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, rrset_create(), rrset_trust_prim_noglue, auth_data::rrsets, packed_rrset_data::trust, packed_rrset_data::ttl, and auth_rrset::type.
Referenced by az_domain_add_rr(), and rrset_create().
|
static |
count number (and size) of rrsigs that cover a type
References packed_rrset_data::count, auth_rrset::data, LDNS_RR_TYPE_RRSIG, log_assert, packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rrsig_count, rrsig_num_that_cover(), rrsig_rdata_get_type_covered(), and auth_rrset::type.
Referenced by rrset_moveover_rrsigs(), and rrsig_num_that_cover().
|
static |
See if rrsig set has covered sigs for rrset and move them over.
References packed_rrset_data::count, auth_rrset::data, domain_remove_rrset(), LDNS_RR_TYPE_RRSIG, log_assert, log_err(), packed_rrset_ptr_fixup(), packed_rrset_sizeof(), packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, rrset_moveover_rrsigs(), packed_rrset_data::rrsig_count, rrsig_num_that_cover(), rrsig_rdata_get_type_covered(), packed_rrset_data::ttl, and auth_rrset::type.
Referenced by az_domain_add_rr(), and rrset_moveover_rrsigs().
|
static |
copy the rrsigs from the rrset to the rrsig rrset, because the rrset is going to be deleted.
reallocates the RRSIG rrset data.
References packed_rrset_data::count, auth_rrset::data, rdata_duplicate(), packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, rrset_add_rr(), packed_rrset_data::rrsig_count, and rrsigs_copy_from_rrset_to_rrsigset().
Referenced by az_domain_remove_rr(), and rrsigs_copy_from_rrset_to_rrsigset().
|
static |
Add rr to node, ignores duplicate RRs, rdata points to buffer with rdatalen octets, starts with 2bytelength.
References az_domain_add_rr(), az_domain_rrset(), auth_rrset::data, LDNS_RR_TYPE_RRSIG, rdata_duplicate(), rrset_add_rr(), rrset_create(), rrset_moveover_rrsigs(), and rrsig_rdata_get_type_covered().
Referenced by az_domain_add_rr(), and az_insert_rr().
|
static |
insert RR into zone, ignore duplicates
References auth_data_delete(), az_domain_add_rr(), az_domain_find_or_create(), az_insert_rr(), auth_zone::data, auth_zone::dclass, dname_str(), dname_subdomain_c(), LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, log_err(), auth_zone::name, auth_zone::namelen, auth_data::node, rbtree_delete(), auth_zone::rpz, rpz_insert_rr(), sldns_wirerr_get_class(), sldns_wirerr_get_rdatalen(), sldns_wirerr_get_rdatawl(), sldns_wirerr_get_ttl(), sldns_wirerr_get_type(), VERB_ALGO, and verbose().
Referenced by az_insert_rr(), az_insert_rr_decompress(), az_parse_file(), and http_parse_add_rr().
|
static |
Remove rr from node, ignores nonexisting RRs, rdata points to buffer with rdatalen octets, starts with 2bytelength.
References az_domain_remove_rr(), az_domain_rrset(), az_rrset_find_rrsig(), packed_rrset_data::count, auth_rrset::data, domain_remove_rrset(), LDNS_RR_TYPE_RRSIG, packed_rrset_find_rr(), rrset_remove_rr(), packed_rrset_data::rrsig_count, rrsig_rdata_get_type_covered(), rrsigs_copy_from_rrset_to_rrsigset(), and auth_rrset::type.
Referenced by az_domain_remove_rr(), and az_remove_rr().
|
static |
remove RR from zone, ignore if it does not exist, false on alloc failure
References auth_data_delete(), az_domain_remove_rr(), az_find_name(), az_remove_rr(), auth_zone::data, auth_zone::dclass, log_err(), auth_zone::name, auth_zone::namelen, auth_data::node, rbtree_delete(), auth_zone::rpz, rpz_remove_rr(), sldns_wirerr_get_class(), sldns_wirerr_get_rdatalen(), sldns_wirerr_get_rdatawl(), and sldns_wirerr_get_type().
Referenced by az_remove_rr(), and az_remove_rr_decompress().
|
static |
decompress an RR into the buffer where it'll be an uncompressed RR with uncompressed dname and uncompressed rdata (dnames)
References sldns_struct_rr_descriptor::_dname_count, sldns_struct_rr_descriptor::_wireformat, decompress_rr_into_buffer(), dname_pkt_copy(), get_rdf_size(), LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_STR, pkt_dname_len_budget(), sldns_buffer_available(), sldns_buffer_begin(), sldns_buffer_clear(), sldns_buffer_current(), sldns_buffer_flip(), sldns_buffer_init_frm_data(), sldns_buffer_position(), sldns_buffer_set_position(), sldns_buffer_skip(), sldns_buffer_write(), sldns_buffer_write_u16(), sldns_buffer_write_u16_at(), sldns_buffer_write_u32(), and sldns_rr_descript().
Referenced by az_insert_rr_decompress(), az_remove_rr_decompress(), and decompress_rr_into_buffer().
|
static |
insert RR into zone, from packet, decompress RR, if duplicate is nonNULL set the flag but otherwise ignore duplicates
References az_insert_rr(), az_insert_rr_decompress(), decompress_rr_into_buffer(), dname_valid(), log_err(), sldns_buffer_begin(), and sldns_buffer_limit().
Referenced by apply_axfr(), apply_ixfr(), and az_insert_rr_decompress().
|
static |
remove RR from zone, from packet, decompress RR, if nonexist is nonNULL set the flag but otherwise ignore nonexisting entries
References az_remove_rr(), az_remove_rr_decompress(), decompress_rr_into_buffer(), dname_valid(), log_err(), sldns_buffer_begin(), and sldns_buffer_limit().
Referenced by apply_ixfr(), and az_remove_rr_decompress().
|
static |
Parse zonefile.
| z | zone to read in. |
| in | file to read from (just opened). |
| rr | buffer to use for RRs, 64k. passed so that recursive includes can use the same buffer and do not grow the stack too much. |
| rrbuflen | sizeof rr buffer. |
| state | parse state with $ORIGIN, $TTL and 'prev-dname' and so on, that is kept between includes. The lineno is set at 1 and then increased by the function. |
| fname | file name. |
| depth | recursion depth for includes |
| cfg | config for chroot. returns false on failure, has printed an error message |
References az_insert_rr(), az_parse_file(), config_file::chrootdir, sldns_file_parse_state::lineno, log_err(), sldns_fp2wire_rr_buf(), sldns_get_errorstr_parse(), sldns_wire2str_type_buf(), sldns_wirerr_get_type(), VERB_ALGO, verbose(), and auth_zone::zone_is_slave.
Referenced by auth_zone_read_zonefile(), and az_parse_file().
| void auth_zone_clear_data | ( | struct auth_zone * | z | ) |
Clear data in auth zone.
References auth_data_cmp(), auth_data_del(), auth_zone_clear_data(), auth_zone::data, rbtree_init(), auth_zone::rpz, rpz_clear(), and traverse_postorder().
Referenced by apply_axfr(), apply_http(), auth_zone_clear_data(), auth_zonemd_dnskey_lookup_callback(), auth_zones_read_zones(), do_auth_zone_reload(), and xfr_process_chunk_list().
| int auth_zone_read_zonefile | ( | struct auth_zone * | z, |
| struct config_file * | cfg ) |
read auth zone from zonefile.
caller must lock zone. false on failure
References auth_data_cmp(), auth_data_del(), auth_zone_read_zonefile(), az_parse_file(), config_file::chrootdir, auth_zone::data, sldns_file_parse_state::default_ttl, dname_str(), LDNS_MAX_DOMAINLEN, LDNS_RR_BUF_SIZE, log_err(), log_warn(), auth_zone::name, auth_zone::namelen, sldns_file_parse_state::origin, sldns_file_parse_state::origin_len, rbtree_init(), auth_zone::rpz, rpz_clear(), rpz_finish_config(), sldns_wire2str_dname(), traverse_postorder(), VERB_ALGO, verbose(), verbosity, auth_zone::zone_is_slave, and auth_zone::zonefile.
Referenced by auth_zone_read_zonefile(), auth_zones_read_zones(), authtest_addzone(), and do_auth_zone_reload().
|
static |
write buffer to file and check return codes
References log_err(), and write_out().
Referenced by auth_zone_write_chunks(), auth_zone_write_rrset(), and write_out().
|
static |
convert auth rr to string
References auth_rr_to_string(), packed_rrset_data::count, LDNS_RR_TYPE_RRSIG, log_nametypeclass(), packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, sldns_calc_keytag_raw(), sldns_wire2str_class_print(), sldns_wire2str_dname_scan(), sldns_wire2str_rdata_scan(), and sldns_wire2str_type_print().
Referenced by auth_rr_to_string(), and auth_zone_write_rrset().
|
static |
write rrset to file
References auth_rr_to_string(), auth_zone_write_rrset(), packed_rrset_data::count, auth_rrset::data, auth_zone::dclass, LDNS_RR_BUF_SIZE, auth_data::name, auth_data::namelen, packed_rrset_data::rrsig_count, auth_rrset::type, VERB_ALGO, verbose(), and write_out().
Referenced by auth_zone_write_domain(), and auth_zone_write_rrset().
write domain to file
References auth_zone_write_domain(), auth_zone_write_rrset(), az_domain_rrset(), LDNS_RR_TYPE_SOA, auth_data::namelen, auth_zone::namelen, auth_rrset::next, auth_data::rrsets, and auth_rrset::type.
Referenced by auth_zone_write_domain(), and auth_zone_write_file().
| int auth_zone_write_file | ( | struct auth_zone * | z, |
| const char * | fname ) |
Write auth zone data to file, in zonefile format.
References auth_zone_write_domain(), auth_zone_write_file(), auth_zone::data, log_err(), and RBTREE_FOR.
Referenced by auth_zone_write_file(), check_read_exact(), and zone_write_after_update().
|
static |
offline verify for zonemd, while reading a zone file to immediately spot bad hashes in zonefile as they are read.
Creates temp buffers, but uses anchors and validation environment from the module_env.
References auth_zone_verify_zonemd(), module_env::cfg, log_err(), config_file::msg_buffer_size, module_env::now, regional_create(), regional_destroy(), module_env::scratch, module_env::scratch_buffer, sldns_buffer_free(), sldns_buffer_new(), auth_zone::zonemd_check, and zonemd_offline_verify().
Referenced by auth_zones_read_zones(), and zonemd_offline_verify().
|
static |
read all auth zones from file (if they have)
References auth_zone_clear_data(), auth_zone_read_zonefile(), auth_zones_read_zones(), auth_zone::lock, auth_zones::lock, RBTREE_FOR, auth_zone::zonefile, zonemd_offline_verify(), and auth_zones::ztree.
Referenced by auth_zones_apply_cfg(), and auth_zones_read_zones().
|
static |
fetch the content of a ZONEMD RR from the rdata
References packed_rrset_data::count, auth_rrset::data, packed_rrset_data::rr_data, packed_rrset_data::rr_len, and zonemd_fetch_parameters().
Referenced by auth_zone_zonemd_check_hash(), zonemd_fetch_parameters(), and zonemd_is_duplicate_scheme_hash().
|
static |
See if the ZONEMD scheme, hash occurs more than once.
| zonemd_rrset | the zonemd rrset to check with the RRs in it. |
| index | index of the original, this is allowed to have that scheme and hashalgo, but other RRs should not have it. |
| scheme | the scheme to check for. |
| hashalgo | the hash algorithm to check for. |
References packed_rrset_data::count, auth_rrset::data, VERB_ALGO, verbose(), zonemd_fetch_parameters(), and zonemd_is_duplicate_scheme_hash().
Referenced by auth_zone_zonemd_check_hash(), and zonemd_is_duplicate_scheme_hash().
|
static |
Check ZONEMDs if present for the auth zone.
Depending on config it can warn or fail on that. Checks the hash of the ZONEMD.
| z | auth zone to check for. caller must hold lock on zone. |
| env | module env for temp buffers. |
| reason | returned on failure. |
References auth_zone_generate_zonemd_check(), auth_zone_get_serial(), auth_zone_zonemd_check_hash(), az_domain_rrset(), az_find_name(), packed_rrset_data::count, auth_rrset::data, dname_str(), LDNS_MAX_DOMAINLEN, auth_zone::name, auth_zone::namelen, regional_free_all(), module_env::scratch, module_env::scratch_buffer, VERB_ALGO, verbose(), verbosity, zonemd_fetch_parameters(), and zonemd_is_duplicate_scheme_hash().
Referenced by auth_zone_verify_zonemd_with_key(), and auth_zone_zonemd_check_hash().
| struct auth_rrset * auth_zone_get_soa_rrset | ( | struct auth_zone * | z | ) |
find the apex SOA RRset, if it exists
find the apex SOA RRset, if it exists.
find the apex SOA RRset, if it exists
NULL if no SOA RRset.
References auth_zone_get_soa_rrset(), az_domain_rrset(), az_find_name(), LDNS_RR_TYPE_SOA, auth_zone::name, and auth_zone::namelen.
Referenced by auth_zone_get_soa_rrset(), and rpz_add_soa().
| int auth_zone_get_serial | ( | struct auth_zone * | z, |
| uint32_t * | serial ) |
find serial number of zone or false if none
find serial number of zone or false if none (no SOA record)
find serial number of zone or false if none
References auth_zone_get_serial(), az_domain_rrset(), az_find_name(), packed_rrset_data::count, auth_rrset::data, dname_valid(), LDNS_RR_TYPE_SOA, auth_zone::name, auth_zone::namelen, packed_rrset_data::rr_data, and packed_rrset_data::rr_len.
Referenced by auth_zone_get_serial(), auth_zone_zonemd_check_hash(), auth_zones_check_changes(), and do_list_auth_zones().
Find auth_zone SOA and populate the values in xfr(soa values).
References az_domain_rrset(), az_find_name(), packed_rrset_data::count, auth_rrset::data, dname_valid(), auth_xfer::expiry, auth_xfer::have_zone, LDNS_RR_TYPE_SOA, auth_zone::name, auth_zone::namelen, auth_xfer::refresh, auth_xfer::retry, packed_rrset_data::rr_data, packed_rrset_data::rr_len, auth_xfer::serial, and xfr_find_soa().
Referenced by auth_xfer_setup(), do_auth_zone_reload(), fr_worker_auth_add(), xfr_find_soa(), and xfr_process_chunk_list().
Setup auth_xfer zone This populates the have_zone, soa values, and so on times.
Doesn't do network traffic yet, can set option flags.
| z | locked by caller, and modified for setup |
| x | locked by caller, and modified. |
References auth_xfer_setup(), auth_xfer::is_rpz, auth_zone::rpz, and xfr_find_soa().
Referenced by auth_xfer_setup(), and auth_zones_setup_zones().
|
static |
Setup all zones.
| az | auth zones structure |
References auth_xfer_find(), auth_xfer_setup(), auth_zones_setup_zones(), auth_zone::dclass, auth_xfer::lock, auth_zone::lock, auth_zones::lock, auth_zone::name, auth_zone::namelen, RBTREE_FOR, and auth_zones::ztree.
Referenced by auth_zones_apply_cfg(), and auth_zones_setup_zones().
|
static |
set config items and create zones
References auth_xfer::allow_notify_list, auth_zone_set_zonefile(), auth_zones_cfg(), auth_zones_find_or_add_xfer(), auth_zones_find_or_add_zone(), auth_zone::fallback_enabled, config_auth::fallback_enabled, auth_zone::for_downstream, config_auth::for_downstream, auth_zone::for_upstream, config_auth::for_upstream, auth_zones::have_downstream, config_auth::isrpz, auth_xfer::lock, auth_zone::lock, auth_zones::lock, log_err(), auth_probe::masters, auth_transfer::masters, config_auth::masters, auth_zone::max_transfer_size, config_auth::max_transfer_size, auth_zone::max_transfer_time, config_auth::max_transfer_time, config_auth::name, probe_copy_masters_for_allow_notify(), auth_zone::rpz, auth_zone::rpz_az_next, auth_zone::rpz_az_prev, rpz_config(), rpz_create(), auth_zones::rpz_first, auth_zones::rpz_lock, auth_xfer::task_probe, auth_xfer::task_transfer, config_auth::urls, xfer_set_masters(), auth_zone::zone_deleted, auth_zone::zone_is_slave, config_auth::zonefile, auth_zone::zonemd_check, config_auth::zonemd_check, auth_zone::zonemd_reject_absence, and config_auth::zonemd_reject_absence.
Referenced by auth_zones_apply_cfg(), and auth_zones_cfg().
|
static |
set all auth zones deleted, then in auth_zones_cfg, it marks them as nondeleted (if they are still in the config), and then later we can find deleted zones
References az_setall_deleted(), auth_zone::lock, auth_zones::lock, RBTREE_FOR, auth_zone::zone_deleted, and auth_zones::ztree.
Referenced by auth_zones_apply_cfg(), and az_setall_deleted().
|
static |
find zones that are marked deleted and delete them.
This is called from apply_cfg, and there are no threads and no workers, so the xfr can just be deleted.
References auth_xfer_delete(), auth_xfer_find(), auth_zone_delete(), az_delete_deleted_zones(), auth_zone::dclass, auth_zone::delete_next, auth_zone::lock, auth_zones::lock, auth_zone::name, auth_zone::namelen, auth_xfer::node, auth_zone::node, rbtree_delete(), RBTREE_FOR, auth_zones::xtree, auth_zone::zone_deleted, and auth_zones::ztree.
Referenced by auth_zones_apply_cfg(), and az_delete_deleted_zones().
| int auth_zones_apply_cfg | ( | struct auth_zones * | az, |
| struct config_file * | cfg, | ||
| int | setup, | ||
| int | readauth, | ||
| int * | is_rpz, | ||
| struct module_env * | env, | ||
| struct module_stack * | mods ) |
Apply configuration to auth zones.
Reads zonefiles.
| az | auth zones structure |
| cfg | config to apply. |
| setup | if true, also sets up values in the auth zones structure |
| readauth | if true, reads zone files. False to omit zone file read, for use by checkconf. |
| is_rpz | set to 1 if at least one RPZ zone is configured. |
| env | environment for offline verification. |
| mods | modules in environment. |
References auth_zones_apply_cfg(), auth_zones_cfg(), auth_zones_read_zones(), auth_zones_setup_zones(), config_file::auths, az_delete_deleted_zones(), az_setall_deleted(), config_auth::isrpz, log_err(), log_warn(), config_auth::name, and config_auth::next.
Referenced by auth_zones_apply_cfg(), check_auth(), context_finalize(), daemon_fork(), and fr_construct_from_config().
|
static |
delete chunks
| at | transfer structure with chunks list. The chunks and their data are freed. |
References auth_chunk_list_delete(), auth_chunks_delete(), auth_transfer::chunks_first, auth_transfer::chunks_last, and auth_transfer::chunks_total.
Referenced by auth_chunks_delete(), auth_xfer_delete(), auth_xfer_transfer_http_callback(), auth_xfer_transfer_tcp_callback(), auth_xfer_transfer_timer_callback(), auth_zones_cleanup(), process_list_end_transfer(), xfr_process_chunk_list(), and xfr_transfer_disown().
|
static |
free master addr list
References auth_free_master_addrs(), and auth_addr::next.
Referenced by auth_addr_list_copy(), auth_free_master_addrs(), auth_free_masters(), and xfr_masterlist_free_addrs().
|
static |
free the masters list
References auth_free_master_addrs(), auth_free_masters(), auth_master::list, and auth_addr::next.
Referenced by auth_free_masters(), auth_xfer_delete(), and probe_copy_masters_for_allow_notify().
|
static |
helper traverse to delete zones
References auth_zone_del(), auth_zone_delete(), and rbnode_type::key.
Referenced by auth_zone_del(), and auth_zones_delete().
|
static |
helper traverse to delete xfer zones
References auth_xfer_del(), auth_xfer_delete(), and rbnode_type::key.
Referenced by auth_xfer_del(), and auth_zones_delete().
| void auth_zones_delete | ( | struct auth_zones * | az | ) |
Delete auth zones structure.
References auth_xfer_del(), auth_zone_del(), auth_zones_delete(), auth_zones::lock, auth_zones::rpz_lock, traverse_postorder(), auth_zones::xtree, and auth_zones::ztree.
Referenced by auth_zones_delete(), check_auth(), check_queries(), check_read_exact(), daemon_delete(), daemon_init(), fr_construct_clear(), ub_ctx_create_nopipe(), ub_ctx_delete(), zonemd_check_test(), zonemd_generate_test(), and zonemd_verify_test().
|
static |
true if domain has only nsec3
References domain_has_only_nsec3(), LDNS_RR_TYPE_RRSIG, auth_rrset::next, auth_data::rrsets, and auth_rrset::type.
Referenced by az_find_ce(), and domain_has_only_nsec3().
|
static |
see if the domain has a wildcard child '*.domain'
References az_find_name(), az_find_wildcard_domain(), and LDNS_MAX_DOMAINLEN.
Referenced by az_find_wildcard(), and az_find_wildcard_domain().
|
static |
find wildcard between qname and cename
References az_find_wildcard(), az_find_wildcard_domain(), dname_remove_label_limit_len(), dname_subdomain_c(), auth_zone::name, auth_data::namelen, auth_zone::namelen, auth_data::node, query_info::qname, and query_info::qname_len.
Referenced by az_find_wildcard(), and az_generate_answer_nonexistnode().
|
static |
domain is not exact, find first candidate ce (name that matches a part of qname) in tree
References az_find_candidate_ce(), az_find_name(), dname_count_size_labels(), dname_get_shared_topdomain(), dname_remove_label_limit_len(), auth_data::name, auth_zone::namelen, and query_info::qname.
Referenced by az_find_candidate_ce(), and az_find_ce().
go up the auth tree to next existing name.
References az_domain_go_up(), az_find_name(), dname_remove_label_limit_len(), auth_data::name, auth_data::namelen, and auth_zone::namelen.
Referenced by az_domain_go_up(), and az_find_ce().
|
static |
Find the closest encloser, an name that exists and is above the qname.
return true if the node (param node) is existing, nonobscured and can be used to generate answers from. It is then also node_exact. returns false if the node is not good enough (or it wasn't node_exact) in this case the ce can be filled. if ce is NULL, no ce exists, and likely the zone is completely empty, not even with a zone apex. if ce is nonNULL it is the closest enclosing upper name (that exists itself for answer purposes). That name may have DNAME, NS or wildcard rrset is the closest DNAME or NS rrset that was found.
References az_domain_go_up(), az_domain_rrset(), az_find_candidate_ce(), az_find_ce(), domain_has_only_nsec3(), LDNS_RR_TYPE_DNAME, LDNS_RR_TYPE_DS, LDNS_RR_TYPE_NS, auth_data::namelen, auth_zone::namelen, auth_data::node, query_info::qname_len, and query_info::qtype.
Referenced by auth_zone_generate_answer(), and az_find_ce().
|
static |
add additional A/AAAA from domain names in rrset rdata (+offset) offset is number of bytes in rdata where the dname is located.
References az_add_additionals_from(), az_domain_rrset(), az_find_name(), packed_rrset_data::count, auth_rrset::data, dname_valid(), LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, msg_add_rrset_ar(), packed_rrset_data::rr_data, and packed_rrset_data::rr_len.
Referenced by az_add_additionals_from(), az_generate_positive_answer(), and az_generate_referral_answer().
|
static |
add negative SOA record (with negative TTL)
References az_add_negative_soa(), az_domain_rrset(), az_find_name(), packed_rrset_data::count, lruhash_entry::data, ub_packed_rrset_key::entry, get_rrset_ttl(), LDNS_RR_TYPE_SOA, log_assert, msg_add_rrset_ns(), auth_zone::name, auth_zone::namelen, reply_info::prefetch_ttl, PREFETCH_TTL_CALC, dns_msg::rep, packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, reply_info::rrset_count, reply_info::rrsets, packed_rrset_data::rrsig_count, SERVE_EXPIRED_TTL, reply_info::serve_expired_ttl, packed_rrset_data::ttl, and reply_info::ttl.
Referenced by az_add_negative_soa(), az_generate_notype_answer(), and az_generate_nxdomain_answer().
|
static |
See if the query goes to empty nonterminal (that has no auth_data, but there are nodes underneath.
We already checked that there are not NS, or DNAME above, so that we only need to check if some node exists below (with nonempty rr list), return true if emptynonterminal
References az_empty_nonterminal(), auth_zone::data, dname_strict_subdomain_c(), auth_data::name, auth_data::node, query_info::qname, rbtree_first(), rbtree_next(), RBTREE_NULL, and auth_data::rrsets.
Referenced by az_empty_nonterminal(), and az_generate_answer_nonexistnode().
|
static |
create synth cname target name in buffer, or fail if too long
References synth_cname_buf().
Referenced by create_synth_cname(), and synth_cname_buf().
|
static |
create synthetic CNAME rrset for in a DNAME answer in region, false on alloc failure, cname==NULL when name too long.
References packed_rrset_data::count, create_synth_cname(), auth_rrset::data, dname_valid(), LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_CNAME, auth_data::namelen, packed_rrset_ptr_fixup(), regional_alloc(), regional_alloc_init(), regional_alloc_zero(), packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, rrset_key_hash(), rrset_trust_ans_noAA, packed_rrset_data::rrsig_count, synth_cname_buf(), packed_rrset_data::trust, and packed_rrset_data::ttl.
Referenced by add_synth_cname(), and create_synth_cname().
|
static |
add a synthesized CNAME to the answer section
References add_synth_cname(), reply_info::an_numrrsets, create_synth_cname(), auth_zone::dclass, reply_info::flags, msg_grow_array(), msg_ttl(), dns_msg::rep, reply_info::rrset_count, and reply_info::rrsets.
Referenced by add_synth_cname(), and az_generate_dname_answer().
|
static |
Change a dname to a different one, for wildcard namechange.
References reply_info::an_numrrsets, az_change_dnames(), packed_rrset_key::dname, packed_rrset_key::dname_len, ub_packed_rrset_key::entry, lruhash_entry::hash, query_dname_compare(), dns_msg::rep, ub_packed_rrset_key::rk, reply_info::rrset_count, rrset_key_hash(), and reply_info::rrsets.
Referenced by az_change_dnames(), and az_generate_wildcard_answer().
|
static |
find NSEC record covering the query, with the given node in the zone
References az_domain_rrset(), az_find_name(), az_find_nsec_cover(), dname_remove_label_limit_len(), log_assert, and auth_zone::namelen.
Referenced by az_find_nsec_cover(), az_generate_nxdomain_answer(), az_generate_wildcard_answer(), and az_nsec_wildcard_denial().
|
static |
Find NSEC and add for wildcard denial.
References az_find_domain(), az_find_nsec_cover(), az_nsec_wildcard_denial(), LDNS_MAX_DOMAINLEN, msg_add_rrset_ns(), auth_data::node, query_info::qclass, query_info::qname, query_info::qname_len, and query_info::qtype.
Referenced by az_generate_nxdomain_answer(), and az_nsec_wildcard_denial().
|
static |
Find the NSEC3PARAM rrset (if any) and if true you have the parameters.
References az_domain_rrset(), az_find_name(), az_nsec3_param(), packed_rrset_data::count, auth_rrset::data, auth_zone::name, auth_zone::namelen, nsec3_hash_algo_size_supported(), NSEC3_UNKNOWN_FLAGS, packed_rrset_data::rr_data, and packed_rrset_data::rr_len.
Referenced by az_add_nsec3_proof(), az_nsec3_param(), and zonemd_check_dnssec_absence().
|
static |
Hash a name with nsec3param into buffer, it has zone name appended.
return length of hash
References az_nsec3_hash(), LDNS_MAX_DOMAINLEN, N3HASHBUFLEN, nsec3_hash_algo_size_supported(), query_dname_tolower(), and secalgo_nsec3_hash().
Referenced by az_nsec3_hash(), and az_nsec3_hashname().
|
static |
Hash name and return b32encoded hashname for lookup, zone name appended.
References az_nsec3_hash(), az_nsec3_hashname(), N3HASHBUFLEN, auth_zone::name, and auth_zone::namelen.
Referenced by az_nsec3_find_cover(), az_nsec3_find_exact(), and az_nsec3_hashname().
|
static |
Find the datanode that covers the nsec3hash-name.
References az_domain_rrset(), az_find_domain(), az_nsec3_findnode(), auth_data::node, query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, RBTREE_NULL, and rbtree_previous().
Referenced by az_nsec3_find_cover(), and az_nsec3_findnode().
|
static |
Find cover for hashed(nm, nmlen) (or NULL).
References az_domain_rrset(), az_nsec3_find_cover(), az_nsec3_findnode(), az_nsec3_hashname(), auth_zone::data, LDNS_MAX_DOMAINLEN, auth_data::node, rbtree_last(), RBTREE_NULL, and rbtree_previous().
Referenced by az_add_nsec3_proof(), and az_nsec3_find_cover().
|
static |
Find exact match for hashed(nm, nmlen) NSEC3 record or NULL.
References az_domain_rrset(), az_find_name(), az_nsec3_find_exact(), az_nsec3_hashname(), LDNS_MAX_DOMAINLEN, and auth_data::node.
Referenced by az_add_nsec3_proof(), az_nsec3_find_ce(), az_nsec3_find_exact(), and zonemd_check_dnssec_absence().
|
static |
Return nextcloser name (as a ref into the qname).
This is one label more than the cenm (cename must be a suffix of qname)
References az_nsec3_get_nextcloser(), dname_count_labels(), dname_remove_labels(), dname_strict_subdomain(), and log_assert.
Referenced by az_add_nsec3_proof(), and az_nsec3_get_nextcloser().
|
static |
Find the closest encloser that has exact NSEC3.
updated cenm to the new name. If it went up no-exact-ce is true.
References az_nsec3_find_ce(), az_nsec3_find_exact(), dname_remove_label_limit_len(), auth_zone::namelen, and auth_data::node.
Referenced by az_add_nsec3_proof(), and az_nsec3_find_ce().
|
static |
add NSEC3 records to the zone for the nsec3 proof.
Specify with the flags with parts of the proof are required. the ce is the exact matching name (for notype) but also delegation points. qname is the one where the nextcloser name can be derived from. If NSEC3 is not properly there (in the zone) nothing is added. always enabled: include nsec3 proving about the Closest Encloser. that is an exact match that should exist for it. If that does not exist, a higher exact match + nxproof is enabled (for some sort of opt-out empty nonterminal cases). nodataproof: search for exact match and include that instead. ceproof: include ce proof NSEC3 (omitted for wildcard replies). nxproof: include denial of the qname. wcproof: include denial of wildcard (wildcard.ce).
References az_add_nsec3_proof(), az_nsec3_find_ce(), az_nsec3_find_cover(), az_nsec3_find_exact(), az_nsec3_get_nextcloser(), az_nsec3_param(), LDNS_MAX_DOMAINLEN, and auth_data::node.
Referenced by az_add_nsec3_proof(), az_generate_notype_answer(), az_generate_nxdomain_answer(), az_generate_referral_answer(), and az_generate_wildcard_answer().
|
static |
generate answer for positive answer
References az_add_additionals_from(), az_generate_positive_answer(), LDNS_RR_TYPE_MX, LDNS_RR_TYPE_NS, LDNS_RR_TYPE_SRV, msg_add_rrset_an(), auth_data::node, and auth_rrset::type.
Referenced by az_generate_answer_with_node(), and az_generate_positive_answer().
|
static |
generate answer for type ANY answer
References az_domain_rrset(), az_generate_any_answer(), LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, LDNS_RR_TYPE_MX, LDNS_RR_TYPE_SOA, msg_add_rrset_an(), and auth_data::rrsets.
Referenced by az_generate_answer_with_node(), az_generate_any_answer(), and az_generate_wildcard_answer().
|
static |
follow cname chain and add more data to the answer section
References az_domain_rrset(), az_find_name(), packed_rrset_data::count, auth_rrset::data, dname_subdomain_c(), dname_valid(), follow_cname_chain(), LDNS_RR_TYPE_CNAME, MAX_CNAME_CHAIN, msg_add_rrset_an(), auth_zone::name, auth_data::node, packed_rrset_data::rr_data, and packed_rrset_data::rr_len.
Referenced by az_generate_cname_answer(), az_generate_dname_answer(), az_generate_wildcard_answer(), and follow_cname_chain().
|
static |
generate answer for cname answer
References az_generate_cname_answer(), auth_rrset::data, follow_cname_chain(), msg_add_rrset_an(), and query_info::qtype.
Referenced by az_generate_answer_with_node(), and az_generate_cname_answer().
|
static |
generate answer for notype answer
References az_add_negative_soa(), az_add_nsec3_proof(), az_domain_rrset(), az_generate_notype_answer(), msg_add_rrset_ns(), auth_data::name, auth_data::namelen, dns_msg::qinfo, query_info::qname, and query_info::qname_len.
Referenced by az_generate_answer_nonexistnode(), az_generate_answer_with_node(), az_generate_notype_answer(), and az_generate_wildcard_answer().
|
static |
generate answer for referral answer
References az_add_additionals_from(), az_add_nsec3_proof(), az_domain_rrset(), az_generate_referral_answer(), BIT_AA, reply_info::flags, LDNS_RR_TYPE_DS, log_assert, msg_add_rrset_ns(), auth_data::name, auth_data::namelen, dns_msg::qinfo, query_info::qname, query_info::qname_len, and dns_msg::rep.
Referenced by az_generate_answer_nonexistnode(), and az_generate_referral_answer().
|
static |
generate answer for DNAME answer
References add_synth_cname(), az_generate_dname_answer(), lruhash_entry::data, ub_packed_rrset_key::entry, reply_info::flags, FLAGS_GET_RCODE, follow_cname_chain(), log_assert, msg_add_rrset_an(), query_info::qname, query_info::qname_len, query_info::qtype, dns_msg::rep, reply_info::rrset_count, and reply_info::rrsets.
Referenced by az_generate_answer_nonexistnode(), and az_generate_dname_answer().
|
static |
generate answer for wildcard answer
References az_add_nsec3_proof(), az_change_dnames(), az_domain_rrset(), az_find_nsec_cover(), az_generate_any_answer(), az_generate_notype_answer(), az_generate_wildcard_answer(), auth_rrset::data, dname_remove_label_limit_len(), follow_cname_chain(), LDNS_RR_TYPE_ANY, LDNS_RR_TYPE_CNAME, msg_add_rrset_an(), msg_add_rrset_ns(), auth_data::name, auth_data::namelen, auth_zone::namelen, dns_msg::qinfo, query_info::qname, query_info::qname_len, query_info::qtype, and auth_data::rrsets.
Referenced by az_generate_answer_nonexistnode(), and az_generate_wildcard_answer().
|
static |
generate answer for nxdomain answer
References az_add_negative_soa(), az_add_nsec3_proof(), az_find_nsec_cover(), az_generate_nxdomain_answer(), az_nsec_wildcard_denial(), reply_info::flags, msg_add_rrset_ns(), auth_data::name, auth_data::namelen, dns_msg::qinfo, query_info::qname, query_info::qname_len, and dns_msg::rep.
Referenced by az_generate_answer_nonexistnode(), and az_generate_nxdomain_answer().
|
static |
Create answers when an exact match exists for the domain name.
References az_domain_rrset(), az_generate_answer_with_node(), az_generate_any_answer(), az_generate_cname_answer(), az_generate_notype_answer(), az_generate_positive_answer(), LDNS_RR_TYPE_ANY, LDNS_RR_TYPE_CNAME, and query_info::qtype.
Referenced by auth_zone_generate_answer(), and az_generate_answer_with_node().
|
static |
Generate answer without an existing-node that we can use.
So it'll be a referral, DNAME, notype, wildcard or nxdomain
References az_empty_nonterminal(), az_find_wildcard(), az_generate_answer_nonexistnode(), az_generate_dname_answer(), az_generate_notype_answer(), az_generate_nxdomain_answer(), az_generate_referral_answer(), az_generate_wildcard_answer(), LDNS_RR_TYPE_DNAME, LDNS_RR_TYPE_NS, auth_data::node, and auth_rrset::type.
Referenced by auth_zone_generate_answer(), and az_generate_answer_nonexistnode().
|
static |
Lookup answer in a zone.
References auth_zone_generate_answer(), az_find_ce(), az_find_domain(), az_generate_answer_nonexistnode(), az_generate_answer_with_node(), auth_zone::fallback_enabled, log_info(), msg_create(), auth_data::name, auth_zone::name, auth_data::namelen, auth_zone::namelen, auth_data::node, query_info::qname, query_info::qname_len, query_info::qtype, sldns_wire2str_dname_buf(), sldns_wire2str_type_buf(), auth_rrset::type, VERB_ALGO, and verbosity.
Referenced by auth_zone_generate_answer(), auth_zones_downstream_answer(), and auth_zones_lookup().
| int auth_zones_lookup | ( | struct auth_zones * | az, |
| struct query_info * | qinfo, | ||
| struct regional * | region, | ||
| struct dns_msg ** | msg, | ||
| int * | fallback, | ||
| uint8_t * | dp_nm, | ||
| size_t | dp_nmlen ) |
Use auth zones to lookup the answer to a query.
The query is from the iterator. And the auth zones attempts to provide the answer instead of going to the internet.
| az | auth zones structure. |
| qinfo | query info to lookup. |
| region | region to use to allocate the reply in. |
| msg | reply is stored here (if one). |
| fallback | if true, fallback to making a query to the internet. |
| dp_nm | name of delegation point to look for. This zone is used to answer the query. If the dp_nm is not found, fallback is set to true and false returned. |
| dp_nmlen | length of dp_nm. |
References auth_zone_find(), auth_zone_generate_answer(), auth_zones_lookup(), auth_zone::fallback_enabled, auth_zone::for_upstream, auth_zone::lock, auth_zones::lock, query_info::qclass, auth_zone::zone_expired, auth_zone::zonemd_callback_env, and auth_zone::zonemd_check.
Referenced by auth_zones_lookup(), processQueryTargets(), and q_ans_query().
|
static |
encode auth answer
References auth_answer_encode(), BIT_AA, edns_data::bits, EDNS_ADVERTISED_SIZE, EDNS_ADVERTISED_VERSION, EDNS_DO, edns_data::edns_version, error_encode(), edns_data::ext_rcode, reply_info::flags, FLAGS_GET_RCODE, inplace_cb_reply_local_call(), module_env::now_tv, dns_msg::rep, reply_info_answer_encode(), sldns_buffer_begin(), sldns_buffer_read_u16_at(), and edns_data::udp_size.
Referenced by auth_answer_encode(), and auth_zones_downstream_answer().
|
static |
encode auth error answer
References auth_error_encode(), BIT_AA, edns_data::bits, EDNS_ADVERTISED_SIZE, EDNS_ADVERTISED_VERSION, EDNS_DO, edns_data::edns_version, error_encode(), edns_data::ext_rcode, inplace_cb_reply_local_call(), module_env::now_tv, edns_data::opt_list_inplace_cb_out, sldns_buffer_begin(), sldns_buffer_read_u16_at(), and edns_data::udp_size.
Referenced by auth_error_encode(), and auth_zones_downstream_answer().
| int auth_zones_downstream_answer | ( | struct auth_zones * | az, |
| struct module_env * | env, | ||
| struct query_info * | qinfo, | ||
| struct edns_data * | edns, | ||
| struct comm_reply * | repinfo, | ||
| struct sldns_buffer * | buf, | ||
| struct regional * | temp ) |
Answer query from auth zone.
Create authoritative answer.
| az | auth zones structure. |
| env | the module environment. |
| qinfo | query info (parsed). |
| edns | edns info (parsed). |
| buf | buffer with query ID and flags, also for reply. |
| repinfo | reply information for a communication point. |
| temp | temporary storage region. |
References auth_answer_encode(), auth_error_encode(), auth_zone_generate_answer(), auth_zones_downstream_answer(), auth_zones_find_zone(), dname_remove_label(), auth_zone::fallback_enabled, auth_zone::for_downstream, auth_zones::have_downstream, LDNS_RR_TYPE_DS, query_info::local_alias, local_alias_shallow_copy_qname(), auth_zone::lock, auth_zones::lock, module_env::mesh, mesh_area::num_query_authzone_down, query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, auth_zone::zone_expired, auth_zone::zonemd_callback_env, and auth_zone::zonemd_check.
Referenced by auth_zones_downstream_answer(), handle_newq(), libworker_attach_mesh(), libworker_fg(), and worker_handle_request().
| int auth_zones_can_fallback | ( | struct auth_zones * | az, |
| uint8_t * | nm, | ||
| size_t | nmlen, | ||
| uint16_t | dclass ) |
see if the auth zone for the name can fallback
| az | auth zones |
| nm | name of delegation point. |
| nmlen | length of nm. |
| dclass | class of zone to look for. |
References auth_zone_find(), auth_zones_can_fallback(), auth_zone::dclass, auth_zone::fallback_enabled, auth_zone::for_upstream, auth_zone::lock, and auth_zones::lock.
Referenced by auth_zones_can_fallback(), processQueryResponse(), and processQueryTargets().
| int auth_zone_parse_notify_serial | ( | struct sldns_buffer * | pkt, |
| uint32_t * | serial ) |
process notify packet and read serial number from SOA.
returns 0 if no soa record in the notify
References auth_zone_parse_notify_serial(), LDNS_RR_TYPE_SOA, pkt_dname_len(), query_info_parse(), sldns_buffer_begin(), sldns_buffer_read_u16(), sldns_buffer_read_u32(), sldns_buffer_remaining(), sldns_buffer_set_position(), and sldns_buffer_skip().
Referenced by answer_notify(), and auth_zone_parse_notify_serial().
|
static |
print addr to str, and if not 53, append "@port_number", for logs.
References addr_is_ip6(), addr_port_to_str(), and addr_to_str().
Referenced by addr_port_to_str(), xfr_master_add_addrs(), xfr_probe_send_probe(), and xfr_transfer_init_fetch().
|
static |
see if addr appears in the list
References auth_addr::addr, addr_in_list(), auth_addr::addrlen, auth_addr::next, and sockaddr_cmp_addr().
Referenced by addr_in_list(), and addr_matches_master().
|
static |
check if an address matches a master specification (or one of its addresses in the addr list)
References addr_in_common(), addr_in_list(), addr_is_ip6(), addr_matches_master(), auth_master::allow_notify, extstrtoaddr(), auth_master::host, auth_master::http, auth_master::list, netblockstrtoaddr(), and sockaddr_cmp_addr().
Referenced by addr_matches_master(), and az_xfr_allowed_notify().
|
static |
check access list for notifies
References addr_matches_master(), auth_xfer::allow_notify_list, az_xfr_allowed_notify(), and auth_master::next.
Referenced by auth_zones_notify(), and az_xfr_allowed_notify().
|
static |
see if the serial means the zone has to be updated, i.e.
the serial is newer than the zone serial, or we have no zone
References auth_xfer::have_zone, auth_xfer::serial, xfr_serial_means_update(), and auth_xfer::zone_expired.
Referenced by auth_xfer_probe_udp_callback(), process_list_end_transfer(), xfr_process_notify(), and xfr_serial_means_update().
|
static |
note notify serial, updates the notify information in the xfr struct
References auth_xfer::notify_has_serial, auth_xfer::notify_received, auth_xfer::notify_serial, and xfr_note_notify_serial().
Referenced by xfr_note_notify_serial(), and xfr_process_notify().
|
static |
process a notify serial, start new probe or note serial.
xfr is locked
References auth_xfer::lock, auth_probe::only_lookup, auth_xfer::task_probe, xfr_note_notify_serial(), xfr_process_notify(), xfr_serial_means_update(), and xfr_start_probe().
Referenced by auth_zones_notify(), auth_zones_startprobesequence(), and xfr_process_notify().
| int auth_zones_notify | ( | struct auth_zones * | az, |
| struct module_env * | env, | ||
| uint8_t * | nm, | ||
| size_t | nmlen, | ||
| uint16_t | dclass, | ||
| struct sockaddr_storage * | addr, | ||
| socklen_t | addrlen, | ||
| int | has_serial, | ||
| uint32_t | serial, | ||
| int * | refused ) |
process notify for auth zones.
first checks the access list. Then processes the notify. This starts the probe sequence or it notes the serial number (if any)
| az | auth zones structure. |
| env | module env of the worker that is handling the notify. it will pick up the task probe (or transfer), unless already in progress by another worker. |
| nm | name of the zone. Uncompressed. from query. |
| nmlen | length of name. |
| dclass | class of zone. |
| addr | source address of notify |
| addrlen | length of addr. |
| has_serial | if true, the notify has a serial attached. |
| serial | the serial number, if has_serial is true. |
| refused | is set to true on failure to note refused access. |
References auth_xfer_find(), auth_zones_notify(), az_xfr_allowed_notify(), auth_xfer::lock, auth_zones::lock, and xfr_process_notify().
Referenced by answer_notify(), and auth_zones_notify().
| int auth_zones_startprobesequence | ( | struct auth_zones * | az, |
| struct module_env * | env, | ||
| uint8_t * | nm, | ||
| size_t | nmlen, | ||
| uint16_t | dclass ) |
for the zone and if not already going, starts the probe sequence.
false if zone cannot be found. This is like a notify arrived and was accepted for that zone.
References auth_xfer_find(), auth_zones_startprobesequence(), auth_xfer::dclass, auth_xfer::lock, auth_zones::lock, and xfr_process_notify().
Referenced by auth_zones_startprobesequence(), and do_auth_zone_transfer().
|
static |
set a zone expired
References auth_xfer_set_expired(), auth_zone_find(), module_env::auth_zones, auth_xfer::dclass, auth_xfer::lock, auth_zone::lock, auth_zones::lock, auth_xfer::name, auth_xfer::namelen, auth_xfer::zone_expired, and auth_zone::zone_expired.
Referenced by auth_xfer_set_expired(), and auth_xfer_timer().
|
static |
find master (from notify or probe) in list of masters
References find_master_by_host(), auth_master::host, auth_master::list, and auth_master::next.
Referenced by find_master_by_host(), xfr_probe_start_list(), and xfr_transfer_start_list().
|
static |
delete the looked up auth_addrs for all the masters in the list
References auth_free_master_addrs(), auth_master::list, auth_master::next, and xfr_masterlist_free_addrs().
Referenced by xfr_masterlist_free_addrs(), xfr_probe_start_lookups(), and xfr_transfer_start_lookups().
copy a list of auth_addrs
References auth_addr_list_copy(), auth_free_master_addrs(), log_err(), memdup(), and auth_addr::next.
Referenced by auth_addr_list_copy(), and auth_master_copy().
|
static |
copy a master to a new structure, NULL on alloc failure
References auth_addr_list_copy(), auth_master_copy(), auth_master::file, auth_master::host, auth_master::list, log_err(), memdup(), and auth_master::next.
Referenced by auth_master_copy(), and auth_master_copy_and_append().
|
static |
append the master to the copied list.
References auth_master_copy(), auth_master_copy_and_append(), auth_master::list, and auth_master::next.
Referenced by auth_master_copy_and_append(), and probe_copy_masters_for_allow_notify().
|
static |
start the lookups for task_transfer
References auth_transfer::lookup_aaaa, auth_transfer::lookup_target, auth_transfer::masters, auth_transfer::scan_addr, auth_xfer::task_transfer, xfr_masterlist_free_addrs(), and xfr_transfer_start_lookups().
Referenced by xfr_start_transfer(), and xfr_transfer_start_lookups().
|
static |
move to the next lookup of hostname for task_transfer
References module_env::cfg, config_file::do_ip4, config_file::do_ip6, auth_transfer::lookup_aaaa, auth_transfer::lookup_target, auth_master::next, auth_xfer::task_transfer, and xfr_transfer_move_to_next_lookup().
Referenced by auth_xfer_transfer_lookup_callback(), xfr_transfer_move_to_next_lookup(), and xfr_transfer_nexttarget_or_end().
|
static |
start the lookups for task_probe
References auth_probe::lookup_aaaa, auth_probe::lookup_target, auth_probe::masters, auth_probe::scan_addr, auth_xfer::task_probe, xfr_masterlist_free_addrs(), and xfr_probe_start_lookups().
Referenced by xfr_probe_start_lookups(), and xfr_start_probe().
|
static |
move to the next lookup of hostname for task_probe
References module_env::cfg, config_file::do_ip4, config_file::do_ip6, auth_probe::lookup_aaaa, auth_probe::lookup_target, auth_master::next, auth_xfer::task_probe, and xfr_probe_move_to_next_lookup().
Referenced by auth_xfer_probe_lookup_callback(), xfr_probe_move_to_next_lookup(), and xfr_probe_send_or_end().
|
static |
start the iteration of the task_transfer list of masters
References find_master_by_host(), auth_master::host, auth_master::list, auth_transfer::masters, auth_transfer::scan_addr, auth_transfer::scan_specific, auth_transfer::scan_target, auth_xfer::task_transfer, and xfr_transfer_start_list().
Referenced by xfr_start_transfer(), and xfr_transfer_start_list().
|
static |
start the iteration of the task_probe list of masters
References find_master_by_host(), auth_master::host, auth_master::list, auth_probe::masters, auth_probe::scan_addr, auth_probe::scan_specific, auth_probe::scan_target, auth_xfer::task_probe, and xfr_probe_start_list().
Referenced by xfr_probe_start_list(), and xfr_start_probe().
|
static |
pick up the master that is being scanned right now, task_transfer
References auth_transfer::scan_specific, auth_transfer::scan_target, auth_xfer::task_transfer, and xfr_transfer_current_master().
Referenced by auth_xfer_transfer_lookup_callback(), xfr_transfer_current_master(), and xfr_transfer_nexttarget_or_end().
|
static |
pick up the master that is being scanned right now, task_probe
References auth_probe::scan_specific, auth_probe::scan_target, auth_xfer::task_probe, and xfr_probe_current_master().
Referenced by auth_xfer_probe_lookup_callback(), auth_xfer_probe_udp_callback(), xfr_probe_current_master(), and xfr_probe_send_probe().
|
static |
true if at end of list, task_transfer
References auth_transfer::scan_specific, auth_transfer::scan_target, auth_xfer::task_transfer, and xfr_transfer_end_of_list().
Referenced by xfr_transfer_end_of_list(), and xfr_transfer_nexttarget_or_end().
|
static |
true if at end of list, task_probe
References auth_probe::scan_specific, auth_probe::scan_target, auth_xfer::task_probe, and xfr_probe_end_of_list().
Referenced by xfr_probe_end_of_list(), and xfr_probe_send_or_end().
|
static |
move to next master in list, task_transfer
References auth_master::list, auth_transfer::masters, auth_addr::next, auth_master::next, auth_transfer::scan_addr, auth_transfer::scan_specific, auth_transfer::scan_target, auth_xfer::task_transfer, and xfr_transfer_nextmaster().
Referenced by auth_xfer_transfer_http_callback(), auth_xfer_transfer_tcp_callback(), auth_xfer_transfer_timer_callback(), process_list_end_transfer(), xfr_transfer_nextmaster(), and xfr_transfer_nexttarget_or_end().
|
static |
move to next master in list, task_probe
References auth_master::list, auth_probe::masters, auth_addr::next, auth_master::next, auth_probe::scan_addr, auth_probe::scan_specific, auth_probe::scan_target, auth_xfer::task_probe, and xfr_probe_nextmaster().
Referenced by auth_xfer_probe_timer_callback(), auth_xfer_probe_udp_callback(), xfr_probe_nextmaster(), and xfr_probe_send_or_end().
|
static |
create SOA probe packet for xfr
References auth_xfer::dclass, LDNS_RR_TYPE_SOA, auth_xfer::name, auth_xfer::namelen, query_info::qclass, qinfo_query_encode(), query_info::qname, query_info::qname_len, query_info::qtype, sldns_buffer_write_u16_at(), and xfr_create_soa_probe_packet().
Referenced by xfr_create_soa_probe_packet(), and xfr_probe_send_probe().
|
static |
create IXFR/AXFR packet for xfr
References auth_xfer::dclass, auth_transfer::got_xfr_serial, auth_xfer::have_zone, auth_transfer::incoming_xfr_serial, auth_xfer::is_rpz, auth_master::ixfr, auth_transfer::ixfr_fail, LDNS_RR_TYPE_SOA, auth_xfer::name, auth_xfer::namelen, NUM_IXFR_BEFORE_AXFR, auth_xfer::num_ixfrs, auth_transfer::on_ixfr, auth_transfer::on_ixfr_is_axfr, query_info::qclass, qinfo_query_encode(), query_info::qname, query_info::qname_len, query_info::qtype, auth_transfer::rr_scan_num, auth_xfer::serial, sldns_buffer_clear(), sldns_buffer_flip(), sldns_buffer_limit(), sldns_buffer_set_position(), sldns_buffer_write_u16(), sldns_buffer_write_u16_at(), sldns_buffer_write_u32(), sldns_buffer_write_u8(), auth_xfer::task_transfer, and xfr_create_ixfr_packet().
Referenced by xfr_create_ixfr_packet(), and xfr_transfer_init_fetch().
|
static |
check if returned packet is OK
References check_packet_ok(), auth_xfer::dclass, dname_pkt_compare(), auth_probe::id, auth_xfer::name, auth_xfer::namelen, pkt_dname_len(), query_info::qtype, query_dname_compare(), sldns_buffer_at(), sldns_buffer_begin(), sldns_buffer_current(), sldns_buffer_limit(), sldns_buffer_position(), sldns_buffer_read_u16(), sldns_buffer_read_u32(), sldns_buffer_remaining(), sldns_buffer_skip(), and auth_xfer::task_probe.
Referenced by auth_xfer_probe_udp_callback(), and check_packet_ok().
|
static |
read one line from chunks into buffer at current position
References chunkline_get_line(), auth_chunk::next, sldns_buffer_remaining(), sldns_buffer_write_u8(), VERB_ALGO, and verbose().
Referenced by chunkline_get_line(), and chunkline_get_line_collated().
| int chunkline_count_parens | ( | sldns_buffer * | buf, |
| size_t | start ) |
count number of open and closed parenthesis in a chunkline
References chunkline_count_parens(), sldns_buffer_position(), and sldns_buffer_read_u8_at().
Referenced by auth_zonemd_dnskey_lookup_callback(), authzone_chunkline_count_parens_test(), chunkline_count_parens(), and chunkline_get_line_collated().
|
static |
remove trailing ;... comment from a line in the chunkline buffer
References chunkline_remove_trailcomment(), sldns_buffer_position(), sldns_buffer_read_u8_at(), and sldns_buffer_set_position().
Referenced by chunkline_get_line_collated(), and chunkline_remove_trailcomment().
|
static |
see if a chunkline is a comment line (or empty line)
References chunkline_is_comment_line_or_empty(), sldns_buffer_limit(), and sldns_buffer_read_u8_at().
Referenced by apply_http(), chunkline_is_comment_line_or_empty(), and chunkline_non_comment_RR().
|
static |
find a line with ( ) collated
References chunkline_count_parens(), chunkline_get_line(), chunkline_get_line_collated(), chunkline_remove_trailcomment(), sldns_buffer_capacity(), sldns_buffer_clear(), sldns_buffer_flip(), sldns_buffer_limit(), sldns_buffer_position(), sldns_buffer_remaining(), sldns_buffer_write_u8_at(), VERB_ALGO, and verbose().
Referenced by apply_http(), chunkline_get_line_collated(), and chunkline_non_comment_RR().
|
static |
process $ORIGIN for http, 0 nothing, 1 done, 2 error
References http_parse_origin(), sldns_file_parse_state::origin, sldns_file_parse_state::origin_len, sldns_buffer_begin(), sldns_str2wire_dname_buf(), and sldns_strip_ws().
Referenced by apply_http(), chunkline_non_comment_RR(), and http_parse_origin().
|
static |
process $TTL for http, 0 nothing, 1 done, 2 error
References sldns_file_parse_state::default_ttl, http_parse_ttl(), sldns_buffer_begin(), sldns_str2period(), and sldns_strip_ws().
Referenced by apply_http(), chunkline_non_comment_RR(), and http_parse_ttl().
|
static |
remove newlines from collated line
References chunkline_newline_removal(), sldns_buffer_limit(), sldns_buffer_read_u8_at(), sldns_buffer_set_limit(), and sldns_buffer_write_u8_at().
Referenced by apply_http(), chunkline_newline_removal(), and chunkline_non_comment_RR().
|
static |
find noncomment RR line in chunks, collates lines if ( ) format
References chunkline_get_line_collated(), chunkline_is_comment_line_or_empty(), chunkline_newline_removal(), chunkline_non_comment_RR(), http_parse_origin(), and http_parse_ttl().
Referenced by chunkline_non_comment_RR(), and http_zonefile_syntax_check().
|
static |
check syntax of chunklist zonefile, parse first RR, return false on failure and return a string in the scratch buffer (first RR string) on failure.
References chunkline_non_comment_RR(), auth_transfer::chunks_first, auth_xfer::dclass, sldns_file_parse_state::default_ttl, http_zonefile_syntax_check(), LDNS_RR_BUF_SIZE, log_err(), auth_xfer::name, auth_xfer::namelen, sldns_file_parse_state::origin, sldns_file_parse_state::origin_len, sldns_file_parse_state::prev_rr, sldns_file_parse_state::prev_rr_len, sldns_buffer_begin(), sldns_get_errorstr_parse(), sldns_str2wire_rr_buf(), sldns_wirerr_get_class(), and auth_xfer::task_transfer.
Referenced by apply_http(), and http_zonefile_syntax_check().
|
static |
sum sizes of chunklist
References chunklist_sum(), auth_chunk::len, and auth_chunk::next.
Referenced by apply_http(), and chunklist_sum().
|
static |
for http download, parse and add RR to zone
References az_insert_rr(), sldns_file_parse_state::default_ttl, auth_master::file, auth_master::host, http_parse_add_rr(), LDNS_RR_BUF_SIZE, log_err(), auth_transfer::master, sldns_file_parse_state::origin, sldns_file_parse_state::origin_len, sldns_file_parse_state::prev_rr, sldns_file_parse_state::prev_rr_len, sldns_buffer_begin(), sldns_get_errorstr_parse(), sldns_str2wire_rr_buf(), and auth_xfer::task_transfer.
Referenced by apply_http(), and http_parse_add_rr().
|
static |
RR list iterator, returns RRs from answer section one by one from the dns packets in the chunklist.
References chunk_rrlist_start(), auth_transfer::chunks_first, and auth_xfer::task_transfer.
Referenced by apply_axfr(), apply_ixfr(), and chunk_rrlist_start().
|
static |
RR list iterator, see if we are at the end of the list.
References chunk_rrlist_end(), auth_chunk::data, auth_chunk::len, and auth_chunk::next.
Referenced by apply_axfr(), apply_ixfr(), chunk_rrlist_end(), and ixfr_start_serial().
|
static |
RR list iterator, move to next RR.
References chunk_rrlist_gonext(), and auth_chunk::next.
Referenced by apply_axfr(), apply_ixfr(), chunk_rrlist_gonext(), and ixfr_start_serial().
|
static |
RR iterator, get current RR information, false on parse error.
References chunk_rrlist_get_current(), auth_chunk::data, auth_chunk::len, pkt_dname_len(), sldns_buffer_current(), sldns_buffer_init_frm_data(), sldns_buffer_position(), sldns_buffer_read_u16(), sldns_buffer_read_u32(), sldns_buffer_remaining(), sldns_buffer_set_position(), and sldns_buffer_skip().
Referenced by apply_axfr(), apply_ixfr(), chunk_rrlist_get_current(), and ixfr_start_serial().
|
static |
print log message where we are in parsing the zone transfer
References auth_chunk::data, dname_pkt_copy(), dname_str(), LDNS_MAX_DOMAINLEN, auth_chunk::len, log_rrlist_position(), pkt_dname_len(), sldns_buffer_begin(), sldns_buffer_init_frm_data(), sldns_buffer_set_position(), sldns_wire2str_type_buf(), VERB_ALGO, and verbose().
Referenced by apply_axfr(), apply_ixfr(), and log_rrlist_position().
|
static |
check that start serial is OK for ixfr.
we are at rr_counter == 0, and we are going to check rr_counter == 1 (has to be type SOA) serial
References chunk_rrlist_end(), chunk_rrlist_get_current(), chunk_rrlist_gonext(), ixfr_start_serial(), LDNS_RR_TYPE_SOA, VERB_OPS, and verbose().
Referenced by apply_ixfr(), and ixfr_start_serial().
|
static |
apply IXFR to zone in memory.
z is locked. false on failure(mallocfail)
References apply_ixfr(), AUTH_XFR_DECOMPRESS_PACKET_LIMIT, az_insert_rr_decompress(), az_remove_rr_decompress(), chunk_rrlist_end(), chunk_rrlist_get_current(), chunk_rrlist_gonext(), chunk_rrlist_start(), auth_chunk::data, ixfr_start_serial(), LDNS_RR_TYPE_SOA, auth_chunk::len, log_rrlist_position(), auth_xfer::num_ixfrs, auth_xfer::serial, VERB_ALGO, verbose(), and verbosity.
Referenced by apply_ixfr(), and xfr_process_chunk_list().
|
static |
apply AXFR to zone in memory.
z is locked. false on failure(mallocfail)
References apply_axfr(), AUTH_XFR_DECOMPRESS_PACKET_LIMIT, auth_zone_clear_data(), az_insert_rr_decompress(), chunk_rrlist_end(), chunk_rrlist_get_current(), chunk_rrlist_gonext(), chunk_rrlist_start(), auth_chunk::data, auth_xfer::have_zone, LDNS_RR_TYPE_SOA, auth_chunk::len, log_err(), log_rrlist_position(), auth_xfer::num_ixfrs, auth_xfer::serial, auth_xfer::soa_zone_acquired, and verbosity.
Referenced by apply_axfr(), and xfr_process_chunk_list().
|
static |
apply HTTP to zone in memory.
z is locked. false on failure(mallocfail)
References apply_http(), auth_zone_clear_data(), chunkline_get_line_collated(), chunkline_is_comment_line_or_empty(), chunkline_newline_removal(), chunklist_sum(), auth_transfer::chunks_first, auth_chunk::data, sldns_file_parse_state::default_ttl, auth_zone::etag, auth_master::file, auth_xfer::have_zone, auth_master::host, http_parse_add_rr(), http_parse_origin(), http_parse_ttl(), http_zonefile_syntax_check(), auth_chunk::len, sldns_file_parse_state::lineno, log_err(), log_info(), auth_transfer::master, auth_xfer::name, auth_xfer::namelen, auth_xfer::num_ixfrs, sldns_file_parse_state::origin, sldns_file_parse_state::origin_len, auth_xfer::serial, sldns_buffer_begin(), auth_xfer::soa_zone_acquired, auth_xfer::task_transfer, VERB_ALGO, verbose(), and verbosity.
Referenced by apply_http(), and xfr_process_chunk_list().
|
static |
write http chunks to zonefile to create downloaded file
References auth_zone_write_chunks(), auth_chunk::data, auth_chunk::len, log_err(), auth_chunk::next, and write_out().
Referenced by auth_zone_write_chunks(), and zone_write_after_update().
|
static |
write to zonefile after zone has been updated, z has rdlock by caller.
References auth_chunk_list_delete(), auth_zone_write_chunks(), auth_zone_write_file(), module_env::cfg, config_file::chrootdir, dname_str(), LDNS_MAX_DOMAINLEN, log_err(), auth_zone::name, VERB_ALGO, verbose(), verbosity, zone_write_after_update(), and auth_zone::zonefile.
Referenced by xfr_write_after_update(), zone_write_after_update(), and zone_write_after_update_reacq().
|
static |
write to zonefile after zone has updated, reacquires z readlock.
References auth_zone_find(), module_env::auth_zones, auth_zone::lock, auth_zones::lock, zone_write_after_update(), and zone_write_after_update_reacq().
Referenced by auth_zonemd_dnskey_lookup_callback(), and zone_write_after_update_reacq().
|
static |
write to zonefile after zone has been updated
References auth_zone_find(), module_env::auth_zones, auth_xfer::dclass, auth_xfer::lock, auth_zone::lock, auth_zones::lock, auth_xfer::name, auth_xfer::namelen, xfr_write_after_update(), and zone_write_after_update().
Referenced by xfr_process_chunk_list(), and xfr_write_after_update().
|
static |
reacquire locks and structures.
Starts with no locks, ends with xfr and z locks, if fail, no z lock
References auth_zone_find(), module_env::auth_zones, auth_xfer::dclass, auth_xfer::lock, auth_zones::lock, auth_xfer::name, auth_xfer::namelen, and xfr_process_reacquire_locks().
Referenced by xfr_process_chunk_list(), xfr_process_reacquire_locks(), and xfr_transfer_init_fetch().
|
static |
process chunk list and update zone in memory, return false if it did not work
References apply_axfr(), apply_http(), apply_ixfr(), auth_chunk_list_delete(), auth_chunks_delete(), auth_zone_clear_data(), auth_zone_verify_zonemd(), auth_transfer::chunks_first, dname_str(), auth_xfer::have_zone, auth_master::host, auth_master::http, auth_xfer::is_rpz, LDNS_MAX_DOMAINLEN, auth_xfer::lease_time, auth_xfer::lock, auth_zone::lock, auth_transfer::master, module_env::mesh, mesh_area::mods, auth_xfer::name, module_env::now, auth_transfer::on_ixfr, auth_transfer::on_ixfr_is_axfr, auth_zone::perform_write_chunk_list, auth_zone::rpz, rpz_finish_config(), module_env::scratch_buffer, auth_xfer::serial, auth_xfer::soa_zone_acquired, auth_zone::soa_zone_acquired, auth_xfer::task_transfer, VERB_ALGO, VERB_QUERY, verbose(), verbosity, xfr_find_soa(), xfr_process_chunk_list(), xfr_process_reacquire_locks(), xfr_write_after_update(), auth_xfer::zone_expired, auth_zone::zone_expired, auth_zone::zonemd_callback_env, auth_zone::zonemd_callback_perform_write, and auth_zone::zonemd_check.
Referenced by process_list_end_transfer(), and xfr_process_chunk_list().
|
static |
Stop lookup using callback.
References BIT_RD, LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, query_info::local_alias, log_query_info(), mesh_remove_callback(), query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, sldns_str2wire_dname_buf(), VERB_ALGO, and xfr_stop_lookup().
Referenced by xfr_probe_disown(), xfr_stop_lookup(), and xfr_transfer_disown().
|
static |
disown task_transfer.
caller must hold xfr.lock
References auth_chunks_delete(), auth_xfer_transfer_lookup_callback(), comm_point_delete(), comm_timer_delete(), auth_transfer::cp, auth_xfer::dclass, auth_transfer::lookup_aaaa, auth_transfer::lookup_target, auth_transfer::lookup_unique_info, module_env::mesh, auth_xfer::task_transfer, auth_transfer::timer, xfr_stop_lookup(), and xfr_transfer_disown().
Referenced by auth_zones_cleanup(), process_list_end_transfer(), xfr_disown_tasks(), xfr_transfer_disown(), and xfr_transfer_nexttarget_or_end().
|
static |
lookup a host name for its addresses, if needed
References auth_master::allow_notify, auth_xfer_transfer_lookup_callback(), BIT_RD, edns_data::bits, edns_data::cookie_present, edns_data::cookie_valid, auth_xfer::dclass, dname_str(), EDNS_DO, edns_data::edns_present, edns_data::edns_version, edns_data::ext_rcode, extstrtoaddr(), auth_master::host, LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, query_info::local_alias, auth_xfer::lock, log_err(), log_query_info(), auth_transfer::lookup_aaaa, auth_transfer::lookup_target, auth_transfer::lookup_unique_info, module_env::mesh, mesh_new_callback(), auth_xfer::name, edns_data::opt_list_in, edns_data::opt_list_inplace_cb_out, edns_data::opt_list_out, edns_data::padding_block_size, query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, module_env::scratch_buffer, sldns_buffer_capacity(), sldns_str2wire_dname_buf(), auth_xfer::task_transfer, edns_data::udp_size, VERB_ALGO, verbosity, and xfr_transfer_lookup_host().
Referenced by xfr_transfer_lookup_host(), and xfr_transfer_nexttarget_or_end().
|
static |
initiate TCP to the target and fetch zone.
returns true if that was successfully started, and timeout setup.
References auth_addr::addr, addr_port_to_str(), auth_addr::addrlen, auth_master::allow_notify, auth_xfer_transfer_http_callback(), auth_xfer_transfer_tcp_callback(), auth_xfer_transfer_timer_callback(), authextstrtoaddr(), module_env::cfg, comm_point_delete(), comm_timer_create(), comm_timer_set(), auth_transfer::cp, dname_str(), auth_zone::etag, auth_master::file, GET_RANDOM_ID, auth_master::host, auth_master::http, auth_transfer::id, LDNS_MAX_DOMAINLEN, auth_xfer::lock, auth_zone::lock, log_err(), auth_transfer::master, auth_xfer::name, module_env::now_tv, auth_transfer::on_ixfr, module_env::outnet, outnet_comm_point_for_http(), outnet_comm_point_for_tcp(), auth_master::port, probe_copy_masters_for_allow_notify(), module_env::rnd, auth_transfer::scan_addr, module_env::scratch_buffer, sockaddr_store_port(), auth_master::ssl, auth_transfer::start_time, auth_xfer::task_transfer, auth_transfer::timer, VERB_ALGO, verbose(), verbosity, module_env::worker_base, xfr_create_ixfr_packet(), xfr_process_reacquire_locks(), and xfr_transfer_init_fetch().
Referenced by xfr_transfer_init_fetch(), and xfr_transfer_nexttarget_or_end().
|
static |
perform next lookup, next transfer TCP, or end and resume wait time task
References dname_str(), LDNS_MAX_DOMAINLEN, auth_xfer::lock, log_assert, auth_transfer::lookup_target, auth_transfer::master, auth_xfer::name, auth_xfer::task_nextprobe, auth_xfer::task_transfer, VERB_ALGO, verbose(), verbosity, module_env::worker, xfr_set_timeout(), xfr_transfer_current_master(), xfr_transfer_disown(), xfr_transfer_end_of_list(), xfr_transfer_init_fetch(), xfr_transfer_lookup_host(), xfr_transfer_move_to_next_lookup(), xfr_transfer_nextmaster(), and xfr_transfer_nexttarget_or_end().
Referenced by auth_xfer_transfer_http_callback(), auth_xfer_transfer_lookup_callback(), auth_xfer_transfer_tcp_callback(), auth_xfer_transfer_timer_callback(), process_list_end_transfer(), xfr_start_transfer(), and xfr_transfer_nexttarget_or_end().
|
static |
add addrs from A or AAAA rrset to the master
References auth_addr::addr, addr_port_to_str(), auth_addr::addrlen, packed_rrset_data::count, lruhash_entry::data, ub_packed_rrset_key::entry, auth_master::host, INET6_SIZE, INET_SIZE, LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, auth_master::list, log_err(), auth_addr::next, packed_rrset_data::rr_data, packed_rrset_data::rr_len, VERB_ALGO, verbose(), verbosity, and xfr_master_add_addrs().
Referenced by auth_xfer_probe_lookup_callback(), auth_xfer_transfer_lookup_callback(), and xfr_master_add_addrs().
|
static |
check if the lookup target name equals the found answer name.
References packed_rrset_key::dname, auth_master::host, LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_CNAME, query_info::qclass, query_dname_compare(), reply_find_rrset_section_an(), ub_packed_rrset_key::rk, sldns_str2wire_dname_buf(), VERB_ALGO, verbose(), and xfer_target_equals_answer_name().
Referenced by auth_xfer_probe_lookup_callback(), auth_xfer_transfer_lookup_callback(), and xfer_target_equals_answer_name().
| void auth_xfer_transfer_lookup_callback | ( | void * | arg, |
| int | rcode, | ||
| sldns_buffer * | buf, | ||
| enum sec_status | sec, | ||
| char * | why_bogus, | ||
| int | ATTR_UNUSEDwas_ratelimited ) |
callback for task_transfer lookup of host name, of A or AAAA
References auth_xfer_transfer_lookup_callback(), dname_str(), reply_info::flags, FLAGS_GET_RCODE, auth_master::host, LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, auth_master::list, auth_xfer::lock, log_assert, auth_transfer::lookup_aaaa, auth_transfer::lookup_target, auth_xfer::name, module_env::outnet, parse_reply_in_temp_region(), query_info::qtype, regional_free_all(), reply_find_answer_rrset(), auth_transfer::scan_addr, module_env::scratch, sec_status_bogus, sec_status_secure_sentinel_fail, auth_xfer::task_transfer, VERB_ALGO, VERB_OPS, verbose(), verbosity, outside_network::want_to_quit, xfer_target_equals_answer_name(), xfr_master_add_addrs(), xfr_transfer_current_master(), xfr_transfer_move_to_next_lookup(), and xfr_transfer_nexttarget_or_end().
Referenced by auth_xfer_transfer_lookup_callback(), auth_xfer_transfer_lookup_callback(), fptr_whitelist_mesh_cb(), xfr_transfer_disown(), and xfr_transfer_lookup_host().
|
static |
check if xfer (AXFR or IXFR) packet is OK.
return false if we lost connection (SERVFAIL, or unreadable). return false if we need to move from IXFR to AXFR, with gonextonfail set to false, so the same master is tried again, but with AXFR. return true if fine to link into data. return true with transferdone=true when the transfer has ended.
References AUTH_XFR_DECOMPRESS_PACKET_LIMIT, check_xfer_packet(), auth_xfer::dclass, dname_pkt_compare(), auth_transfer::got_xfr_serial, auth_master::host, auth_transfer::id, auth_transfer::incoming_xfr_serial, auth_transfer::ixfr_fail, LDNS_RR_TYPE_SOA, auth_transfer::master, auth_xfer::name, auth_transfer::on_ixfr, auth_transfer::on_ixfr_is_axfr, pkt_dname_len_budget(), auth_transfer::rr_scan_num, sldns_buffer_at(), sldns_buffer_begin(), sldns_buffer_limit(), sldns_buffer_position(), sldns_buffer_read_u16(), sldns_buffer_read_u32(), sldns_buffer_read_u32_at(), sldns_buffer_remaining(), sldns_buffer_set_position(), sldns_buffer_skip(), sldns_wire2str_rcode_buf(), auth_xfer::task_transfer, VERB_ALGO, and verbose().
Referenced by auth_xfer_transfer_tcp_callback(), and check_xfer_packet().
|
static |
Link the data from this packet into the worklist of transferred data.
References auth_transfer::chunks_first, auth_transfer::chunks_last, auth_transfer::chunks_total, auth_chunk::data, auth_chunk::len, memdup(), auth_chunk::next, sldns_buffer_begin(), sldns_buffer_limit(), auth_xfer::task_transfer, and xfer_link_data().
Referenced by auth_xfer_transfer_http_callback(), auth_xfer_transfer_tcp_callback(), and xfer_link_data().
|
static |
task transfer.
the list of data is complete. process it and if failed move to next master, if succeeded, end the task transfer
References auth_chunks_delete(), auth_transfer::ixfr_fail, auth_xfer::lock, auth_xfer::notify_has_serial, auth_xfer::notify_received, auth_xfer::notify_serial, process_list_end_transfer(), auth_xfer::task_nextprobe, auth_xfer::task_transfer, xfr_process_chunk_list(), xfr_serial_means_update(), xfr_set_timeout(), xfr_start_probe(), xfr_transfer_disown(), xfr_transfer_nextmaster(), and xfr_transfer_nexttarget_or_end().
Referenced by auth_xfer_transfer_http_callback(), auth_xfer_transfer_tcp_callback(), and process_list_end_transfer().
| void auth_xfer_transfer_timer_callback | ( | void * | arg | ) |
callback for the task_transfer timer
xfer transfer timeout callback, part of task_transfer
callback for the task_transfer timer
References auth_chunks_delete(), auth_xfer_transfer_timer_callback(), comm_point_delete(), auth_transfer::cp, auth_master::host, auth_transfer::ixfr_fail, auth_transfer::ixfr_possible_timeout_count, auth_xfer::lock, log_assert, auth_transfer::master, NUM_TIMEOUTS_FALLBACK_IXFR, auth_transfer::on_ixfr, module_env::outnet, auth_xfer::task_transfer, VERB_ALGO, verbose(), outside_network::want_to_quit, xfr_transfer_nextmaster(), and xfr_transfer_nexttarget_or_end().
Referenced by auth_xfer_transfer_tcp_callback(), auth_xfer_transfer_timer_callback(), fptr_whitelist_comm_timer(), and xfr_transfer_init_fetch().
|
static |
return the time taken by the transfer
References auth_xfer_transfer_time_taken(), module_env::now_tv, auth_transfer::start_time, auth_xfer::task_transfer, and timeval_subtract().
Referenced by auth_xfer_transfer_http_callback(), auth_xfer_transfer_tcp_callback(), and auth_xfer_transfer_time_taken().
| int auth_xfer_transfer_tcp_callback | ( | struct comm_point * | c, |
| void * | arg, | ||
| int | err, | ||
| struct comm_reply * | ATTR_UNUSEDrepinfo ) |
callback for task_transfer tcp connections
References auth_chunks_delete(), auth_xfer_transfer_tcp_callback(), auth_xfer_transfer_time_taken(), comm_point::buffer, check_xfer_packet(), auth_transfer::chunks_total, comm_point_delete(), comm_timer_disable(), auth_transfer::cp, dname_str(), comm_point::etag, auth_master::host, auth_master::http, auth_transfer::ixfr_fail, auth_transfer::ixfr_possible_timeout_count, LDNS_MAX_DOMAINLEN, auth_xfer::lock, log_assert, log_err(), auth_transfer::master, auth_xfer::max_transfer_size, auth_xfer::max_transfer_time, auth_xfer::name, NETEVENT_NOERROR, NUM_TIMEOUTS_FALLBACK_IXFR, auth_transfer::on_ixfr, module_env::outnet, process_list_end_transfer(), sldns_buffer_clear(), auth_xfer::task_transfer, comm_point::tcp_is_reading, auth_transfer::timer, VERB_ALGO, verbose(), outside_network::want_to_quit, xfer_link_data(), xfr_transfer_nextmaster(), and xfr_transfer_nexttarget_or_end().
Referenced by auth_xfer_transfer_tcp_callback(), auth_xfer_transfer_tcp_callback(), fptr_whitelist_comm_point(), and xfr_transfer_init_fetch().
| int auth_xfer_transfer_http_callback | ( | struct comm_point * | c, |
| void * | arg, | ||
| int | err, | ||
| struct comm_reply * | repinfo ) |
callback for task_transfer http connections
References auth_chunks_delete(), auth_xfer_transfer_http_callback(), auth_xfer_transfer_time_taken(), comm_point::buffer, comm_reply::c, auth_transfer::chunks_total, comm_point_delete(), comm_timer_disable(), auth_transfer::cp, dname_str(), comm_point::etag, auth_master::file, auth_master::host, auth_master::http, LDNS_MAX_DOMAINLEN, auth_xfer::lock, log_assert, log_err(), auth_transfer::master, auth_xfer::max_transfer_size, auth_xfer::max_transfer_time, auth_xfer::name, NETEVENT_DONE, NETEVENT_NOERROR, module_env::outnet, process_list_end_transfer(), comm_point::repinfo, sldns_buffer_clear(), sldns_buffer_limit(), auth_xfer::task_transfer, comm_point::tcp_is_reading, auth_transfer::timer, VERB_ALGO, verbose(), outside_network::want_to_quit, xfer_link_data(), xfr_transfer_nextmaster(), and xfr_transfer_nexttarget_or_end().
Referenced by auth_xfer_transfer_http_callback(), auth_xfer_transfer_tcp_callback(), fptr_whitelist_comm_point(), and xfr_transfer_init_fetch().
|
static |
start transfer task by this worker , xfr is locked.
References auth_transfer::chunks_first, auth_transfer::chunks_last, log_assert, auth_xfer::task_transfer, module_env::worker, xfr_start_transfer(), xfr_transfer_nexttarget_or_end(), xfr_transfer_start_list(), and xfr_transfer_start_lookups().
Referenced by auth_xfer_probe_udp_callback(), xfr_probe_send_or_end(), xfr_start_probe(), and xfr_start_transfer().
|
static |
disown task_probe.
caller must hold xfr.lock
References auth_xfer_probe_lookup_callback(), comm_point_delete(), comm_timer_delete(), auth_probe::cp, auth_xfer::dclass, auth_probe::lookup_aaaa, auth_probe::lookup_target, auth_probe::lookup_unique_info, module_env::mesh, auth_xfer::task_probe, auth_probe::timer, xfr_probe_disown(), and xfr_stop_lookup().
Referenced by auth_xfer_probe_udp_callback(), auth_zones_cleanup(), xfr_disown_tasks(), xfr_probe_disown(), and xfr_probe_send_or_end().
|
static |
send the UDP probe to the master, this is part of task_probe
References auth_addr::addr, addr_is_ip6(), addr_port_to_str(), auth_addr::addrlen, auth_master::allow_notify, AUTH_PROBE_TIMEOUT, auth_xfer_probe_timer_callback(), auth_xfer_probe_udp_callback(), authextstrtoaddr(), module_env::cfg, comm_point_delete(), comm_timer_create(), comm_timer_set(), auth_probe::cp, auth_probe::cp_is_ip6, dname_str(), GET_RANDOM_ID, auth_master::host, auth_master::http, auth_probe::id, LDNS_MAX_DOMAINLEN, log_err(), auth_xfer::name, module_env::outnet, outnet_comm_point_for_udp(), config_file::port, module_env::rnd, auth_probe::scan_addr, module_env::scratch_buffer, config_file::ssl_port, auth_xfer::task_probe, auth_probe::timeout, auth_probe::timer, VERB_ALGO, verbose(), verbosity, module_env::worker_base, xfr_create_soa_probe_packet(), xfr_probe_current_master(), and xfr_probe_send_probe().
Referenced by auth_xfer_probe_timer_callback(), xfr_probe_send_or_end(), and xfr_probe_send_probe().
| void auth_xfer_probe_timer_callback | ( | void * | arg | ) |
callback for task_probe timer
xfer probe timeout callback, part of task_probe
callback for task_probe timer
References AUTH_PROBE_TIMEOUT_STOP, auth_xfer_probe_timer_callback(), comm_point_delete(), auth_probe::cp, dname_str(), LDNS_MAX_DOMAINLEN, auth_xfer::lock, log_assert, auth_xfer::name, module_env::outnet, auth_xfer::task_probe, auth_probe::timeout, VERB_ALGO, verbose(), verbosity, outside_network::want_to_quit, xfr_probe_nextmaster(), xfr_probe_send_or_end(), and xfr_probe_send_probe().
Referenced by auth_xfer_probe_timer_callback(), auth_xfer_transfer_tcp_callback(), fptr_whitelist_comm_timer(), and xfr_probe_send_probe().
| int auth_xfer_probe_udp_callback | ( | struct comm_point * | c, |
| void * | arg, | ||
| int | err, | ||
| struct comm_reply * | repinfo ) |
callback for task_probe udp packets
callback for commpoint udp replies to task_probe
callback for task_probe udp packets
References auth_xfer_probe_udp_callback(), comm_point::buffer, comm_reply::c, check_packet_ok(), comm_point_delete(), comm_timer_disable(), auth_probe::cp, dname_str(), auth_probe::have_new_lease, auth_master::http, LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_SOA, auth_xfer::lock, log_assert, auth_transfer::masters, auth_xfer::name, NETEVENT_NOERROR, module_env::outnet, auth_xfer::task_probe, auth_xfer::task_transfer, auth_probe::timer, VERB_ALGO, verbose(), verbosity, outside_network::want_to_quit, xfr_probe_current_master(), xfr_probe_disown(), xfr_probe_nextmaster(), xfr_probe_send_or_end(), xfr_serial_means_update(), and xfr_start_transfer().
Referenced by auth_xfer_probe_udp_callback(), fptr_whitelist_comm_point(), and xfr_probe_send_probe().
|
static |
lookup a host name for its addresses, if needed
References auth_master::allow_notify, auth_xfer_probe_lookup_callback(), BIT_RD, edns_data::bits, edns_data::cookie_present, edns_data::cookie_valid, auth_xfer::dclass, dname_str(), EDNS_DO, edns_data::edns_present, edns_data::edns_version, edns_data::ext_rcode, extstrtoaddr(), auth_master::host, auth_master::http, LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, query_info::local_alias, auth_xfer::lock, log_err(), log_query_info(), auth_probe::lookup_aaaa, auth_probe::lookup_target, auth_probe::lookup_unique_info, module_env::mesh, mesh_new_callback(), auth_xfer::name, edns_data::opt_list_in, edns_data::opt_list_inplace_cb_out, edns_data::opt_list_out, edns_data::padding_block_size, query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, module_env::scratch_buffer, sldns_buffer_capacity(), sldns_str2wire_dname_buf(), auth_xfer::task_probe, edns_data::udp_size, VERB_ALGO, verbosity, and xfr_probe_lookup_host().
Referenced by xfr_probe_lookup_host(), and xfr_probe_send_or_end().
|
static |
return true if there are probe (SOA UDP query) targets in the master list
References auth_master::allow_notify, have_probe_targets(), auth_master::host, auth_master::list, and auth_master::next.
Referenced by have_probe_targets(), xfr_probe_send_or_end(), and xfr_start_probe().
| void auth_xfer_probe_lookup_callback | ( | void * | arg, |
| int | rcode, | ||
| sldns_buffer * | buf, | ||
| enum sec_status | sec, | ||
| char * | why_bogus, | ||
| int | ATTR_UNUSEDwas_ratelimited ) |
callback for task_probe lookup of host name, of A or AAAA
References auth_xfer_probe_lookup_callback(), dname_str(), reply_info::flags, FLAGS_GET_RCODE, auth_master::host, LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, auth_master::list, auth_xfer::lock, log_assert, auth_probe::lookup_aaaa, auth_probe::lookup_target, auth_xfer::name, module_env::outnet, parse_reply_in_temp_region(), query_info::qtype, regional_free_all(), reply_find_answer_rrset(), auth_probe::scan_addr, module_env::scratch, sec_status_bogus, sec_status_secure_sentinel_fail, auth_xfer::task_probe, VERB_ALGO, VERB_OPS, verbose(), verbosity, outside_network::want_to_quit, xfer_target_equals_answer_name(), xfr_master_add_addrs(), xfr_probe_current_master(), xfr_probe_move_to_next_lookup(), and xfr_probe_send_or_end().
Referenced by auth_xfer_probe_lookup_callback(), auth_xfer_probe_lookup_callback(), fptr_whitelist_mesh_cb(), xfr_probe_disown(), and xfr_probe_lookup_host().
|
static |
disown task_nextprobe.
caller must hold xfr.lock
References comm_timer_delete(), auth_nextprobe::next_probe, auth_xfer::task_nextprobe, auth_nextprobe::timer, and xfr_nextprobe_disown().
Referenced by auth_xfer_timer(), auth_zones_cleanup(), xfr_disown_tasks(), and xfr_nextprobe_disown().
| void auth_xfer_timer | ( | void * | arg | ) |
xfer nextprobe timeout callback, this is part of task_nextprobe
References auth_xfer_set_expired(), auth_xfer_timer(), auth_xfer::expiry, auth_xfer::have_zone, auth_xfer::lease_time, auth_xfer::lock, log_assert, module_env::now, module_env::outnet, auth_xfer::task_nextprobe, outside_network::want_to_quit, xfr_nextprobe_disown(), xfr_start_probe(), and auth_xfer::zone_expired.
Referenced by auth_xfer_timer(), fptr_whitelist_comm_timer(), and xfr_set_timeout().
| void auth_zone_pickup_initial_zone | ( | struct auth_zone * | z, |
| struct module_env * | env ) |
Initial pick up of the auth zone, it sets the acquired time.
| z | the zone, write locked by caller. |
| env | environment of the worker, with current time. |
References auth_zone_pickup_initial_zone(), module_env::now, and auth_zone::soa_zone_acquired.
Referenced by auth_xfer_pickup_initial(), auth_zone_pickup_initial_zone(), auth_zonemd_dnskey_lookup_callback(), and fr_worker_auth_add().
| void auth_xfer_pickup_initial_zone | ( | struct auth_xfer * | x, |
| struct module_env * | env ) |
Initial pick up of the auth zone nextprobe timeout and that turns into further zone transfer work, if any.
Also sets the lease time.
| x | xfer structure, locked by caller. |
| env | environment of the worker that picks up the task. |
References auth_xfer_pickup_initial_zone(), auth_xfer::have_zone, auth_xfer::lease_time, module_env::now, auth_xfer::soa_zone_acquired, auth_xfer::task_nextprobe, and xfr_set_timeout().
Referenced by auth_xfer_pickup_initial(), auth_xfer_pickup_initial_zone(), auth_zonemd_dnskey_lookup_callback(), and fr_worker_auth_add().
| void auth_xfer_pickup_initial | ( | struct auth_zones * | az, |
| struct module_env * | env ) |
initial pick up of worker timeouts, ties events to worker event loop
| az | auth zones structure |
| env | worker env, of first worker that receives the events (if any) in its eventloop. |
References auth_xfer_pickup_initial(), auth_xfer_pickup_initial_zone(), auth_zone_pickup_initial_zone(), auth_xfer::lock, auth_zone::lock, auth_zones::lock, RBTREE_FOR, auth_zones::xtree, and auth_zones::ztree.
Referenced by auth_xfer_pickup_initial(), and worker_init().
| void auth_zones_cleanup | ( | struct auth_zones * | az | ) |
Cleanup auth zones.
This removes all events from event bases. Stops the xfr tasks. But leaves zone data.
| az | auth zones structure. |
References auth_chunks_delete(), auth_zones_cleanup(), auth_xfer::lock, auth_zones::lock, RBTREE_FOR, auth_xfer::task_nextprobe, auth_xfer::task_probe, auth_xfer::task_transfer, xfr_nextprobe_disown(), xfr_probe_disown(), xfr_transfer_disown(), and auth_zones::xtree.
Referenced by auth_zones_cleanup(), and daemon_cleanup().
malloc the xfer and tasks
| z | auth_zone with name of zone. |
References auth_xfer_new(), auth_xfer::dclass, auth_zone::dclass, auth_xfer::expiry, auth_xfer::have_zone, rbnode_type::key, auth_xfer::lease_time, auth_xfer::lock, auth_xfer::max_transfer_size, auth_zone::max_transfer_size, auth_xfer::max_transfer_time, auth_zone::max_transfer_time, memdup(), auth_xfer::name, auth_zone::name, auth_xfer::namelabs, auth_zone::namelabs, auth_xfer::namelen, auth_zone::namelen, auth_xfer::node, auth_xfer::notify_received, auth_xfer::notify_serial, auth_xfer::refresh, auth_xfer::retry, auth_xfer::serial, auth_xfer::soa_zone_acquired, auth_xfer::task_nextprobe, auth_xfer::task_probe, auth_xfer::task_transfer, and auth_xfer::zone_expired.
Referenced by auth_xfer_create(), and auth_xfer_new().
| struct auth_xfer * auth_xfer_create | ( | struct auth_zones * | az, |
| struct auth_zone * | z ) |
Create auth_xfer structure.
This populates the have_zone, soa values, and so on times. and sets the timeout, if a zone transfer is needed a short timeout is set. For that the auth_zone itself must exist (and read in zonefile) returns false on alloc failure.
Caller must have wrlock on az. Returns locked xfer zone.
| az | zones structure. |
| z | zone with name and class |
References auth_xfer_create(), auth_xfer_new(), log_err(), auth_xfer::node, rbtree_insert(), and auth_zones::xtree.
Referenced by auth_xfer_create(), auth_zones_find_or_add_xfer(), fr_worker_auth_add(), and fr_worker_auth_cha().
|
static |
create new auth_master structure
References auth_master_new(), log_err(), and auth_master::next.
Referenced by auth_master_new(), and xfer_set_masters().
|
static |
dup_prefix : create string from initial part of other string, malloced
References dup_prefix(), and log_err().
Referenced by dup_prefix(), and parse_url().
|
static |
dup string and print error on error
References dup_all(), and log_err().
Referenced by dup_all(), and parse_url().
|
static |
find first of two characters
References str_find_first_of_chars().
Referenced by parse_url(), and str_find_first_of_chars().
|
static |
parse URL into host and file parts, false on malloc or parse error
References dup_all(), dup_prefix(), auth_master::file, auth_master::host, log_err(), parse_url(), auth_master::port, auth_master::ssl, and str_find_first_of_chars().
Referenced by parse_url(), and xfer_set_masters().
| int xfer_set_masters | ( | struct auth_master ** | list, |
| struct config_auth * | c, | ||
| int | with_http ) |
Set masters in auth xfer structure from config.
| list | pointer to start of list. The malloced list is returned here. |
| c | the config items to copy over. |
| with_http | if true, http urls are also included, before the masters. |
References auth_master::allow_notify, config_auth::allow_notify, auth_master_new(), auth_master::file, auth_master::host, auth_master::http, auth_master::ixfr, auth_master::list, log_err(), config_auth::masters, config_strlist::next, parse_url(), auth_master::port, auth_master::ssl, config_strlist::str, config_auth::urls, and xfer_set_masters().
Referenced by auth_zones_cfg(), and xfer_set_masters().
| int zonemd_hashalgo_supported | ( | int | hashalgo | ) |
returns true if a zonemd hash algo is supported
References ZONEMD_ALGO_SHA384, ZONEMD_ALGO_SHA512, and zonemd_hashalgo_supported().
Referenced by auth_zone_generate_zonemd_check(), zonemd_check_test(), zonemd_generate_test(), and zonemd_hashalgo_supported().
| int zonemd_scheme_supported | ( | int | scheme | ) |
returns true if a zonemd scheme is supported
References ZONEMD_SCHEME_SIMPLE, and zonemd_scheme_supported().
Referenced by auth_zone_generate_zonemd_check(), and zonemd_scheme_supported().
|
static |
initialize hash for hashing with zonemd hash algo
References secalgo_hash_create_sha384(), secalgo_hash_create_sha512(), ZONEMD_ALGO_SHA384, ZONEMD_ALGO_SHA512, and zonemd_digest_init().
Referenced by auth_zone_generate_zonemd_hash(), and zonemd_digest_init().
|
static |
update the hash for zonemd
References secalgo_hash_update(), ZONEMD_ALGO_SHA384, ZONEMD_ALGO_SHA512, and zonemd_digest_update().
Referenced by zonemd_digest_update(), zonemd_simple_rrset(), and zonemd_simple_rrsig().
|
static |
finish the hash for zonemd
References secalgo_hash_final(), ZONEMD_ALGO_SHA384, ZONEMD_ALGO_SHA512, and zonemd_digest_finish().
Referenced by auth_zone_generate_zonemd_hash(), and zonemd_digest_finish().
|
static |
add rrsets from node to the list
References authdata_rrsets_to_list(), and auth_rrset::next.
Referenced by authdata_rrsets_to_list(), and zonemd_simple_domain().
|
static |
compare rr list entries
References LDNS_RR_TYPE_RRSIG, rrlist_compare(), and auth_rrset::type.
Referenced by rrlist_compare(), and zonemd_simple_domain().
|
static |
add type RRSIG to rr list if not one there already, this is to perform RRSIG collate processing at that point.
References addrrsigtype_if_needed(), az_domain_rrset(), and LDNS_RR_TYPE_RRSIG.
Referenced by addrrsigtype_if_needed(), and zonemd_simple_domain().
|
static |
collate the RRs in an RRset using the simple scheme
References auth_rrset::data, lruhash_entry::data, auth_zone::dclass, packed_rrset_key::dname, packed_rrset_key::dname_len, ub_packed_rrset_key::entry, lruhash_entry::key, auth_data::name, auth_data::namelen, regional_free_all(), ub_packed_rrset_key::rk, rrset_canonicalize_to_buffer(), packed_rrset_key::rrset_class, sldns_buffer_begin(), sldns_buffer_limit(), auth_rrset::type, packed_rrset_key::type, zonemd_digest_update(), and zonemd_simple_rrset().
Referenced by zonemd_simple_domain(), and zonemd_simple_rrset().
|
static |
count number of RRSIGs in a domain name rrset list
References packed_rrset_data::count, auth_rrset::data, auth_data::name, auth_zone::name, query_dname_compare(), packed_rrset_data::rr_len, packed_rrset_data::rrsig_count, rrsig_rdata_get_type_covered(), and zonemd_simple_count_rrsig().
Referenced by zonemd_simple_count_rrsig(), and zonemd_simple_rrsig().
|
static |
allocate sparse rrset data for the number of entries in tepm region
References regional_alloc(), packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, and zonemd_simple_rrsig_allocs().
Referenced by zonemd_simple_rrsig(), and zonemd_simple_rrsig_allocs().
|
static |
add the RRSIGs from the rrs in the domain into the data
References add_rrlist_rrsigs_into_data(), packed_rrset_data::count, auth_rrset::data, auth_data::name, auth_zone::name, query_dname_compare(), packed_rrset_data::rr_data, packed_rrset_data::rr_len, packed_rrset_data::rr_ttl, and packed_rrset_data::rrsig_count.
Referenced by add_rrlist_rrsigs_into_data(), and zonemd_simple_rrsig().
|
static |
collate the RRSIGs using the simple scheme
References add_rrlist_rrsigs_into_data(), packed_rrset_data::count, lruhash_entry::data, auth_zone::dclass, packed_rrset_key::dname, packed_rrset_key::dname_len, ub_packed_rrset_key::entry, lruhash_entry::key, LDNS_RR_TYPE_RRSIG, auth_data::name, auth_data::namelen, regional_free_all(), ub_packed_rrset_key::rk, rrset_canonicalize_to_buffer(), packed_rrset_key::rrset_class, sldns_buffer_begin(), sldns_buffer_limit(), packed_rrset_key::type, zonemd_digest_update(), zonemd_simple_count_rrsig(), zonemd_simple_rrsig(), and zonemd_simple_rrsig_allocs().
Referenced by zonemd_simple_domain(), and zonemd_simple_rrsig().
|
static |
collate a domain's rrsets using the simple scheme
References addrrsigtype_if_needed(), authdata_rrsets_to_list(), dname_subdomain_c(), LDNS_RR_TYPE_RRSIG, auth_data::name, auth_zone::name, query_dname_compare(), rrlist_compare(), auth_data::rrsets, auth_rrset::type, zonemd_simple_domain(), zonemd_simple_rrset(), and zonemd_simple_rrsig().
Referenced by zonemd_simple_collate(), and zonemd_simple_domain().
|
static |
collate the zone using the simple scheme
References auth_zone::data, RBTREE_FOR, zonemd_simple_collate(), and zonemd_simple_domain().
Referenced by auth_zone_generate_zonemd_hash(), and zonemd_simple_collate().
| int auth_zone_generate_zonemd_hash | ( | struct auth_zone * | z, |
| int | scheme, | ||
| int | hashalgo, | ||
| uint8_t * | hash, | ||
| size_t | buflen, | ||
| size_t * | resultlen, | ||
| struct regional * | region, | ||
| struct sldns_buffer * | buf, | ||
| char ** | reason ) |
Generate ZONEMD digest for the auth zone.
| z | the auth zone to digest. omits zonemd at apex and its RRSIG from the digest. |
| scheme | the collation scheme to use. Numbers as defined for ZONEMD. |
| hashalgo | the hash algo, from the registry defined for ZONEMD type. |
| hash | the result buffer. |
| buflen | size of the result buffer, must be large enough. or the routine fails. |
| resultlen | size of the hash in the result buffer of the result. |
| region | temp region for allocs during canonicalisation. |
| buf | temp buffer during canonicalisation. |
| reason | failure reason, returns a string, NULL on success. |
References auth_zone_generate_zonemd_hash(), secalgo_hash_delete(), zonemd_digest_finish(), zonemd_digest_init(), ZONEMD_SCHEME_SIMPLE, and zonemd_simple_collate().
Referenced by auth_xfer_transfer_lookup_callback(), auth_zone_generate_zonemd_check(), auth_zone_generate_zonemd_hash(), and zonemd_generate_test().
| int auth_zone_generate_zonemd_check | ( | struct auth_zone * | z, |
| int | scheme, | ||
| int | hashalgo, | ||
| uint8_t * | hash, | ||
| size_t | hashlen, | ||
| struct regional * | region, | ||
| struct sldns_buffer * | buf, | ||
| char ** | reason ) |
Check ZONEMD digest for the auth zone.
| z | auth zone to digest. |
| scheme | zonemd scheme. |
| hashalgo | zonemd hash algorithm. |
| hash | the hash to check. |
| hashlen | length of hash buffer. |
| region | temp region for allocs during canonicalisation. |
| buf | temp buffer during canonicalisation. |
| reason | string returned with failure reason. If the hash cannot be checked, but it is allowed, for unknown algorithms, the routine returns success, and the reason is nonNULL, with the allowance reason. |
References auth_zone_generate_zonemd_check(), auth_zone_generate_zonemd_hash(), log_hex(), VERB_ALGO, verbose(), verbosity, zonemd_hashalgo_supported(), and zonemd_scheme_supported().
Referenced by auth_zone_generate_zonemd_check(), auth_zone_zonemd_check_hash(), and zonemd_check_test().
|
static |
log auth zone message with zone name in front.
References auth_zone_log(), dname_str(), LDNS_MAX_DOMAINLEN, verbose(), and verbosity.
Referenced by auth_zone_log(), auth_zone_verify_zonemd_key_with_ds(), auth_zone_verify_zonemd_with_key(), auth_zonemd_dnskey_lookup_callback(), zonemd_check_dnssec_absence(), zonemd_check_dnssec_soazonemd(), zonemd_dnssec_verify_rrset(), zonemd_get_dnskey_from_anchor(), and zonemd_lookup_dnskey().
|
static |
ZONEMD, dnssec verify the rrset with the dnskey.
References auth_zone_log(), auth_rrset::data, lruhash_entry::data, auth_zone::dclass, packed_rrset_key::dname, packed_rrset_key::dname_len, dnskeyset_verify_rrset(), ub_packed_rrset_key::entry, lruhash_entry::key, module_env::modinfo, modstack_find(), auth_data::name, auth_zone::name, auth_data::namelen, ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, sec_status_secure, sldns_wire2str_type_buf(), auth_rrset::type, packed_rrset_key::type, VERB_ALGO, verbosity, and zonemd_dnssec_verify_rrset().
Referenced by zonemd_check_dnssec_absence(), zonemd_check_dnssec_soazonemd(), and zonemd_dnssec_verify_rrset().
|
static |
check for nsec3, the RR with params equal, if bitmap has the type
References packed_rrset_data::count, auth_rrset::data, lruhash_entry::data, ub_packed_rrset_key::entry, nsec3_get_params(), nsec3_has_type(), and nsec3_of_param_has_type().
Referenced by nsec3_of_param_has_type(), and zonemd_check_dnssec_absence().
|
static |
Verify the absence of ZONEMD with DNSSEC by checking NSEC, NSEC3 type flag.
return false on failure, reason contains description of failure.
References auth_zone_log(), az_domain_rrset(), az_nsec3_find_exact(), az_nsec3_param(), auth_rrset::data, lruhash_entry::data, ub_packed_rrset_key::entry, auth_zone::name, auth_zone::namelen, nsec3_of_param_has_type(), nsec_has_type(), VERB_ALGO, zonemd_check_dnssec_absence(), and zonemd_dnssec_verify_rrset().
Referenced by auth_zone_verify_zonemd_with_key(), and zonemd_check_dnssec_absence().
|
static |
Verify the SOA and ZONEMD DNSSEC signatures.
return false on failure, reason contains description of failure.
References auth_zone_log(), az_domain_rrset(), LDNS_RR_TYPE_SOA, auth_zone::name, VERB_ALGO, zonemd_check_dnssec_soazonemd(), and zonemd_dnssec_verify_rrset().
Referenced by auth_zone_verify_zonemd_with_key(), and zonemd_check_dnssec_soazonemd().
|
static |
Fail the ZONEMD verification.
| z | auth zone that fails. |
| env | environment with config, to ignore failure or not. |
| reason | failure string description. |
| why_bogus | failure string for DNSSEC verification failure. |
| result | strdup result in here if not NULL. |
References auth_zone_zonemd_fail(), module_env::cfg, dname_str(), LDNS_MAX_DOMAINLEN, log_err(), log_warn(), auth_zone::name, VERB_ALGO, verbose(), auth_zone::zone_expired, and config_file::zonemd_permissive_mode.
Referenced by auth_zone_verify_zonemd(), auth_zone_verify_zonemd_with_key(), auth_zone_zonemd_fail(), and auth_zonemd_dnskey_lookup_callback().
|
static |
Verify the zonemd with DNSSEC and hash check, with given key.
| z | auth zone. |
| env | environment with config and temp buffers. |
| mods | module stack with validator env for verification. |
| dnskey | dnskey that we can use, or NULL. If nonnull, the key has been verified and is the start of the chain of trust. |
| is_insecure | if true, the dnskey is not used, the zone is insecure. And dnssec is not used. It is DNSSEC secure insecure or not under a trust anchor. |
| sigalg | if nonNULL provide algorithm downgrade protection. Otherwise one algorithm is enough. Must have space of ALGO_NEEDS_MAX+1. |
| result | if not NULL result reason copied here. |
References auth_zone_log(), auth_zone_verify_zonemd_with_key(), auth_zone_zonemd_check_hash(), auth_zone_zonemd_fail(), az_domain_rrset(), az_find_name(), packed_rrset_data::count, auth_rrset::data, log_err(), auth_zone::name, auth_zone::namelen, VERB_ALGO, zonemd_check_dnssec_absence(), zonemd_check_dnssec_soazonemd(), and auth_zone::zonemd_reject_absence.
Referenced by auth_zone_verify_zonemd(), auth_zone_verify_zonemd_with_key(), and auth_zonemd_dnskey_lookup_callback().
|
static |
verify the zone DNSKEY rrset from the trust anchor This is possible because the anchor is for the zone itself, and can thus apply straight to the zone DNSKEY set.
| z | the auth zone. |
| env | environment with time and temp buffers. |
| mods | module stack for validator environment for dnssec validation. |
| anchor | trust anchor to use |
| is_insecure | returned, true if the zone is securely insecure. |
| why_bogus | if the routine fails, returns the failure reason. |
| keystorage | where to store the ub_packed_rrset_key that is created on success. A pointer to it is returned on success. |
| reasonbuf | buffer to use for fail reason string print. |
| reasonlen | length of reasonbuf. |
References auth_zone_log(), az_domain_rrset(), az_find_name(), packed_rrset_data::count, auth_rrset::data, lruhash_entry::data, auth_zone::dclass, packed_rrset_key::dname, packed_rrset_key::dname_len, trust_anchor::dnskey_rrset, trust_anchor::ds_rrset, ub_packed_rrset_key::entry, lruhash_entry::key, module_env::modinfo, modstack_find(), auth_data::name, auth_zone::name, auth_data::namelen, auth_zone::namelen, regional_free_all(), ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, module_env::scratch, sec_status_insecure, sec_status_secure, packed_rrset_key::type, val_verify_DNSKEY_with_TA(), VERB_ALGO, VERB_QUERY, and zonemd_get_dnskey_from_anchor().
Referenced by auth_zone_verify_zonemd(), and zonemd_get_dnskey_from_anchor().
|
static |
verify the DNSKEY from the zone with looked up DS record
References auth_zone_log(), auth_zone_verify_zonemd_key_with_ds(), az_domain_rrset(), az_find_name(), packed_rrset_data::count, auth_rrset::data, lruhash_entry::data, auth_zone::dclass, packed_rrset_key::dname, packed_rrset_key::dname_len, ub_packed_rrset_key::entry, lruhash_entry::key, module_env::modinfo, modstack_find(), auth_data::name, auth_zone::name, auth_data::namelen, auth_zone::namelen, regional_free_all(), ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, module_env::scratch, sec_status_insecure, sec_status_secure, packed_rrset_key::type, val_verify_DNSKEY_with_DS(), VERB_ALGO, and VERB_QUERY.
Referenced by auth_zone_verify_zonemd_key_with_ds(), and auth_zonemd_dnskey_lookup_callback().
| void auth_zonemd_dnskey_lookup_callback | ( | void * | arg, |
| int | rcode, | ||
| sldns_buffer * | buf, | ||
| enum sec_status | sec, | ||
| char * | why_bogus, | ||
| int | ATTR_UNUSEDwas_ratelimited ) |
callback for ZONEMD lookup of DNSKEY
References ALGO_NEEDS_MAX, auth_chunk_list_delete(), auth_zone_log(), auth_zone_verify_zonemd_key_with_ds(), auth_zone_verify_zonemd_with_key(), auth_zone_zonemd_fail(), auth_zonemd_dnskey_lookup_callback(), module_env::cfg, auth_zone::dclass, reply_info::flags, FLAGS_GET_RCODE, config_file::harden_algo_downgrade, LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_DS, auth_zone::lock, module_env::mesh, mesh_area::mods, auth_zone::name, auth_zone::namelen, module_env::outnet, parse_reply_in_temp_region(), auth_zone::perform_write_chunk_list, query_info::qname, query_info::qtype, query_dname_compare(), regional_free_all(), reply_find_answer_rrset(), module_env::scratch, sec_status_bogus, sec_status_indeterminate, sec_status_insecure, sec_status_secure, VERB_ALGO, outside_network::want_to_quit, auth_zone::zone_deleted, auth_zone::zone_expired, zone_write_after_update_reacq(), auth_zone::zonemd_callback_env, auth_zone::zonemd_callback_perform_write, and auth_zone::zonemd_callback_qtype.
Referenced by auth_zone_zonemd_stop_lookup(), auth_zonemd_dnskey_lookup_callback(), auth_zonemd_dnskey_lookup_callback(), fptr_whitelist_mesh_cb(), and zonemd_lookup_dnskey().
|
static |
lookup DNSKEY for ZONEMD verification
References auth_zone_log(), auth_zonemd_dnskey_lookup_callback(), BIT_RD, edns_data::bits, auth_zone::dclass, dname_str(), EDNS_DO, edns_data::edns_present, edns_data::edns_version, edns_data::ext_rcode, auth_zone::fallback_enabled, LDNS_MAX_DOMAINLEN, LDNS_RR_TYPE_DS, query_info::local_alias, auth_zone::lock, log_err(), log_query_info(), module_env::mesh, mesh_new_callback(), auth_zone::name, auth_zone::namelen, edns_data::opt_list_in, edns_data::opt_list_inplace_cb_out, edns_data::opt_list_out, query_info::qclass, query_info::qname, query_info::qname_len, query_info::qtype, module_env::scratch_buffer, sldns_buffer_capacity(), edns_data::udp_size, VERB_ALGO, verbosity, auth_zone::zonemd_callback_env, auth_zone::zonemd_callback_qtype, auth_zone::zonemd_callback_unique_info, and zonemd_lookup_dnskey().
Referenced by auth_zone_verify_zonemd(), and zonemd_lookup_dnskey().
| void auth_zone_verify_zonemd | ( | struct auth_zone * | z, |
| struct module_env * | env, | ||
| struct module_stack * | mods, | ||
| char ** | result, | ||
| int | offline, | ||
| int | only_online ) |
Perform ZONEMD checks and verification for the auth zone.
This includes DNSSEC verification if applicable.
| z | auth zone to check. Caller holds lock. wrlock. |
| env | with temp region, buffer and config. |
| mods | module stack for validator env. |
| result | if not NULL, result string strdupped in here. |
| offline | if true, there is no spawned lookup when online is needed. Those zones are skipped for ZONEMD checking. |
| only_online | if true, only for ZONEMD that need online lookup of DNSKEY chain of trust are processed. |
References module_env::anchors, anchors_lookup(), auth_zone_verify_zonemd(), auth_zone_verify_zonemd_with_key(), auth_zone_zonemd_fail(), rbtree_type::count, auth_zone::data, auth_zone::dclass, trust_anchor::lock, auth_zone::name, trust_anchor::name, auth_zone::namelen, trust_anchor::numDNSKEY, trust_anchor::numDS, query_dname_compare(), regional_free_all(), module_env::scratch, auth_zone::zonemd_check, zonemd_get_dnskey_from_anchor(), and zonemd_lookup_dnskey().
Referenced by auth_zone_verify_zonemd(), auth_zones_pickup_zonemd_verify(), do_auth_zone_reload(), fr_worker_auth_add(), xfr_process_chunk_list(), zonemd_offline_verify(), and zonemd_verify_test().
| void auth_zones_pickup_zonemd_verify | ( | struct auth_zones * | az, |
| struct module_env * | env ) |
Check the ZONEMD records that need online DNSSEC chain lookups, for them spawn the lookup process to get it checked out.
Attaches the lookup process to the worker event base and mesh state.
| az | auth zones, every zones is checked. |
| env | env of the worker where the task is attached. |
References auth_zone_verify_zonemd(), auth_zones_pickup_zonemd_verify(), auth_zone::dclass, rbnode_type::key, auth_zone::lock, auth_zones::lock, log_err(), module_env::mesh, mesh_area::mods, auth_zone::name, auth_zone::namelabs, auth_zone::namelen, auth_zone::node, RBTREE_FOR, rbtree_search(), auth_zone::zonemd_check, and auth_zones::ztree.
Referenced by auth_zonemd_dnskey_lookup_callback(), auth_zones_pickup_zonemd_verify(), and worker_init().
|
static |
Get memory usage of auth rrset.
References auth_rrset_get_mem(), auth_rrset::data, and packed_rrset_sizeof().
Referenced by auth_data_get_mem(), and auth_rrset_get_mem().
|
static |
Get memory usage of auth data.
References auth_data_get_mem(), auth_rrset_get_mem(), auth_rrset::next, auth_zone::node, and auth_data::rrsets.
Referenced by auth_data_get_mem(), and auth_zone_get_mem().
|
static |
Get memory usage of auth zone.
References auth_data_get_mem(), auth_zone_get_mem(), auth_zone::data, auth_zone::namelen, auth_data::node, RBTREE_FOR, auth_zone::rpz, rpz_get_mem(), and auth_zone::zonefile.
Referenced by auth_zone_get_mem(), and az_ztree_get_mem().
|
static |
Get memory usage of list of auth addr.
References auth_addrs_get_mem(), and auth_addr::next.
Referenced by auth_addrs_get_mem(), and auth_primaries_get_mem().
|
static |
Get memory usage of list of primaries for auth xfer.
References auth_addrs_get_mem(), auth_primaries_get_mem(), auth_master::file, auth_master::host, auth_master::list, and auth_master::next.
Referenced by auth_primaries_get_mem(), and auth_xfer_get_mem().
|
static |
Get memory usage or list of auth chunks.
References auth_chunks_get_mem(), auth_chunk::len, and auth_chunk::next.
Referenced by auth_chunks_get_mem(), and auth_xfer_get_mem().
|
static |
Get memory usage of auth xfer.
References auth_xfer::allow_notify_list, auth_chunks_get_mem(), auth_primaries_get_mem(), auth_xfer_get_mem(), auth_transfer::chunks_first, auth_probe::cp, auth_transfer::cp, auth_probe::masters, auth_transfer::masters, auth_xfer::namelen, auth_xfer::task_nextprobe, auth_xfer::task_probe, auth_xfer::task_transfer, auth_nextprobe::timer, auth_probe::timer, and auth_transfer::timer.
Referenced by auth_xfer_get_mem(), and az_xtree_get_mem().
|
static |
Get memory usage of auth zones ztree.
References auth_zone_get_mem(), az_ztree_get_mem(), auth_zone::lock, RBTREE_FOR, and auth_zones::ztree.
Referenced by auth_zones_get_mem(), and az_ztree_get_mem().
|
static |
Get memory usage of auth zones xtree.
References auth_xfer_get_mem(), az_xtree_get_mem(), auth_xfer::lock, RBTREE_FOR, and auth_zones::xtree.
Referenced by auth_zones_get_mem(), and az_xtree_get_mem().
| size_t auth_zones_get_mem | ( | struct auth_zones * | zones | ) |
Get memory usage for auth zones.
The routine locks and unlocks for reading.
References auth_zones_get_mem(), az_xtree_get_mem(), az_ztree_get_mem(), auth_zones::lock, and auth_zones::rpz_lock.
Referenced by auth_zonemd_dnskey_lookup_callback(), auth_zones_get_mem(), and fr_printmem().
Disown tasks from the xfr that belong to this worker.
Only tasks for the worker in question, the comm point and timer delete functions need to run in the thread of that worker to be able to delete the callback from the event base.
| xfr | xfr structure |
| worker | the worker for which to stop tasks. |
References auth_xfer::task_nextprobe, auth_xfer::task_probe, auth_xfer::task_transfer, xfr_disown_tasks(), xfr_nextprobe_disown(), xfr_probe_disown(), and xfr_transfer_disown().
Referenced by auth_zonemd_dnskey_lookup_callback(), fr_worker_auth_del(), and xfr_disown_tasks().