#include "config.h"
#include "iterator/iter_priv.h"
#include "util/regional.h"
#include "util/log.h"
#include "util/config_file.h"
#include "util/data/dname.h"
#include "util/data/msgparse.h"
#include "util/net_help.h"
#include "util/storage/dnstree.h"
Functions | |
struct iter_priv * | priv_create () |
Create priv structure. | |
void | priv_delete (struct iter_priv *priv) |
Delete priv structure. | |
static int | read_addrs (struct iter_priv *priv, struct config_file *cfg) |
Read private-addr declarations from config. | |
static int | read_names (struct iter_priv *priv, struct config_file *cfg) |
Read private-domain declarations from config. | |
int | priv_apply_cfg (struct iter_priv *priv, struct config_file *cfg) |
Process priv config. | |
static int | priv_lookup_addr (struct iter_priv *priv, struct sockaddr_storage *addr, socklen_t addrlen) |
See if an address is blocked. | |
static int | priv_lookup_name (struct iter_priv *priv, ldns_buffer *pkt, uint8_t *name, size_t name_len, uint16_t dclass) |
See if a name is whitelisted. | |
size_t | priv_get_mem (struct iter_priv *priv) |
Get memory used by priv structure. | |
int | priv_rrset_bad (struct iter_priv *priv, ldns_buffer *pkt, struct rrset_parse *rrset) |
See if rrset is bad. |
Keep track of the private addresses and lookup fast.
struct iter_priv* priv_create | ( | ) | [read] |
Create priv structure.
References iter_priv::a, addr_tree_init(), iter_priv::n, name_tree_init(), priv_delete(), iter_priv::region, and regional_create().
Referenced by iter_apply_cfg().
void priv_delete | ( | struct iter_priv * | priv | ) |
Delete priv structure.
priv,: | to delete. |
References iter_priv::region, and regional_destroy().
Referenced by iter_deinit(), and priv_create().
int priv_apply_cfg | ( | struct iter_priv * | priv, | |
struct config_file * | cfg | |||
) |
Process priv config.
priv,: | where to store. | |
cfg,: | config options. |
References iter_priv::a, addr_tree_init(), addr_tree_init_parents(), iter_priv::n, name_tree_init(), name_tree_init_parents(), read_addrs(), read_names(), iter_priv::region, and regional_free_all().
Referenced by iter_apply_cfg().
static int priv_lookup_addr | ( | struct iter_priv * | priv, | |
struct sockaddr_storage * | addr, | |||
socklen_t | addrlen | |||
) | [static] |
See if an address is blocked.
priv,: | structure for address storage. | |
addr,: | address to check | |
addrlen,: | length of addr. |
References iter_priv::a, and addr_tree_lookup().
Referenced by priv_rrset_bad().
static int priv_lookup_name | ( | struct iter_priv * | priv, | |
ldns_buffer * | pkt, | |||
uint8_t * | name, | |||
size_t | name_len, | |||
uint16_t | dclass | |||
) | [static] |
See if a name is whitelisted.
priv,: | structure for address storage. | |
pkt,: | the packet (for compression ptrs). | |
name,: | name to check. | |
name_len,: | uncompressed length of the name to check. | |
dclass,: | class to check. |
References dname_count_size_labels(), dname_pkt_copy(), name_tree_node::labs, name_tree_node::len, log_assert, iter_priv::n, and name_tree_lookup().
Referenced by priv_rrset_bad().
size_t priv_get_mem | ( | struct iter_priv * | priv | ) |
Get memory used by priv structure.
priv,: | structure for address storage. |
References iter_priv::region, and regional_get_mem().
int priv_rrset_bad | ( | struct iter_priv * | priv, | |
ldns_buffer * | pkt, | |||
struct rrset_parse * | rrset | |||
) |
See if rrset is bad.
priv,: | structure for private address storage. | |
pkt,: | packet to decompress rrset name in. | |
rrset,: | the rrset to examine, A or AAAA. |
References iter_priv::a, rbtree_t::count, rrset_parse::dname, rrset_parse::dname_len, INET6_SIZE, INET_SIZE, name_tree_node::len, rr_parse::next, priv_lookup_addr(), priv_lookup_name(), rrset_parse::rr_first, rrset_parse::rrset_class, rr_parse::ttl_data, and rrset_parse::type.
Referenced by scrub_sanitize().