unbound
0.1
|
This file contains the functions for an authority zone. More...
Data Structures | |
struct | auth_zones |
Authoritative zones, shared. More... | |
struct | auth_zone |
Auth zone. More... | |
struct | auth_data |
Auth data. More... | |
struct | auth_rrset |
A auth data RRset. More... | |
Functions | |
struct auth_zones * | auth_zones_create (void) |
Create auth zones structure. | |
int | auth_zones_apply_config (struct auth_zones *az, struct config_file *cfg) |
Apply configuration to auth zones. More... | |
void | auth_zones_delete (struct auth_zones *az) |
Delete auth zones structure. | |
int | auth_zone_write_file (struct auth_zone *z, const char *fname) |
Write auth zone data to file, in zonefile format. | |
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. More... | |
struct auth_zone * | auth_zones_find_zone (struct auth_zones *az, struct query_info *qinfo) |
Find the auth zone that is above the given qname. More... | |
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_zone * | auth_zone_create (struct auth_zones *az, uint8_t *nm, size_t nmlen, uint16_t dclass) |
create an auth zone. More... | |
int | auth_zone_set_zonefile (struct auth_zone *z, char *zonefile) |
set auth zone zonefile string. More... | |
int | auth_zone_set_fallback (struct auth_zone *z, char *fallbackstr) |
set auth zone fallback. More... | |
int | auth_zone_read_zonefile (struct auth_zone *z) |
read auth zone from zonefile. More... | |
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 | |
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.
int auth_zones_apply_config | ( | struct auth_zones * | az, |
struct config_file * | cfg | ||
) |
Apply configuration to auth zones.
Reads zonefiles.
References auth_zones_cfg_fallback(), auth_zones_cfg_zonefile(), and auth_zones_read_zones().
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::lock, auth_zone::lock, query_info::qclass, VERB_ALGO, and verbose().
Referenced by q_ans_query().
struct auth_zone* auth_zones_find_zone | ( | struct auth_zones * | az, |
struct query_info * | qinfo | ||
) |
Find the auth zone that is above the given qname.
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. |
qinfo | query info to lookup. |
Find the auth zone that is above the given qname.
References auth_zone_find(), auth_zone_find_less_equal(), dname_count_size_labels(), dname_get_shared_topdomain(), dname_is_root(), dname_remove_label(), auth_zone::name, query_info::qclass, query_info::qname, and query_info::qname_len.
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_delete(), auth_zone::data, auth_zone::dclass, dname_count_labels(), rbnode_type::key, auth_zone::lock, log_warn(), memdup(), auth_zone::name, auth_zone::namelabs, auth_zone::namelen, auth_zone::node, rbtree_init(), rbtree_insert(), and auth_zones::ztree.
Referenced by auth_zones_find_or_add_zone().
int auth_zone_set_zonefile | ( | struct auth_zone * | z, |
char * | zonefile | ||
) |
set auth zone zonefile string.
caller must have lock on zone
References log_err().
Referenced by auth_zones_cfg_zonefile().
int auth_zone_set_fallback | ( | struct auth_zone * | z, |
char * | fallbackstr | ||
) |
set auth zone fallback.
caller must have lock on zone. fallbackstr is "yes" or "no". false on parse failure.
caller must have lock on zone
References log_err().
Referenced by auth_zones_cfg_fallback().
int auth_zone_read_zonefile | ( | struct auth_zone * | z | ) |
read auth zone from zonefile.
caller must lock zone. false on failure
References az_parse_file(), sldns_file_parse_state::default_ttl, LDNS_RR_BUF_SIZE, log_err(), auth_zone::name, auth_zone::namelen, sldns_file_parse_state::origin, sldns_file_parse_state::origin_len, sldns_wire2str_dname(), VERB_ALGO, and verbose().
Referenced by auth_zones_read_zones().