Macros | Functions
iter_utils.c File Reference

This file contains functions to assist the iterator module. More...

#include "config.h"
#include "iterator/iter_utils.h"
#include "iterator/iterator.h"
#include "iterator/iter_hints.h"
#include "iterator/iter_fwd.h"
#include "iterator/iter_donotq.h"
#include "iterator/iter_delegpt.h"
#include "iterator/iter_priv.h"
#include "services/cache/infra.h"
#include "services/cache/dns.h"
#include "services/cache/rrset.h"
#include "util/net_help.h"
#include "util/module.h"
#include "util/log.h"
#include "util/config_file.h"
#include "util/regional.h"
#include "util/data/msgparse.h"
#include "util/data/dname.h"
#include "util/random.h"
#include "util/fptr_wlist.h"
#include "validator/val_anchor.h"
#include "validator/val_kcache.h"
#include "validator/val_kentry.h"
#include "validator/val_utils.h"
#include "validator/val_sigcrypt.h"
#include "ldns/sbuffer.h"

Macros

#define SUSPICION_RECENT_EXPIRY   86400
 time when nameserver glue is said to be 'recent'
 
#define BLACKLIST_PENALTY   (USEFUL_SERVER_TOP_TIMEOUT*4)
 penalty to validation failed blacklisted IPs
 

Functions

static void fetch_fill (struct iter_env *ie, const char *str)
 fillup fetch policy array
 
static int read_fetch_policy (struct iter_env *ie, const char *str)
 Read config string that represents the target fetch policy.
 
int iter_apply_cfg (struct iter_env *iter_env, struct config_file *cfg)
 Process config options and set iterator module state. More...
 
static int iter_filter_unsuitable (struct iter_env *iter_env, struct module_env *env, uint8_t *name, size_t namelen, uint16_t qtype, time_t now, struct delegpt_addr *a)
 filter out unsuitable targets More...
 
static int iter_fill_rtt (struct iter_env *iter_env, struct module_env *env, uint8_t *name, size_t namelen, uint16_t qtype, time_t now, struct delegpt *dp, int *best_rtt, struct sock_list *blacklist)
 lookup RTT information, and also store fastest rtt (if any)
 
static int iter_filter_order (struct iter_env *iter_env, struct module_env *env, uint8_t *name, size_t namelen, uint16_t qtype, time_t now, struct delegpt *dp, int *selected_rtt, int open_target, struct sock_list *blacklist)
 filter the addres list, putting best targets at front, returns number of best targets (or 0, no suitable targets)
 
struct delegpt_addriter_server_selection (struct iter_env *iter_env, struct module_env *env, struct delegpt *dp, uint8_t *name, size_t namelen, uint16_t qtype, int *dnssec_lame, int *chase_to_rd, int open_target, struct sock_list *blacklist)
 Select a valid, nice target to send query to. More...
 
struct dns_msgdns_alloc_msg (sldns_buffer *pkt, struct msg_parse *msg, struct regional *region)
 Allocate dns_msg from parsed msg, in regional. More...
 
struct dns_msgdns_copy_msg (struct dns_msg *from, struct regional *region)
 Copy a dns_msg to this regional. More...
 
void iter_dns_store (struct module_env *env, struct query_info *msgqinf, struct reply_info *msgrep, int is_referral, time_t leeway, int pside, struct regional *region)
 Allocate a dns_msg with malloc/alloc structure and store in dns cache. More...
 
int iter_ns_probability (struct ub_randstate *rnd, int n, int m)
 Select randomly with n/m probability. More...
 
static int causes_cycle (struct module_qstate *qstate, uint8_t *name, size_t namelen, uint16_t t, uint16_t c)
 detect dependency cycle for query and target
 
void iter_mark_cycle_targets (struct module_qstate *qstate, struct delegpt *dp)
 Mark targets that result in a dependency cycle as done, so they will not get selected as targets. More...
 
void iter_mark_pside_cycle_targets (struct module_qstate *qstate, struct delegpt *dp)
 Mark targets that result in a dependency cycle as done, so they will not get selected as targets. More...
 
int iter_dp_is_useless (struct query_info *qinfo, uint16_t qflags, struct delegpt *dp)
 See if delegation is useful or offers immediately no targets for further recursion. More...
 
int iter_indicates_dnssec (struct module_env *env, struct delegpt *dp, struct dns_msg *msg, uint16_t dclass)
 See if delegation is expected to have DNSSEC information (RRSIGs) in its answers, or not. More...
 
int iter_msg_has_dnssec (struct dns_msg *msg)
 See if a message contains DNSSEC. More...
 
int iter_msg_from_zone (struct dns_msg *msg, struct delegpt *dp, enum response_type type, uint16_t dclass)
 See if a message is known to be from a certain zone. More...
 
static int rrset_equal (struct ub_packed_rrset_key *k1, struct ub_packed_rrset_key *k2)
 check equality of two rrsets More...
 
int reply_equal (struct reply_info *p, struct reply_info *q, struct regional *region)
 Check if two replies are equal For fallback procedures. More...
 
void iter_store_parentside_rrset (struct module_env *env, struct ub_packed_rrset_key *rrset)
 Store parent-side rrset in seperate rrset cache entries for later last-resort * lookups in case the child-side versions of this information fails. More...
 
static struct ub_packed_rrset_keyreply_get_NS_rrset (struct reply_info *rep)
 fetch NS record from reply, if any
 
void iter_store_parentside_NS (struct module_env *env, struct reply_info *rep)
 Store parent-side NS records from a referral message. More...
 
void iter_store_parentside_neg (struct module_env *env, struct query_info *qinfo, struct reply_info *rep)
 Store parent-side negative element, the parentside rrset does not exist, creates an rrset with empty rdata in the rrset cache with PARENTSIDE flag. More...
 
int iter_lookup_parent_NS_from_cache (struct module_env *env, struct delegpt *dp, struct regional *region, struct query_info *qinfo)
 Add parent NS record if that exists in the cache. More...
 
int iter_lookup_parent_glue_from_cache (struct module_env *env, struct delegpt *dp, struct regional *region, struct query_info *qinfo)
 Add parent-side glue if that exists in the cache. More...
 
int iter_get_next_root (struct iter_hints *hints, struct iter_forwards *fwd, uint16_t *c)
 Lookup next root-hint or root-forward entry. More...
 
void iter_scrub_ds (struct dns_msg *msg, struct ub_packed_rrset_key *ns, uint8_t *z)
 Remove DS records that are inappropriate before they are cached. More...
 
void iter_dec_attempts (struct delegpt *dp, int d)
 Remove query attempts from all available ips. More...
 
void iter_merge_retry_counts (struct delegpt *dp, struct delegpt *old)
 Add retry counts from older delegpt to newer delegpt. More...
 
int iter_ds_toolow (struct dns_msg *msg, struct delegpt *dp)
 See if a DS response (type ANSWER) is too low: a nodata answer with a SOA record in the authority section at-or-below the qchase.qname. More...
 
int iter_dp_cangodown (struct query_info *qinfo, struct delegpt *dp)
 See if delegpt can go down a step to the qname or not. More...
 

Detailed Description

This file contains functions to assist the iterator module.

Configuration options. Forward zones.

Function Documentation

int iter_apply_cfg ( struct iter_env iter_env,
struct config_file cfg 
)

Process config options and set iterator module state.

Sets default values if no config is found.

Parameters
iter_enviterator module state.
cfgconfig options.
Returns
0 on error.

References config_file::do_ip4, config_file::do_ip6, iter_env::donotq, donotq_apply_cfg(), donotq_create(), log_err(), iter_env::max_dependency_depth, iter_env::priv, priv_apply_cfg(), priv_create(), read_fetch_policy(), iter_env::supports_ipv4, iter_env::supports_ipv6, iter_env::target_fetch_policy, config_file::target_fetch_policy, VERB_QUERY, and verbose().

Referenced by iter_init().

static int iter_filter_unsuitable ( struct iter_env iter_env,
struct module_env env,
uint8_t *  name,
size_t  namelen,
uint16_t  qtype,
time_t  now,
struct delegpt_addr a 
)
static

filter out unsuitable targets

Parameters
iter_enviterator environment with ipv6-support flag.
envmodule environment with infra cache.
namezone name
namelenlength of name
qtypequery type (host order).
nowcurrent time
aaddress in delegation point we are examining.
Returns
an integer that signals the target suitability. as follows: -1: The address should be omitted from the list. Because: o The address is bogus (DNSSEC validation failure). o Listed as donotquery o is ipv6 but no ipv6 support (in operating system). o is ipv4 but no ipv4 support (in operating system). o is lame Otherwise, an rtt in milliseconds. 0 .. USEFUL_SERVER_TOP_TIMEOUT-1 The roundtrip time timeout estimate. less than 2 minutes. Note that util/rtt.c has a MIN_TIMEOUT of 50 msec, thus values 0 .. 49 are not used, unless that is changed. USEFUL_SERVER_TOP_TIMEOUT This value exactly is given for unresponsive blacklisted. USEFUL_SERVER_TOP_TIMEOUT+1 For non-blacklisted servers: huge timeout, but has traffic. USEFUL_SERVER_TOP_TIMEOUT*1 .. parent-side lame servers get this penalty. A dispreferential server. (lame in delegpt). USEFUL_SERVER_TOP_TIMEOUT*2 .. dnsseclame servers get penalty USEFUL_SERVER_TOP_TIMEOUT*3 .. recursion lame servers get penalty UNKNOWN_SERVER_NICENESS If no information is known about the server, this is returned. 376 msec or so. +BLACKLIST_PENALTY (of USEFUL_TOP_TIMEOUT*4) for dnssec failed IPs.

When a final value is chosen that is dnsseclame ; dnsseclameness checking is turned off (so we do not discard the reply). When a final value is chosen that is recursionlame; RD bit is set on query. Because of the numbers this means recursionlame also have dnssec lameness checking turned off.

References delegpt_addr::addr, addr_is_ip6(), delegpt_addr::addrlen, delegpt_addr::bogus, delegpt_addr::dnsseclame, iter_env::donotq, donotq_lookup(), module_env::infra_cache, infra_get_lame_rtt(), delegpt_addr::lame, log_addr(), iter_env::supports_ipv4, iter_env::supports_ipv6, UNKNOWN_SERVER_NICENESS, USEFUL_SERVER_TOP_TIMEOUT, VERB_ALGO, and verbose().

Referenced by iter_fill_rtt().

struct delegpt_addr* iter_server_selection ( struct iter_env iter_env,
struct module_env env,
struct delegpt dp,
uint8_t *  name,
size_t  namelen,
uint16_t  qtype,
int *  dnssec_lame,
int *  chase_to_rd,
int  open_target,
struct sock_list blacklist 
)

Select a valid, nice target to send query to.

Sorting and removing unsuitable targets is combined.

Parameters
iter_enviterator module global state, with ip6 enabled and do-not-query-addresses.
envenvironment with infra cache (lameness, rtt info).
dpdelegation point with result list.
namezone name (for lameness check).
namelenlength of name.
qtypequery type that we want to send.
dnssec_lameset to 1, if a known dnssec-lame server is selected these are not preferred, but are used as a last resort.
chase_to_rdset to 1 if a known recursion lame server is selected these are not preferred, but are used as a last resort.
open_targetnumber of currently outstanding target queries. If we wait for these, perhaps more server addresses become available.
blacklistthe IP blacklist to use.
Returns
best target or NULL if no target. if not null, that target is removed from the result list in the dp.

References delegpt_addr::attempts, BLACKLIST_PENALTY, iter_filter_order(), log_assert, delegpt_addr::next_result, module_env::now, OUTBOUND_MSG_RETRY, delegpt::result_list, module_env::rnd, ub_random_max(), USEFUL_SERVER_TOP_TIMEOUT, VERB_ALGO, and verbose().

Referenced by processQueryTargets().

struct dns_msg* dns_alloc_msg ( struct sldns_buffer pkt,
struct msg_parse msg,
struct regional regional 
)

Allocate dns_msg from parsed msg, in regional.

Parameters
pktpacket.
msgparsed message (cleaned and ready for regional allocation).
regionalregional to use for allocation.
Returns
newly allocated dns_msg, or NULL on memory error.

References log_err(), parse_create_msg(), dns_msg::qinfo, regional_alloc(), and dns_msg::rep.

Referenced by process_response().

struct dns_msg* dns_copy_msg ( struct dns_msg from,
struct regional regional 
)

Copy a dns_msg to this regional.

Parameters
fromdns message, also in regional.
regionalregional to use for allocation.
Returns
newly allocated dns_msg, or NULL on memory error.

References dns_msg::qinfo, query_info::qname, query_info::qname_len, regional_alloc(), regional_alloc_init(), dns_msg::rep, and reply_info_copy().

Referenced by prime_supers(), and processClassResponse().

void iter_dns_store ( struct module_env env,
struct query_info qinf,
struct reply_info rep,
int  is_referral,
time_t  leeway,
int  pside,
struct regional region 
)

Allocate a dns_msg with malloc/alloc structure and store in dns cache.

Parameters
envenvironment, with alloc structure and dns cache.
qinfquery info, the query for which answer is stored.
repreply in dns_msg from dns_alloc_msg for example.
is_referralIf true, then the given message to be stored is a referral. The cache implementation may use this as a hint.
leewayprefetch TTL leeway to expire old rrsets quicker.
psidetrue if dp is parentside, thus message is 'fresh' and NS can be prefetch-updates.
regionto copy modified (cache is better) rrs back to.
Returns
void, because we are not interested in alloc errors, the iterator and validator can operate on the results in their scratch space (the qstate.region) and are not dependent on the cache. It is useful to log the alloc failure (for the server operator), but the query resolution can continue without cache storage.

References dns_cache_store(), and log_err().

Referenced by error_response_cache(), processFinished(), and processQueryResponse().

int iter_ns_probability ( struct ub_randstate *  rnd,
int  n,
int  m 
)

Select randomly with n/m probability.

For shuffle NS records for address fetching.

Parameters
rndrandom table
nprobability.
mdivisor for probability.
Returns
true with n/m probability.

References ub_random_max().

Referenced by query_for_targets().

void iter_mark_cycle_targets ( struct module_qstate qstate,
struct delegpt dp 
)

Mark targets that result in a dependency cycle as done, so they will not get selected as targets.

Parameters
qstatequery state.
dpdelegpt to mark ns in.

References causes_cycle(), LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, log_nametypeclass(), delegpt_ns::name, delegpt_ns::namelen, delegpt_ns::next, delegpt::nslist, query_info::qclass, module_qstate::qinfo, delegpt_ns::resolved, and VERB_QUERY.

Referenced by query_for_targets().

void iter_mark_pside_cycle_targets ( struct module_qstate qstate,
struct delegpt dp 
)

Mark targets that result in a dependency cycle as done, so they will not get selected as targets.

For the parent-side lookups.

Parameters
qstatequery state.
dpdelegpt to mark ns in.

References causes_cycle(), delegpt_ns::done_pside4, delegpt_ns::done_pside6, LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, log_nametypeclass(), delegpt_ns::name, delegpt_ns::namelen, delegpt_ns::next, delegpt::nslist, query_info::qclass, module_qstate::qinfo, and VERB_QUERY.

Referenced by processLastResort().

int iter_dp_is_useless ( struct query_info qinfo,
uint16_t  qflags,
struct delegpt dp 
)

See if delegation is useful or offers immediately no targets for further recursion.

Parameters
qinfoquery name and type
qflagsquery flags with RD flag
dpdelegpt to check.
Returns
true if dp is useless.

References BIT_RD, delegpt_find_ns(), dname_subdomain_c(), LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, delegpt::name, delegpt_ns::name, delegpt_ns::next, delegpt::nslist, query_info::qname, query_info::qname_len, query_info::qtype, delegpt_ns::resolved, delegpt::result_list, and delegpt::usable_list.

Referenced by processInitRequest().

int iter_indicates_dnssec ( struct module_env env,
struct delegpt dp,
struct dns_msg msg,
uint16_t  dclass 
)

See if delegation is expected to have DNSSEC information (RRSIGs) in its answers, or not.

Inspects delegation point (name), trust anchors, and delegation message (DS RRset) to determine this.

Parameters
envmodule env with trust anchors.
dpdelegation point.
msgdelegation message, with DS if a secure referral.
dclassclass of query.
Returns
1 if dnssec is expected, 0 if not.

References anchor_find(), module_env::anchors, module_env::key_cache, key_cache_obtain(), key_entry_isbad(), key_entry_isgood(), key_entry_isnull(), LDNS_RR_TYPE_DS, trust_anchor::lock, delegpt::name, key_entry_key::name, delegpt::namelabs, delegpt::namelen, module_env::now, query_dname_compare(), regional_free_all(), dns_msg::rep, reply_find_rrset_section_ns(), and module_env::scratch.

Referenced by generate_parentside_target_query(), prime_root(), prime_stub(), processInitRequest3(), and processQueryResponse().

int iter_msg_has_dnssec ( struct dns_msg msg)

See if a message contains DNSSEC.

This is examined by looking for RRSIGs. With DNSSEC a valid answer, nxdomain, nodata, referral or cname reply has RRSIGs in answer or auth sections, sigs on answer data, SOA, DS, or NSEC/NSEC3 records.

Parameters
msgmessage to examine.
Returns
true if DNSSEC information was found.

References reply_info::an_numrrsets, reply_info::ns_numrrsets, dns_msg::rep, and reply_info::rrsets.

Referenced by processQueryResponse().

int iter_msg_from_zone ( struct dns_msg msg,
struct delegpt dp,
enum response_type  type,
uint16_t  dclass 
)

See if a message is known to be from a certain zone.

This looks for SOA or NS rrsets, for answers. For referrals, when one label is delegated, the zone is detected. Does not look at signatures.

Parameters
msgthe message to inspect.
dpdelegation point with zone name to look for.
typetype of message.
dclassclass of query.
Returns
true if message is certain to be from zone in dp->name. false if not sure (empty msg), or not from the zone.

References reply_info::an_numrrsets, packed_rrset_key::dname, dname_count_labels(), dname_strict_subdomain(), LDNS_RR_TYPE_NS, LDNS_RR_TYPE_SOA, log_assert, delegpt::name, delegpt::namelabs, delegpt::namelen, reply_info::ns_numrrsets, dns_msg::rep, reply_find_rrset_section_an(), reply_find_rrset_section_ns(), RESPONSE_TYPE_ANSWER, RESPONSE_TYPE_CNAME, RESPONSE_TYPE_REFERRAL, ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, reply_info::rrsets, and packed_rrset_key::type.

Referenced by processQueryResponse().

static int rrset_equal ( struct ub_packed_rrset_key k1,
struct ub_packed_rrset_key k2 
)
static
int reply_equal ( struct reply_info p,
struct reply_info q,
struct regional region 
)

Check if two replies are equal For fallback procedures.

Parameters
preply one. The reply has rrset data pointers in region. Does not check rrset-IDs
qreply two
regionscratch buffer.
Returns
if one and two are equal.

References reply_info::an_numrrsets, reply_info::ar_numrrsets, reply_info::flags, reply_info::ns_numrrsets, reply_info::qdcount, regional_free_all(), rrset_canonical_equal(), reply_info::rrset_count, rrset_equal(), reply_info::rrsets, and reply_info::security.

Referenced by process_response().

void iter_store_parentside_rrset ( struct module_env env,
struct ub_packed_rrset_key rrset 
)

Store parent-side rrset in seperate rrset cache entries for later last-resort * lookups in case the child-side versions of this information fails.

Parameters
envenvironment with cache, time, ...
rrsetthe rrset to store (copied). Failure to store is logged, but otherwise ignored.

References module_env::alloc, rrset_ref::id, rrset_ref::key, log_err(), module_env::now, packed_rrset_copy_alloc(), PACKED_RRSET_PARENT_SIDE, module_env::rrset_cache, rrset_cache_update(), and rrset_key_hash().

Referenced by iter_store_parentside_neg(), iter_store_parentside_NS(), and processQueryResponse().

void iter_store_parentside_NS ( struct module_env env,
struct reply_info rep 
)

Store parent-side NS records from a referral message.

Parameters
envenvironment with cache, time, ...
represponse with NS rrset. Failure to store is logged, but otherwise ignored.

References iter_store_parentside_rrset(), log_rrset_key(), reply_get_NS_rrset(), and VERB_ALGO.

Referenced by processQueryResponse().

void iter_store_parentside_neg ( struct module_env env,
struct query_info qinfo,
struct reply_info rep 
)
int iter_lookup_parent_NS_from_cache ( struct module_env env,
struct delegpt dp,
struct regional region,
struct query_info qinfo 
)

Add parent NS record if that exists in the cache.

This is both new information and acts like a timeout throttle on retries.

Parameters
envquery env with rrset cache and time.
dpdelegation point to store result in. Also this dp is used to see which NS name is needed.
regionregion to alloc result in.
qinfopertinent information, the qclass.
Returns
false on malloc failure. if true, the routine worked and if such cached information existed dp->has_parent_side_NS is set true.

References delegpt_rrset_add_ns(), ub_packed_rrset_key::entry, delegpt::has_parent_side_NS, LDNS_RR_TYPE_NS, lruhash_entry::lock, log_rrset_key(), delegpt::name, delegpt::namelen, module_env::now, PACKED_RRSET_PARENT_SIDE, query_info::qclass, module_env::rrset_cache, rrset_cache_lookup(), and VERB_ALGO.

Referenced by processLastResort().

int iter_lookup_parent_glue_from_cache ( struct module_env env,
struct delegpt dp,
struct regional region,
struct query_info qinfo 
)

Add parent-side glue if that exists in the cache.

This is both new information and acts like a timeout throttle on retries to fetch them.

Parameters
envquery env with rrset cache and time.
dpdelegation point to store result in. Also this dp is used to see which NS name is needed.
regionregion to alloc result in.
qinfopertinent information, the qclass.
Returns
: true, it worked, no malloc failures, and new addresses (lame) have been added, giving extra options as query targets.

References delegpt_add_rrset_A(), delegpt_add_rrset_AAAA(), delegpt_count_targets(), delegpt_ns::done_pside4, delegpt_ns::done_pside6, ub_packed_rrset_key::entry, LDNS_RR_TYPE_A, LDNS_RR_TYPE_AAAA, lruhash_entry::lock, log_err(), log_rrset_key(), delegpt_ns::name, delegpt_ns::namelen, delegpt_ns::next, module_env::now, delegpt::nslist, PACKED_RRSET_PARENT_SIDE, query_info::qclass, module_env::rrset_cache, rrset_cache_lookup(), and VERB_ALGO.

Referenced by processLastResort().

int iter_get_next_root ( struct iter_hints hints,
struct iter_forwards fwd,
uint16_t *  c 
)

Lookup next root-hint or root-forward entry.

Parameters
hintsthe hints.
fwdthe forwards.
cthe class to start searching at. 0 means find first one.
Returns
false if no classes found, true if found and returned in c.

References forwards_next_root(), and hints_next_root().

Referenced by processCollectClass().

void iter_scrub_ds ( struct dns_msg msg,
struct ub_packed_rrset_key ns,
uint8_t *  z 
)

Remove DS records that are inappropriate before they are cached.

Parameters
msgthe response to scrub.
nsRRSET that is the NS record for the referral. if NULL, then all DS records are removed from the authority section.
zzone name that the response is from.

References reply_info::an_numrrsets, packed_rrset_key::dname, dname_subdomain_c(), LDNS_RR_TYPE_DS, log_nametypeclass(), reply_info::ns_numrrsets, query_dname_compare(), dns_msg::rep, ub_packed_rrset_key::rk, packed_rrset_key::rrset_class, reply_info::rrset_count, reply_info::rrsets, packed_rrset_key::type, and VERB_ALGO.

Referenced by processQueryResponse().

void iter_dec_attempts ( struct delegpt dp,
int  d 
)

Remove query attempts from all available ips.

For 0x20.

Parameters
dpdelegpt.
ddecrease.

References delegpt_addr::attempts, delegpt_addr::next_result, delegpt_addr::next_target, OUTBOUND_MSG_RETRY, delegpt::result_list, and delegpt::target_list.

Referenced by process_response(), and processQueryTargets().

void iter_merge_retry_counts ( struct delegpt dp,
struct delegpt old 
)

Add retry counts from older delegpt to newer delegpt.

Does not waste time on timeout'd (or other failing) addresses.

Parameters
dpnew delegationpoint.
oldold delegationpoint.

References delegpt_addr::addr, delegpt_addr::addrlen, delegpt_addr::attempts, delegpt_find_addr(), log_addr(), delegpt_addr::next_target, delegpt_addr::next_usable, OUTBOUND_MSG_RETRY, delegpt::target_list, delegpt::usable_list, and VERB_ALGO.

Referenced by processQueryResponse().

int iter_ds_toolow ( struct dns_msg msg,
struct delegpt dp 
)

See if a DS response (type ANSWER) is too low: a nodata answer with a SOA record in the authority section at-or-below the qchase.qname.

Also returns true if we are not sure (i.e. empty message, CNAME nosig).

Parameters
msgthe response.
dpthe dp name is used to check if the RRSIG gives a clue that it was originated from the correct nameserver.
Returns
true if too low.

References reply_info::an_numrrsets, packed_rrset_key::dname, dname_subdomain_c(), LDNS_RR_TYPE_CNAME, LDNS_RR_TYPE_DNAME, LDNS_RR_TYPE_DS, LDNS_RR_TYPE_SOA, delegpt::name, reply_info::ns_numrrsets, dns_msg::qinfo, query_info::qname, query_dname_compare(), dns_msg::rep, ub_packed_rrset_key::rk, reply_info::rrsets, packed_rrset_key::type, and val_find_rrset_signer().

Referenced by processQueryResponse().

int iter_dp_cangodown ( struct query_info qinfo,
struct delegpt dp 
)

See if delegpt can go down a step to the qname or not.

Parameters
qinfothe query name looked up.
dpchecked if the name can go lower to the qname
Returns
true if can go down, false if that would not be possible. the current response seems to be the one and only, best possible, response.

References dname_count_labels(), delegpt::name, delegpt::namelabs, query_info::qname, and query_dname_compare().

Referenced by processQueryResponse().