query.c File Reference

#include <config.h>
#include <string.h>
#include <isc/hex.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/serial.h>
#include <isc/stats.h>
#include <isc/util.h>
#include <dns/adb.h>
#include <dns/badcache.h>
#include <dns/byaddr.h>
#include <dns/cache.h>
#include <dns/db.h>
#include <dns/dlz.h>
#include <dns/dns64.h>
#include <dns/dnssec.h>
#include <dns/events.h>
#include <dns/message.h>
#include <dns/ncache.h>
#include <dns/nsec3.h>
#include <dns/order.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dns/resolver.h>
#include <dns/result.h>
#include <dns/stats.h>
#include <dns/tkey.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <dns/zt.h>
#include <named/client.h>
#include <named/globals.h>
#include <named/log.h>
#include <named/server.h>
#include <named/sortlist.h>
#include <named/xfrout.h>

Go to the source code of this file.

Data Structures

struct  client_additionalctx

Defines

#define PARTIALANSWER(c)
 Partial answer?
#define USECACHE(c)
 Use Cache?
#define RECURSIONOK(c)
 Recursion OK?
#define RECURSING(c)
 Recursing?
#define CACHEGLUEOK(c)
 Cache glue ok?
#define WANTRECURSION(c)
 Want Recursion?
#define WANTDNSSEC(c)
 Want DNSSEC?
#define WANTAD(c)
 Want WANTAD?
#define HAVESIT(c)   (0)
#define NOAUTHORITY(c)
 No authority?
#define NOADDITIONAL(c)
 No additional?
#define SECURE(c)
 Secure?
#define DNS64(c)
 DNS64 A lookup?
#define DNS64EXCLUDE(c)
#define REDIRECT(c)
#define NOQNAME(r)
 No QNAME Proof?
#define CTRACE(l, m)   ((void)m)
#define DNS_GETDB_NOEXACT   0x01U
#define DNS_GETDB_NOLOG   0x02U
#define DNS_GETDB_PARTIAL   0x04U
#define DNS_GETDB_IGNOREACL   0x08U
#define PENDINGOK(x)   (((x) & DNS_DBFIND_PENDINGOK) != 0)
#define SFCACHE_CDFLAG   0x1
#define MAX_RESTARTS   16
#define QUERY_ERROR(r)
#define RECURSE_ERROR(r)
#define NS_NAME_INIT(A, B)

Typedefs

typedef struct client_additionalctx client_additionalctx_t

Functions

static isc_result_t query_find (ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
static isc_boolean_t validate (ns_client_t *client, dns_db_t *db, dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static void query_findclosestnsec3 (dns_name_t *qname, dns_db_t *db, dns_dbversion_t *version, ns_client_t *client, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_name_t *fname, isc_boolean_t exact, dns_name_t *found)
static void log_queryerror (ns_client_t *client, isc_result_t result, int line, int level)
static void rpz_st_clear (ns_client_t *client)
static void inc_stats (ns_client_t *client, isc_statscounter_t counter)
 Increment query statistics counters.
static void query_send (ns_client_t *client)
static void query_error (ns_client_t *client, isc_result_t result, int line)
static void query_next (ns_client_t *client, isc_result_t result)
static void query_freefreeversions (ns_client_t *client, isc_boolean_t everything)
void ns_query_cancel (ns_client_t *client)
static void query_putrdataset (ns_client_t *client, dns_rdataset_t **rdatasetp)
static void query_reset (ns_client_t *client, isc_boolean_t everything)
static void query_next_callback (ns_client_t *client)
void ns_query_free (ns_client_t *client)
static isc_result_t query_newnamebuf (ns_client_t *client)
static isc_buffer_tquery_getnamebuf (ns_client_t *client)
static void query_keepname (ns_client_t *client, dns_name_t *name, isc_buffer_t *dbuf)
static void query_releasename (ns_client_t *client, dns_name_t **namep)
static dns_name_tquery_newname (ns_client_t *client, isc_buffer_t *dbuf, isc_buffer_t *nbuf)
static dns_rdataset_tquery_newrdataset (ns_client_t *client)
static isc_result_t query_newdbversion (ns_client_t *client, unsigned int n)
static ns_dbversion_tquery_getdbversion (ns_client_t *client)
isc_result_t ns_query_init (ns_client_t *client)
static ns_dbversion_tquery_findversion (ns_client_t *client, dns_db_t *db)
static isc_result_t query_validatezonedb (ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype, unsigned int options, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t **versionp)
static isc_result_t query_getzonedb (ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype, unsigned int options, dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp)
static void rpz_log_rewrite (ns_client_t *client, isc_boolean_t disabled, dns_rpz_policy_t policy, dns_rpz_type_t type, dns_zone_t *p_zone, dns_name_t *p_name, dns_name_t *cname)
static void rpz_log_fail (ns_client_t *client, int level, dns_name_t *p_name, dns_rpz_type_t rpz_type, const char *str, isc_result_t result)
static isc_result_t rpz_getdb (ns_client_t *client, dns_name_t *p_name, dns_rpz_type_t rpz_type, dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp)
static isc_result_t query_getcachedb (ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype, dns_db_t **dbp, unsigned int options)
static isc_result_t query_getdb (ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype, unsigned int options, dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp, isc_boolean_t *is_zonep)
static isc_boolean_t query_isduplicate (ns_client_t *client, dns_name_t *name, dns_rdatatype_t type, dns_name_t **mnamep)
static isc_result_t query_addadditional (void *arg, dns_name_t *name, dns_rdatatype_t qtype)
static void query_discardcache (ns_client_t *client, dns_rdataset_t *rdataset_base, dns_rdatasetadditional_t additionaltype, dns_rdatatype_t type, dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp, dns_dbnode_t **nodep, dns_name_t *fname)
static isc_result_t query_iscachevalid (dns_zone_t *zone, dns_db_t *db, dns_db_t *db0, dns_dbversion_t *version)
static isc_result_t query_addadditional2 (void *arg, dns_name_t *name, dns_rdatatype_t qtype)
static void query_addrdataset (ns_client_t *client, dns_name_t *fname, dns_rdataset_t *rdataset)
static isc_result_t query_dns64 (ns_client_t *client, dns_name_t **namep, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, isc_buffer_t *dbuf, dns_section_t section)
static void query_filter64 (ns_client_t *client, dns_name_t **namep, dns_rdataset_t *rdataset, isc_buffer_t *dbuf, dns_section_t section)
static void query_addrrset (ns_client_t *client, dns_name_t **namep, dns_rdataset_t **rdatasetp, dns_rdataset_t **sigrdatasetp, isc_buffer_t *dbuf, dns_section_t section)
static isc_result_t query_addsoa (ns_client_t *client, dns_db_t *db, dns_dbversion_t *version, unsigned int override_ttl, isc_boolean_t isassociated, dns_section_t section)
static isc_result_t query_addns (ns_client_t *client, dns_db_t *db, dns_dbversion_t *version)
static isc_result_t query_add_cname (ns_client_t *client, dns_name_t *qname, dns_name_t *tname, dns_trust_t trust, dns_ttl_t ttl)
static void mark_secure (ns_client_t *client, dns_db_t *db, dns_name_t *name, dns_rdata_rrsig_t *rrsig, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_boolean_t get_key (ns_client_t *client, dns_db_t *db, dns_rdata_rrsig_t *rrsig, dns_rdataset_t *keyrdataset, dst_key_t **keyp)
static isc_boolean_t verify (dst_key_t *key, dns_name_t *name, dns_rdataset_t *rdataset, dns_rdata_t *rdata, ns_client_t *client)
static void query_addbestns (ns_client_t *client)
static void fixrdataset (ns_client_t *client, dns_rdataset_t **rdataset)
static void fixfname (ns_client_t *client, dns_name_t **fname, isc_buffer_t **dbuf, isc_buffer_t *nbuf)
static void query_addds (ns_client_t *client, dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_name_t *name)
static void query_addwildcardproof (ns_client_t *client, dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, isc_boolean_t ispositive, isc_boolean_t nodata)
static void query_addnxrrsetnsec (ns_client_t *client, dns_db_t *db, dns_dbversion_t *version, dns_name_t **namep, dns_rdataset_t **rdatasetp, dns_rdataset_t **sigrdatasetp)
static void query_resume (isc_task_t *task, isc_event_t *event)
static void prefetch_done (isc_task_t *task, isc_event_t *event)
static void query_prefetch (ns_client_t *client, dns_name_t *qname, dns_rdataset_t *rdataset)
static isc_result_t query_recurse (ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname, dns_name_t *qdomain, dns_rdataset_t *nameservers, isc_boolean_t resuming)
static void rpz_clean (dns_zone_t **zonep, dns_db_t **dbp, dns_dbnode_t **nodep, dns_rdataset_t **rdatasetp)
static void rpz_match_clear (dns_rpz_st_t *st)
static isc_result_t rpz_ready (ns_client_t *client, dns_rdataset_t **rdatasetp)
static dns_rpz_zbits_t rpz_get_zbits (ns_client_t *client, dns_rdatatype_t ip_type, dns_rpz_type_t rpz_type)
static isc_result_t rpz_rrset_find (ns_client_t *client, dns_name_t *name, dns_rdatatype_t type, dns_rpz_type_t rpz_type, dns_db_t **dbp, dns_dbversion_t *version, dns_rdataset_t **rdatasetp, isc_boolean_t resuming)
static isc_result_t rpz_get_p_name (ns_client_t *client, dns_name_t *p_name, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type, dns_name_t *trig_name)
static isc_result_t rpz_find_p (ns_client_t *client, dns_name_t *self_name, dns_rdatatype_t qtype, dns_name_t *p_name, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type, dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp, dns_dbnode_t **nodep, dns_rdataset_t **rdatasetp, dns_rpz_policy_t *policyp)
static void rpz_save_p (dns_rpz_st_t *st, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type, dns_rpz_policy_t policy, dns_name_t *p_name, dns_rpz_prefix_t prefix, isc_result_t result, dns_zone_t **zonep, dns_db_t **dbp, dns_dbnode_t **nodep, dns_rdataset_t **rdatasetp, dns_dbversion_t *version)
static isc_result_t rpz_rewrite_ip (ns_client_t *client, const isc_netaddr_t *netaddr, dns_rdatatype_t qtype, dns_rpz_type_t rpz_type, dns_rpz_zbits_t zbits, dns_rdataset_t **p_rdatasetp)
static isc_result_t rpz_rewrite_ip_rrset (ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype, dns_rpz_type_t rpz_type, dns_rdatatype_t ip_type, dns_db_t **ip_dbp, dns_dbversion_t *ip_version, dns_rdataset_t **ip_rdatasetp, dns_rdataset_t **p_rdatasetp, isc_boolean_t resuming)
static isc_result_t rpz_rewrite_ip_rrsets (ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype, dns_rpz_type_t rpz_type, dns_rdataset_t **ip_rdatasetp, isc_boolean_t resuming)
static isc_result_t rpz_rewrite_name (ns_client_t *client, dns_name_t *trig_name, dns_rdatatype_t qtype, dns_rpz_type_t rpz_type, dns_rpz_zbits_t allowed_zbits, dns_rdataset_t **rdatasetp)
static void rpz_rewrite_ns_skip (ns_client_t *client, dns_name_t *nsname, isc_result_t result, int level, const char *str)
static isc_result_t rpz_rewrite (ns_client_t *client, dns_rdatatype_t qtype, isc_result_t qresult, isc_boolean_t resuming)
static isc_boolean_t rpz_ck_dnssec (ns_client_t *client, isc_result_t qresult, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t rpz_add_cname (ns_client_t *client, dns_rpz_st_t *st, dns_name_t *cname, dns_name_t *fname, isc_buffer_t *dbuf)
static isc_result_t rdata_tonetaddr (const dns_rdata_t *rdata, isc_netaddr_t *netaddr)
static int query_sortlist_order_2element (const dns_rdata_t *rdata, const void *arg)
static int query_sortlist_order_1element (const dns_rdata_t *rdata, const void *arg)
static void setup_query_sortlist (ns_client_t *client)
static void query_addnoqnameproof (ns_client_t *client, dns_rdataset_t *rdataset)
static void answer_in_glue (ns_client_t *client, dns_rdatatype_t qtype)
static void warn_rfc1918 (ns_client_t *client, dns_name_t *fname, dns_rdataset_t *rdataset)
static isc_uint32_t dns64_ttl (dns_db_t *db, dns_dbversion_t *version)
static isc_boolean_t dns64_aaaaok (ns_client_t *client, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
static isc_result_t redirect (ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset, dns_dbnode_t **nodep, dns_db_t **dbp, dns_dbversion_t **versionp, dns_rdatatype_t qtype)
static isc_result_t redirect2 (ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset, dns_dbnode_t **nodep, dns_db_t **dbp, dns_dbversion_t **versionp, dns_rdatatype_t qtype)
static void log_query (ns_client_t *client, unsigned int flags, unsigned int extflags)
void ns_query_start (ns_client_t *client)

Variables

static unsigned char inaddr10_offsets [] = { 0, 3, 11, 16 }
static unsigned char inaddr172_offsets [] = { 0, 3, 7, 15, 20 }
static unsigned char inaddr192_offsets [] = { 0, 4, 8, 16, 21 }
static unsigned char inaddr10 [] = "\00210\007IN-ADDR\004ARPA"
static unsigned char inaddr16172 [] = "\00216\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr17172 [] = "\00217\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr18172 [] = "\00218\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr19172 [] = "\00219\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr20172 [] = "\00220\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr21172 [] = "\00221\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr22172 [] = "\00222\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr23172 [] = "\00223\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr24172 [] = "\00224\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr25172 [] = "\00225\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr26172 [] = "\00226\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr27172 [] = "\00227\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr28172 [] = "\00228\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr29172 [] = "\00229\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr30172 [] = "\00230\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr31172 [] = "\00231\003172\007IN-ADDR\004ARPA"
static unsigned char inaddr168192 [] = "\003168\003192\007IN-ADDR\004ARPA"
static dns_name_t rfc1918names []
static unsigned char prisoner_data [] = "\010prisoner\004iana\003org"
static unsigned char hostmaster_data [] = "\012hostmaster\014root-servers\003org"
static unsigned char prisoner_offsets [] = { 0, 9, 14, 18 }
static unsigned char hostmaster_offsets [] = { 0, 11, 24, 28 }
static dns_name_t prisoner = NS_NAME_INIT(prisoner_data, prisoner_offsets)
static dns_name_t hostmaster = NS_NAME_INIT(hostmaster_data, hostmaster_offsets)


Detailed Description

Definition in file query.c.


Define Documentation

#define PARTIALANSWER (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_PARTIALANSWER) != 0)
Partial answer?

Definition at line 77 of file query.c.

Referenced by query_find().

#define USECACHE (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_CACHEOK) != 0)
Use Cache?

Definition at line 80 of file query.c.

Referenced by query_addbestns(), query_find(), query_getcachedb(), and rpz_rrset_find().

#define RECURSIONOK (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_RECURSIONOK) != 0)
Recursion OK?

Definition at line 83 of file query.c.

Referenced by dns64_aaaaok(), query_dns64(), query_find(), query_validatezonedb(), rpz_get_zbits(), and rpz_rewrite().

#define RECURSING (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_RECURSING) != 0)
Recursing?

Definition at line 86 of file query.c.

Referenced by query_find(), and query_resume().

#define CACHEGLUEOK (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_CACHEGLUEOK) != 0)
Cache glue ok?

Definition at line 89 of file query.c.

#define WANTRECURSION (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_WANTRECURSION) != 0)
Want Recursion?

Definition at line 92 of file query.c.

Referenced by log_query(), and query_find().

#define WANTDNSSEC (  ) 

Value:

(((c)->attributes & \
                                  NS_CLIENTATTR_WANTDNSSEC) != 0)
Want DNSSEC?

Definition at line 95 of file query.c.

Referenced by ns_query_start(), query_addadditional(), query_addadditional2(), query_addbestns(), query_addns(), query_addsoa(), query_find(), query_recurse(), redirect(), redirect2(), and rpz_ck_dnssec().

#define WANTAD (  ) 

Value:

(((c)->attributes & \
                                  NS_CLIENTATTR_WANTAD) != 0)
Want WANTAD?

Definition at line 98 of file query.c.

Referenced by ns_query_start(), and query_addbestns().

#define HAVESIT (  )     (0)

Definition at line 104 of file query.c.

Referenced by query_find().

#define NOAUTHORITY (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_NOAUTHORITY) != 0)
No authority?

Definition at line 108 of file query.c.

Referenced by query_find().

#define NOADDITIONAL (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_NOADDITIONAL) != 0)
No additional?

Definition at line 111 of file query.c.

Referenced by query_addrdataset().

#define SECURE (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_SECURE) != 0)
Secure?

Definition at line 114 of file query.c.

Referenced by query_addbestns().

#define DNS64 (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_DNS64) != 0)
DNS64 A lookup?

Definition at line 117 of file query.c.

Referenced by query_find().

#define DNS64EXCLUDE (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_DNS64EXCLUDE) != 0)

Definition at line 120 of file query.c.

Referenced by query_find().

#define REDIRECT (  ) 

Value:

(((c)->query.attributes & \
                                  NS_QUERYATTR_REDIRECT) != 0)

Definition at line 123 of file query.c.

Referenced by query_find(), and redirect2().

#define NOQNAME ( r   ) 

Value:

(((r)->attributes & \
                                  DNS_RDATASETATTR_NOQNAME) != 0)
No QNAME Proof?

Definition at line 127 of file query.c.

Referenced by query_find().

#define CTRACE ( l,
 )     ((void)m)

Definition at line 152 of file query.c.

#define DNS_GETDB_NOEXACT   0x01U

Definition at line 156 of file query.c.

Referenced by query_find(), and query_getzonedb().

#define DNS_GETDB_NOLOG   0x02U

Definition at line 157 of file query.c.

Referenced by query_addadditional(), query_addadditional2(), query_find(), query_getcachedb(), and query_validatezonedb().

#define DNS_GETDB_PARTIAL   0x04U

Definition at line 158 of file query.c.

Referenced by query_find(), and query_getzonedb().

#define DNS_GETDB_IGNOREACL   0x08U

Definition at line 159 of file query.c.

Referenced by query_validatezonedb(), and rpz_getdb().

#define PENDINGOK (  )     (((x) & DNS_DBFIND_PENDINGOK) != 0)

Definition at line 161 of file query.c.

Referenced by query_addbestns().

#define SFCACHE_CDFLAG   0x1

Definition at line 163 of file query.c.

#define MAX_RESTARTS   16

Definition at line 5544 of file query.c.

#define QUERY_ERROR ( r   ) 

Value:

do { \
        eresult = r; \
        want_restart = ISC_FALSE; \
        line = __LINE__; \
} while (0)

Definition at line 5546 of file query.c.

Referenced by query_find().

#define RECURSE_ERROR ( r   ) 

Value:

do { \
        if ((r) == DNS_R_DUPLICATE || (r) == DNS_R_DROP) \
                QUERY_ERROR(r); \
        else \
                QUERY_ERROR(DNS_R_SERVFAIL); \
} while (0)

Definition at line 5553 of file query.c.

Referenced by query_find().

#define NS_NAME_INIT ( A,
 ) 

Value:

{ \
                DNS_NAME_MAGIC, \
                A, sizeof(A), sizeof(B), \
                DNS_NAMEATTR_READONLY | DNS_NAMEATTR_ABSOLUTE, \
                B, NULL, { (void *)-1, (void *)-1}, \
                {NULL, NULL} \
        }

Definition at line 5736 of file query.c.


Typedef Documentation

typedef struct client_additionalctx client_additionalctx_t


Function Documentation

static isc_result_t query_find ( ns_client_t client,
dns_fetchevent_t event,
dns_rdatatype_t  qtype 
) [static]

Definition at line 6333 of file query.c.

References dns_view::aaaa_acl, answer_in_glue(), dns_name::attributes, dns_rdataset::attributes, ns_client::attributes, ns_query::attributes, dns_view::auth_nxdomain, ns_query::authdb, ns_query::authdbset, ns_query::authoritative, dns_rpz_st_t::authoritative, ns_query::authzone, dns_view::cache, dns_view::cachedb, dns_view::checknames, cleanup(), dns_rpz_zone::cname, CTRACE, ns_query::db, dns_rpz_st_t::db, ns_query::dboptions, dns_view::dns64, DNS64, ns_query::dns64_aaaa, dns64_aaaaok(), ns_query::dns64_aaaaok, ns_query::dns64_sigaaaa, dns64_ttl(), ns_query::dns64_ttl, DNS64EXCLUDE, dns_aaaa_break_dnssec, dns_aaaa_filter, dns_aaaa_ok, dns_badcache_find(), dns_cache_updatestats(), dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_allrdatasets(), dns_db_attach(), dns_db_detach(), dns_db_detachnode(), dns_db_findext(), dns_db_findrdataset(), dns_db_issecure(), dns_db_origin(), dns_fixedname_init, dns_fixedname_name, DNS_GETDB_NOEXACT, DNS_GETDB_NOLOG, DNS_GETDB_PARTIAL, DNS_LOGCATEGORY_DNSSEC, DNS_LOGCATEGORY_RRL, DNS_LOGCATEGORY_SECURITY, dns_message_addname(), dns_message_gettempname(), dns_message_puttempname(), dns_message_puttemprdataset(), DNS_MESSAGEFLAG_AA, DNS_MESSAGEFLAG_AD, DNS_MESSAGEFLAG_CD, DNS_MESSAGEFLAG_TC, dns_name_clone(), dns_name_concatenate(), dns_name_copy(), dns_name_countlabels(), dns_name_dup(), dns_name_equal(), dns_name_format(), DNS_NAME_FORMATSIZE, dns_name_fullcompare(), dns_name_getlabelsequence(), dns_name_init(), dns_name_isabsolute(), dns_name_issubdomain(), dns_name_split(), DNS_NAMEATTR_WILDCARD, dns_namereln_subdomain, dns_ncache_current(), dns_nsstatscounter_authrej, dns_nsstatscounter_ratedropped, dns_nsstatscounter_rateslipped, dns_nsstatscounter_recurserej, dns_nsstatscounter_tcp, dns_nsstatscounter_udp, DNS_R_CNAME, DNS_R_CONTINUE, DNS_R_DELEGATION, DNS_R_DNAME, DNS_R_DROP, DNS_R_DUPLICATE, DNS_R_EMPTYNAME, DNS_R_EMPTYWILD, DNS_R_GLUE, DNS_R_NAMETOOLONG, DNS_R_NCACHENXDOMAIN, DNS_R_NCACHENXRRSET, DNS_R_NXDOMAIN, DNS_R_NXRRSET, DNS_R_REFUSED, DNS_R_SERVFAIL, DNS_R_ZONECUT, dns_rcode_noerror, dns_rcode_nxdomain, dns_rcode_yxdomain, dns_rdata_checkowner(), dns_rdata_freestruct(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), dns_rdataclass_format(), DNS_RDATACLASS_FORMATSIZE, dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_next(), DNS_RDATASETATTR_NEGATIVE, dns_rdatasetiter_current(), dns_rdatasetiter_destroy(), dns_rdatasetiter_first(), dns_rdatasetiter_next(), dns_rdatatype_atparent(), dns_rdatatype_format(), DNS_RDATATYPE_FORMATSIZE, dns_rdatatype_isdnssec(), dns_rootname, DNS_RPZ_DONE_QNAME, DNS_RPZ_POLICY_CNAME, DNS_RPZ_POLICY_DROP, DNS_RPZ_POLICY_ERROR, DNS_RPZ_POLICY_MISS, DNS_RPZ_POLICY_NODATA, DNS_RPZ_POLICY_NXDOMAIN, DNS_RPZ_POLICY_PASSTHRU, DNS_RPZ_POLICY_RECORD, DNS_RPZ_POLICY_TCP_ONLY, DNS_RPZ_POLICY_WILDCNAME, DNS_RPZ_RECURSING, DNS_RPZ_REWRITTEN, dns_rrl(), DNS_RRL_LOG_BUF_LEN, DNS_RRL_LOG_DROP, DNS_RRL_RESULT_DROP, DNS_RRL_RESULT_OK, DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, dns_zone_attach(), dns_zone_detach(), dns_zone_getexpiretime(), dns_zone_getraw(), dns_zone_gettype(), dns_zone_getzeronosoattl(), dns_zone_slave, dns_zone_staticstub, ns_client::expire, dns_view::failcache, fixed, fixfname(), fixrdataset(), dns_message::flags, ns_query::fname, dns_rpz_st_t::fname, ns_query::gluedb, HAVESIT, dns_view::hints, inc_stats(), INSIST, dns_rpz_st_t::is_zone, isc_event_free(), ISC_EVENT_PTR, ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_EMPTY, ISC_LOG_DEBUG, ISC_LOG_ERROR, ISC_LOG_WARNING, isc_log_wouldlog(), ISC_MIN, ISC_R_FAILURE, ISC_R_NOMORE, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_result_totext(), ISC_TF, isc_time_seconds(), ISC_TRUE, ISC_UINT32_MAX, ns_query::isreferral, dns_rrl::log_only, dns_rpz_st_t::m, MAX_RESTARTS, ns_client::mctx, ns_client::message, name, namebuf, dns_rpz_zones::no_rd_ok, NOAUTHORITY, ns_query::node, dns_rpz_st_t::node, NOQNAME, ns_client::now, ns_client_checkaclsilent(), ns_client_detach(), ns_client_log(), ns_client_qnamereplace(), ns_client_sourceip(), NS_CLIENTATTR_HAVEEXPIRE, NS_CLIENTATTR_NOSETFC, NS_CLIENTATTR_RA, NS_CLIENTATTR_TCP, NS_CLIENTATTR_WANTAD, NS_CLIENTATTR_WANTDNSSEC, NS_CLIENTATTR_WANTEXPIRE, NS_FAILCACHE_CD, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_QUERY, NS_QUERYATTR_CACHEGLUEOK, NS_QUERYATTR_DNS64, NS_QUERYATTR_DNS64EXCLUDE, NS_QUERYATTR_NOADDITIONAL, NS_QUERYATTR_PARTIALANSWER, NS_QUERYATTR_RECURSING, NS_QUERYATTR_RRL_CHECKED, dns_rpz_zones::num_zones, dns_rpz_zones::p, dns_rpz_st_t::p_name, PARTIALANSWER, ns_client::peeraddr, dns_rpz_st_t::policy, dns_rpz_st_t::q, ns_query::qname, ns_query::qtype, dns_rpz_st_t::qtype, ns_client::query, query_add_cname(), query_addbestns(), query_addds(), query_addnoqnameproof(), query_addns(), query_addnxrrsetnsec(), query_addrrset(), query_addsoa(), query_addwildcardproof(), query_dns64(), query_error, QUERY_ERROR, query_filter64(), query_findclosestnsec3(), query_getdb(), query_getnamebuf(), query_getzonedb(), query_keepname(), query_newname(), query_newrdataset(), query_next(), query_prefetch(), query_putrdataset(), query_recurse(), query_releasename(), query_send(), dns_rpz_st_t::r, dns_rpz_st_t::r_rdataset, dns_rpz_st_t::r_result, dns_rpz_st_t::r_type, dns_message::rcode, ns_query::rdataset, dns_rpz_st_t::rdataset, dns_message::rdclass, RECURSE_ERROR, RECURSING, RECURSIONOK, redirect(), ns_query::redirect, REDIRECT, redirect2(), ns_query::restarts, ns_query::result, dns_rpz_st_t::result, dns_rpz_st_t::rpz, rpz_add_cname(), rpz_ck_dnssec(), rpz_clean(), rpz_log_rewrite(), rpz_match_clear(), rpz_rewrite(), ns_query::rpz_st, rpz_st_clear(), dns_view::rpzs, dns_view::rrl, RUNTIME_CHECK, dns_message::sections, setup_query_sortlist(), ns_query::sigrdataset, dns_rpz_st_t::sigrdataset, dns_rpz_st_t::state, ns_client::tnow, dns_rdataset::trust, dns_rpz_st_t::ttl, dns_rdataset::ttl, ttl, dns_rpz_st_t::type, dns_rdataset::type, USECACHE, dns_view::v4_aaaa, dns_view::v6_aaaa, dns_rpz_st_t::version, version, ns_client::view, WANTDNSSEC, WANTRECURSION, warn_rfc1918(), ns_query::zone, dns_rpz_st_t::zone, and zone.

Referenced by ns_query_start(), and query_resume().

static isc_boolean_t validate ( ns_client_t client,
dns_db_t db,
dns_name_t name,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 3092 of file query.c.

References dns_name_issubdomain(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_next(), dns_resolver_algorithm_supported(), dst_key_free(), get_key(), ISC_FALSE, ISC_R_SUCCESS, ISC_TRUE, key, mark_secure(), dns_view::resolver, verify(), and ns_client::view.

static void query_findclosestnsec3 ( dns_name_t qname,
dns_db_t db,
dns_dbversion_t version,
ns_client_t client,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset,
dns_name_t fname,
isc_boolean_t  exact,
dns_name_t found 
) [static]

Definition at line 5841 of file query.c.

References ns_query::dboptions, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_findext(), dns_db_getnsec3parameters(), dns_db_origin(), DNS_DBFIND_FORCENSEC3, dns_fixedname_init, dns_fixedname_name, DNS_LOGCATEGORY_DNSSEC, dns_name_clone(), dns_name_copy(), dns_name_countlabels(), dns_name_getlabelsequence(), dns_name_init(), dns_name_issubdomain(), dns_nsec3_hashname(), DNS_NSEC3_UNKNOWNALG, DNS_R_NXDOMAIN, DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_isassociated(), fixed, hash, INSIST, ISC_LOG_DEBUG, ISC_LOG_WARNING, ISC_R_SUCCESS, ISC_TF, name, ns_client::now, ns_client_log(), ns_client_sourceip(), NS_LOGMODULE_QUERY, ns_client::query, and salt_length.

Referenced by query_addds(), query_addwildcardproof(), and query_find().

static void log_queryerror ( ns_client_t client,
isc_result_t  result,
int  line,
int  level 
) [inline, static]

Definition at line 8629 of file query.c.

References dns_name_format(), DNS_NAME_FORMATSIZE, dns_rdataclass_format(), DNS_RDATACLASS_FORMATSIZE, dns_rdatatype_format(), DNS_RDATATYPE_FORMATSIZE, ISC_LIST_HEAD, isc_log_wouldlog(), isc_result_totext(), namebuf, ns_client_log(), NS_LOGCATEGORY_QUERY_EERRORS, NS_LOGMODULE_QUERY, ns_query::origqname, ns_client::query, dns_rdataset::rdclass, and dns_rdataset::type.

Referenced by query_error().

static void rpz_st_clear ( ns_client_t client  )  [static]

Definition at line 4130 of file query.c.

References dns_rpz_st_t::db, DNS_RPZ_POLICY_MISS, DNS_RPZ_TYPE_BAD, dns_rpz_st_t::m, dns_rpz_st_t::node, dns_rpz_st_t::ns_rdataset, dns_rpz_st_t::policy, dns_rpz_st_t::q, ns_client::query, query_putrdataset(), dns_rpz_st_t::r, dns_rpz_st_t::r_rdataset, dns_rpz_st_t::rdataset, rpz_clean(), rpz_match_clear(), ns_query::rpz_st, dns_rpz_st_t::sigrdataset, dns_rpz_st_t::state, dns_rpz_st_t::type, and dns_rpz_st_t::zone.

Referenced by query_find(), and query_reset().

static void inc_stats ( ns_client_t client,
isc_statscounter_t  counter 
) [inline, static]

Increment query statistics counters.

Definition at line 194 of file query.c.

References ns_query::authzone, dns_nsstatscounter_authans, dns_rdatatypestats_increment(), dns_zone_getrcvquerystats(), dns_zone_getrequeststats(), ISC_LIST_HEAD, isc_stats_increment(), ns_query::qname, ns_client::query, dns_rdataset::type, and zone.

static void query_send ( ns_client_t client  )  [static]

Definition at line 230 of file query.c.

References answer, counter, DNS_MESSAGEFLAG_AA, dns_nsstatscounter_authans, dns_nsstatscounter_failure, dns_nsstatscounter_nonauthans, dns_nsstatscounter_nxdomain, dns_nsstatscounter_nxrrset, dns_nsstatscounter_referral, dns_nsstatscounter_success, dns_rcode_noerror, dns_rcode_nxdomain, DNS_SECTION_ANSWER, dns_message::flags, inc_stats(), ISC_LIST_EMPTY, ns_query::isreferral, ns_client::message, ns_client_send(), ns_client::query, dns_message::rcode, and dns_message::sections.

Referenced by ns_query_start(), and query_find().

static void query_error ( ns_client_t client,
isc_result_t  result,
int  line 
) [static]

Definition at line 257 of file query.c.

References dns_nsstatscounter_failure, dns_nsstatscounter_formerr, dns_nsstatscounter_servfail, DNS_R_FORMERR, DNS_R_SERVFAIL, inc_stats(), ISC_LOG_DEBUG, ISC_LOG_INFO, log_queryerror(), and ns_client_error().

static void query_next ( ns_client_t client,
isc_result_t  result 
) [static]

Definition at line 282 of file query.c.

References dns_nsstatscounter_dropped, dns_nsstatscounter_duplicate, dns_nsstatscounter_failure, DNS_R_DROP, DNS_R_DUPLICATE, inc_stats(), and ns_client_next().

Referenced by ns_query_start(), query_find(), and query_resume().

static void query_freefreeversions ( ns_client_t client,
isc_boolean_t  everything 
) [inline, static]

Definition at line 293 of file query.c.

References ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_UNLINK, isc_mem_put, ns_client::mctx, and ns_client::query.

Referenced by ns_query_init(), and query_reset().

void ns_query_cancel ( ns_client_t client  ) 

Definition at line 316 of file query.c.

References dns_resolver_cancelfetch(), ns_query::fetch, ns_query::fetchlock, LOCK, ns_client::query, and UNLOCK.

Referenced by ns_client_killoldestquery(), and query_reset().

static void query_putrdataset ( ns_client_t client,
dns_rdataset_t **  rdatasetp 
) [inline, static]

Definition at line 327 of file query.c.

References CTRACE, dns_message_puttemprdataset(), dns_rdataset_disassociate(), dns_rdataset_isassociated(), ISC_LOG_DEBUG, and ns_client::message.

Referenced by prefetch_done(), query_addadditional(), query_addadditional2(), query_addbestns(), query_addds(), query_addnoqnameproof(), query_addns(), query_addsoa(), query_addwildcardproof(), query_discardcache(), query_find(), query_prefetch(), query_recurse(), query_reset(), query_resume(), rpz_rewrite(), rpz_rewrite_ip_rrsets(), rpz_rrset_find(), and rpz_st_clear().

static void query_reset ( ns_client_t client,
isc_boolean_t  everything 
) [inline, static]

Reset the query state of a client to its default state.

Definition at line 340 of file query.c.

References ns_query::attributes, ns_query::authdb, ns_query::authdbset, ns_query::authzone, ns_query::db, ns_dbversion::db, ns_query::dboptions, ns_query::dns64_aaaa, ns_query::dns64_aaaaok, ns_query::dns64_aaaaoklen, ns_query::dns64_options, ns_query::dns64_sigaaaa, ns_query::dns64_ttl, dns_db_closeversion(), dns_db_detach(), dns_db_detachnode(), dns_message_puttempname(), dns_zone_detach(), ns_query::fetchoptions, ns_query::gluedb, isc_buffer_free(), ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_INIT, ISC_LIST_INITANDAPPEND, ISC_LIST_NEXT, ISC_LIST_UNLINK, isc_mem_put, ISC_UINT32_MAX, ns_query::isreferral, ns_client::mctx, ns_client::message, ns_query::namebufs, ns_query::node, ns_query_cancel(), NS_QUERYATTR_CACHEOK, NS_QUERYATTR_RECURSIONOK, NS_QUERYATTR_SECURE, ns_query::origqname, ns_query::qname, ns_client::query, query_freefreeversions(), query_putrdataset(), ns_query::rdataset, ns_query::redirect, ns_query::restarts, ns_query::rpz_st, rpz_st_clear(), ns_query::sigrdataset, ns_query::timerset, ns_dbversion::version, and ns_query::zone.

Referenced by ns_query_free(), ns_query_init(), and query_next_callback().

static void query_next_callback ( ns_client_t client  )  [static]

Definition at line 440 of file query.c.

References ISC_FALSE, and query_reset().

Referenced by ns_query_start().

void ns_query_free ( ns_client_t client  ) 

Definition at line 445 of file query.c.

References ISC_TRUE, and query_reset().

Referenced by client_create(), and exit_check().

static isc_result_t query_newnamebuf ( ns_client_t client  )  [inline, static]

Allocate a name buffer.

Definition at line 450 of file query.c.

References CTRACE, isc_buffer_allocate(), ISC_LIST_APPEND, ISC_LOG_DEBUG, ISC_R_SUCCESS, ns_client::mctx, ns_query::namebufs, and ns_client::query.

Referenced by ns_query_init(), and query_getnamebuf().

static isc_buffer_t* query_getnamebuf ( ns_client_t client  )  [inline, static]

Return a name buffer with space for a maximal name, allocating a new one if necessary.

Definition at line 473 of file query.c.

References CTRACE, INSIST, isc_buffer_availableregion, ISC_LIST_EMPTY, ISC_LIST_TAIL, ISC_LOG_DEBUG, ISC_R_SUCCESS, isc_region::length, ns_query::namebufs, ns_client::query, query_newnamebuf(), and r.

Referenced by fixfname(), query_addadditional(), query_addadditional2(), query_addbestns(), query_addds(), query_addnoqnameproof(), query_addnxrrsetnsec(), query_addwildcardproof(), and query_find().

static void query_keepname ( ns_client_t client,
dns_name_t name,
isc_buffer_t dbuf 
) [inline, static]

'name' is using space in 'dbuf', but 'dbuf' has not yet been adjusted to take account of that. We do the adjustment.

Definition at line 513 of file query.c.

References ns_query::attributes, CTRACE, dns_name_setbuffer(), dns_name_toregion(), isc_buffer_add, ISC_LOG_DEBUG, isc_region::length, NS_QUERYATTR_NAMEBUFUSED, ns_client::query, r, and REQUIRE.

Referenced by query_addadditional(), query_addadditional2(), query_addbestns(), query_addrrset(), query_dns64(), query_filter64(), query_find(), and rpz_add_cname().

static void query_releasename ( ns_client_t client,
dns_name_t **  namep 
) [inline, static]

'name' is no longer needed. Return it to our pool of temporary names. If it is using a name buffer, relinquish its exclusive rights on the buffer.

Definition at line 531 of file query.c.

References ns_query::attributes, CTRACE, dns_message_puttempname(), dns_name_hasbuffer(), INSIST, ISC_LOG_DEBUG, ns_client::message, name, NS_QUERYATTR_NAMEBUFUSED, and ns_client::query.

Referenced by query_addadditional(), query_addadditional2(), query_addbestns(), query_addds(), query_addnoqnameproof(), query_addns(), query_addrrset(), query_addsoa(), query_addwildcardproof(), query_dns64(), query_filter64(), and query_find().

static dns_name_t* query_newname ( ns_client_t client,
isc_buffer_t dbuf,
isc_buffer_t nbuf 
) [inline, static]

Definition at line 551 of file query.c.

References ns_query::attributes, isc_region::base, CTRACE, dns_message_gettempname(), dns_name_init(), dns_name_setbuffer(), isc_buffer_availableregion, isc_buffer_init, ISC_LOG_DEBUG, ISC_R_SUCCESS, isc_region::length, ns_client::message, name, NS_QUERYATTR_NAMEBUFUSED, ns_client::query, r, and REQUIRE.

Referenced by fixfname(), query_addadditional(), query_addadditional2(), query_addbestns(), query_addds(), query_addnoqnameproof(), query_addnxrrsetnsec(), query_addwildcardproof(), and query_find().

static dns_rdataset_t* query_newrdataset ( ns_client_t client  )  [inline, static]

Definition at line 579 of file query.c.

References CTRACE, dns_message_gettemprdataset(), dns_rdataset_init(), ISC_LOG_DEBUG, ISC_R_SUCCESS, and ns_client::message.

Referenced by fixrdataset(), query_addadditional(), query_addadditional2(), query_addbestns(), query_addds(), query_addnoqnameproof(), query_addns(), query_addsoa(), query_addwildcardproof(), query_find(), query_prefetch(), query_recurse(), and rpz_ready().

static isc_result_t query_newdbversion ( ns_client_t client,
unsigned int  n 
) [inline, static]

Definition at line 599 of file query.c.

References ns_dbversion::db, ISC_LIST_INITANDAPPEND, isc_mem_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, ns_client::mctx, ns_client::query, and ns_dbversion::version.

Referenced by ns_query_init(), and query_getdbversion().

static ns_dbversion_t* query_getdbversion ( ns_client_t client  )  [inline, static]

Definition at line 626 of file query.c.

References INSIST, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, ISC_R_SUCCESS, ns_client::query, and query_newdbversion().

Referenced by query_findversion().

isc_result_t ns_query_init ( ns_client_t client  ) 

Definition at line 643 of file query.c.

References ns_query::authdb, ns_query::authdbset, ns_query::authzone, ns_query::db, DESTROYLOCK, ns_query::dns64_aaaa, ns_query::dns64_aaaaok, ns_query::dns64_aaaaoklen, ns_query::dns64_sigaaaa, dns_fixedname_init, dns_fixedname_name, ns_query::fetch, ns_query::fetchlock, ns_query::fixed, ns_query::fname, ISC_FALSE, ISC_LIST_INIT, isc_mutex_init, ISC_R_SUCCESS, ISC_TRUE, ns_query::isreferral, ns_query::namebufs, ns_query::node, ns_query::prefetch, ns_query::qname, ns_query::qtype, ns_client::query, query_freefreeversions(), query_newdbversion(), query_newnamebuf(), query_reset(), ns_query::rdataset, ns_query::redirect, ns_query::restarts, ns_query::result, ns_query::rpz_st, ns_query::sigrdataset, ns_query::timerset, and ns_query::zone.

Referenced by client_create().

static ns_dbversion_t* query_findversion ( ns_client_t client,
dns_db_t db 
) [inline, static]

We may already have done a query related to this database. If so, we must be sure to make subsequent queries from the same version.

Definition at line 696 of file query.c.

References ns_dbversion::acl_checked, ns_dbversion::db, dns_db_attach(), dns_db_currentversion(), ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_NEXT, ns_client::query, query_getdbversion(), ns_dbversion::queryok, and ns_dbversion::version.

Referenced by query_validatezonedb(), and redirect().

static isc_result_t query_validatezonedb ( ns_client_t client,
dns_name_t name,
dns_rdatatype_t  qtype,
unsigned int  options,
dns_zone_t zone,
dns_db_t db,
dns_dbversion_t **  versionp 
) [inline, static]

Definition at line 732 of file query.c.

References ns_dbversion::acl_checked, dns_view::additionalfromauth, ns_query::attributes, ns_query::authdb, ns_query::authdbset, CTRACE, ns_client::destaddr, DNS_GETDB_IGNOREACL, DNS_GETDB_NOLOG, DNS_LOGCATEGORY_SECURITY, DNS_R_REFUSED, DNS_R_SERVFAIL, dns_zone_getqueryacl(), dns_zone_getqueryonacl(), dns_zone_gettype(), dns_zone_staticstub, ISC_FALSE, ISC_LOG_DEBUG, ISC_LOG_ERROR, ISC_LOG_INFO, isc_log_wouldlog(), ISC_R_SUCCESS, ISC_TRUE, ns_client_aclmsg(), NS_CLIENT_ACLMSGSIZE, ns_client_checkaclsilent(), ns_client_log(), NS_LOGMODULE_QUERY, NS_QUERYATTR_QUERYOK, NS_QUERYATTR_QUERYOKVALID, ns_client::query, query_findversion(), dns_view::queryacl, ns_dbversion::queryok, dns_view::queryonacl, dns_view::rdclass, RECURSIONOK, REQUIRE, ns_dbversion::version, and ns_client::view.

Referenced by query_addadditional2(), and query_getzonedb().

static isc_result_t query_getzonedb ( ns_client_t client,
dns_name_t name,
dns_rdatatype_t  qtype,
unsigned int  options,
dns_zone_t **  zonep,
dns_db_t **  dbp,
dns_dbversion_t **  versionp 
) [inline, static]

Find a zone database to answer the query.

Definition at line 882 of file query.c.

References dns_db_detach(), DNS_GETDB_NOEXACT, DNS_GETDB_PARTIAL, DNS_R_PARTIALMATCH, dns_zone_detach(), dns_zone_getdb(), dns_zt_find(), DNS_ZTFIND_NOEXACT, ISC_FALSE, ISC_R_SUCCESS, ISC_TRUE, query_validatezonedb(), REQUIRE, ns_client::view, zone, and dns_view::zonetable.

Referenced by query_addadditional(), query_addadditional2(), query_find(), query_getdb(), and rpz_getdb().

static void rpz_log_rewrite ( ns_client_t client,
isc_boolean_t  disabled,
dns_rpz_policy_t  policy,
dns_rpz_type_t  type,
dns_zone_t p_zone,
dns_name_t p_name,
dns_name_t cname 
) [static]

Definition at line 936 of file query.c.

References DNS_LOGCATEGORY_RPZ, dns_name_format(), DNS_NAME_FORMATSIZE, dns_nsstatscounter_rpz_rewrites, DNS_RPZ_INFO_LEVEL, dns_rpz_policy2str(), DNS_RPZ_POLICY_PASSTHRU, dns_rpz_type2str(), dns_zone_getrequeststats(), isc_log_wouldlog(), isc_stats_increment(), ns_client_log(), NS_LOGMODULE_QUERY, ns_query::qname, and ns_client::query.

Referenced by query_find(), rpz_add_cname(), rpz_rewrite(), rpz_rewrite_ip(), and rpz_rewrite_name().

static void rpz_log_fail ( ns_client_t client,
int  level,
dns_name_t p_name,
dns_rpz_type_t  rpz_type,
const char *  str,
isc_result_t  result 
) [static]

Definition at line 981 of file query.c.

References dns_name_format(), DNS_NAME_FORMATSIZE, DNS_RPZ_DEBUG_LEVEL1, dns_rpz_type2str(), failed, isc_log_wouldlog(), isc_result_totext(), ns_client_log(), NS_LOGCATEGORY_QUERY_EERRORS, NS_LOGMODULE_QUERY, ns_query::qname, and ns_client::query.

Referenced by rpz_find_p(), rpz_get_p_name(), rpz_getdb(), rpz_rewrite(), rpz_rewrite_ip_rrset(), rpz_rewrite_ns_skip(), and rpz_rrset_find().

static isc_result_t rpz_getdb ( ns_client_t client,
dns_name_t p_name,
dns_rpz_type_t  rpz_type,
dns_zone_t **  zonep,
dns_db_t **  dbp,
dns_dbversion_t **  versionp 
) [static]

Definition at line 1012 of file query.c.

References DNS_GETDB_IGNOREACL, DNS_LOGCATEGORY_RPZ, dns_name_format(), DNS_NAME_FORMATSIZE, DNS_RPZ_DEBUG_LEVEL2, DNS_RPZ_ERROR_LEVEL, dns_rpz_type2str(), isc_log_wouldlog(), ISC_R_SUCCESS, ns_client_log(), NS_LOGMODULE_QUERY, ns_query::qname, ns_client::query, query_getzonedb(), and rpz_log_fail().

Referenced by rpz_find_p().

static isc_result_t query_getcachedb ( ns_client_t client,
dns_name_t name,
dns_rdatatype_t  qtype,
dns_db_t **  dbp,
unsigned int  options 
) [inline, static]

Find a cache database to answer the query. This may fail with DNS_R_REFUSED if the client is not allowed to use the cache.

Definition at line 1042 of file query.c.

References ns_query::attributes, dns_view::cacheacl, dns_view::cachedb, dns_db_attach(), dns_db_detach(), DNS_GETDB_NOLOG, DNS_LOGCATEGORY_SECURITY, DNS_R_REFUSED, ISC_FALSE, ISC_LOG_DEBUG, ISC_LOG_INFO, isc_log_wouldlog(), ISC_R_SUCCESS, ISC_TF, ISC_TRUE, ns_client_aclmsg(), NS_CLIENT_ACLMSGSIZE, ns_client_checkaclsilent(), ns_client_log(), NS_LOGMODULE_QUERY, NS_QUERYATTR_CACHEACLOK, NS_QUERYATTR_CACHEACLOKVALID, ns_client::query, dns_view::rdclass, REQUIRE, USECACHE, and ns_client::view.

Referenced by query_addadditional(), query_addadditional2(), and query_getdb().

static isc_result_t query_getdb ( ns_client_t client,
dns_name_t name,
dns_rdatatype_t  qtype,
unsigned int  options,
dns_zone_t **  zonep,
dns_db_t **  dbp,
dns_dbversion_t **  versionp,
isc_boolean_t is_zonep 
) [inline, static]

Definition at line 1140 of file query.c.

References dns_view::dlz_searched, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_currentversion(), dns_db_detach(), dns_name_countlabels(), dns_view_searchdlz(), dns_zone_detach(), dns_zone_getorigin(), ISC_FALSE, ISC_LIST_EMPTY, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, ns_client_sourceip(), query_getcachedb(), query_getzonedb(), REQUIRE, ns_client::view, and zone.

Referenced by query_addbestns(), query_find(), redirect2(), and rpz_rrset_find().

static isc_boolean_t query_isduplicate ( ns_client_t client,
dns_name_t name,
dns_rdatatype_t  type,
dns_name_t **  mnamep 
) [inline, static]

Definition at line 1236 of file query.c.

References CTRACE, dns_message_findname(), DNS_R_NXDOMAIN, DNS_R_NXRRSET, DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, ISC_FALSE, ISC_LOG_DEBUG, ISC_R_SUCCESS, ISC_TRUE, ns_client::message, and RUNTIME_CHECK.

Referenced by query_addadditional(), and query_addadditional2().

static isc_result_t query_addadditional ( void *  arg,
dns_name_t name,
dns_rdatatype_t  qtype 
) [static]

Definition at line 1276 of file query.c.

References dns_view::cache, cleanup(), CTRACE, ns_query::dboptions, dns_aaaa_break_dnssec, dns_aaaa_filter, dns_cache_updatestats(), dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_attach(), dns_db_detach(), dns_db_detachnode(), dns_db_findext(), dns_db_findrdataset(), dns_db_issecure(), dns_db_origin(), DNS_DBFIND_ADDITIONALOK, DNS_DBFIND_GLUEOK, DNS_GETDB_NOLOG, dns_message_addname(), dns_name_issubdomain(), DNS_R_GLUE, DNS_R_NCACHENXDOMAIN, DNS_R_NCACHENXRRSET, DNS_R_ZONECUT, dns_rdataset_additionaldata(), dns_rdataset_disassociate(), dns_rdataset_isassociated(), dns_rdatatype_isdnssec(), DNS_SECTION_ADDITIONAL, dns_zone_detach(), ns_query::gluedb, INSIST, ISC_FALSE, ISC_LIST_APPEND, ISC_LOG_DEBUG, ISC_R_SUCCESS, ISC_TRUE, ns_client::message, ns_client::now, ns_client_sourceip(), NS_CLIENT_VALID, ns_client::query, query_getcachedb(), query_getnamebuf(), query_getzonedb(), query_isduplicate(), query_keepname(), query_newname(), query_newrdataset(), query_putrdataset(), query_releasename(), REQUIRE, validate(), version, ns_client::view, WANTDNSSEC, and zone.

Referenced by query_addadditional2().

static void query_discardcache ( ns_client_t client,
dns_rdataset_t rdataset_base,
dns_rdatasetadditional_t  additionaltype,
dns_rdatatype_t  type,
dns_zone_t **  zonep,
dns_db_t **  dbp,
dns_dbversion_t **  versionp,
dns_dbnode_t **  nodep,
dns_name_t fname 
) [inline, static]

Definition at line 1684 of file query.c.

References dns_view::acache, dns_db_closeversion(), dns_db_detach(), dns_db_detachnode(), dns_rdataset_putadditional(), dns_zone_detach(), ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_UNLINK, query_putrdataset(), and ns_client::view.

Referenced by query_addadditional2().

static isc_result_t query_iscachevalid ( dns_zone_t zone,
dns_db_t db,
dns_db_t db0,
dns_dbversion_t version 
) [inline, static]

Definition at line 1709 of file query.c.

References cleanup(), dns_db_closeversion(), dns_db_currentversion(), dns_db_detach(), dns_zone_getdb(), ISC_FALSE, ISC_R_FAILURE, and ISC_R_SUCCESS.

Referenced by query_addadditional2().

static isc_result_t query_addadditional2 ( void *  arg,
dns_name_t name,
dns_rdatatype_t  qtype 
) [static]

Definition at line 1736 of file query.c.

References dns_view::acache, cleanup(), client_additionalctx::client, CTRACE, ns_query::dboptions, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_attach(), dns_db_closeversion(), dns_db_detach(), dns_db_detachnode(), dns_db_findext(), dns_db_findrdataset(), dns_db_origin(), DNS_DBFIND_ADDITIONALOK, DNS_DBFIND_GLUEOK, DNS_GETDB_NOLOG, dns_message_addname(), dns_name_clone(), dns_name_init(), dns_name_issubdomain(), dns_name_setbuffer(), DNS_R_GLUE, DNS_R_NCACHENXDOMAIN, DNS_R_NCACHENXRRSET, DNS_R_ZONECUT, dns_rdataset_disassociate(), dns_rdataset_getadditional(), dns_rdataset_isassociated(), dns_rdataset_setadditional(), dns_rdatasetadditional_fromauth, dns_rdatasetadditional_fromcache, dns_rdatasetadditional_fromglue, DNS_SECTION_ADDITIONAL, DNS_TRUST_GLUE, DNS_TRUST_PENDING, dns_zone_detach(), ns_query::gluedb, INSIST, ISC_FALSE, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_UNLINK, ISC_LOG_DEBUG, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, ns_client::message, ns_client::now, ns_client_sourceip(), NS_CLIENT_VALID, POST, ns_client::query, query_addadditional(), query_discardcache(), query_getcachedb(), query_getnamebuf(), query_getzonedb(), query_iscachevalid(), query_isduplicate(), query_keepname(), query_newname(), query_newrdataset(), query_putrdataset(), query_releasename(), query_validatezonedb(), client_additionalctx::rdataset, REQUIRE, dns_rdataset::trust, dns_rdataset::type, validate(), version, ns_client::view, WANTDNSSEC, and zone.

Referenced by query_addrdataset().

static void query_addrdataset ( ns_client_t client,
dns_name_t fname,
dns_rdataset_t rdataset 
) [inline, static]

Definition at line 2223 of file query.c.

References dns_rdataset::attributes, client_additionalctx::client, CTRACE, dns_order_find(), dns_rdataset_additionaldata(), DNS_RDATASETATTR_LOADORDER, ISC_LIST_APPEND, ISC_LOG_DEBUG, NOADDITIONAL, dns_view::order, query_addadditional2(), client_additionalctx::rdataset, dns_rdataset::rdclass, dns_rdataset::type, and ns_client::view.

Referenced by query_addrrset(), query_dns64(), and query_filter64().

static isc_result_t query_dns64 ( ns_client_t client,
dns_name_t **  namep,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset,
isc_buffer_t dbuf,
dns_section_t  section 
) [static]

To the current response for 'client', add the answer RRset '*rdatasetp' and an optional signature set '*sigrdatasetp', with owner name '*namep', to section 'section', unless they are already there. Also add any pertinent additional data.

If 'dbuf' is not NULL, then '*namep' is the name whose data is stored in 'dbuf'. In this case, query_addrrset() guarantees that when it returns the name will either have been kept or released.

Definition at line 2259 of file query.c.

References ns_query::attributes, isc_region::base, buffer, cleanup(), dns_rdataset::covers, CTRACE, dns_rdata::data, dns_view::dns64, dns64_rdata(), ns_query::dns64_ttl, dns_view::dns64cnt, dns_dns64_aaaafroma(), DNS_DNS64_DNSSEC, dns_dns64_next(), DNS_DNS64_RECURSIVE, dns_message_addname(), dns_message_findname(), dns_message_gettemprdata(), dns_message_gettemprdatalist(), dns_message_gettemprdataset(), dns_message_puttemprdata(), dns_message_puttemprdatalist(), dns_message_puttemprdataset(), dns_message_takebuffer(), dns_nsstatscounter_dns64, DNS_R_NXDOMAIN, DNS_R_NXRRSET, dns_rdata_fromregion(), dns_rdata_init(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdatalist_init(), dns_rdatalist_tordataset(), dns_rdataset_count(), dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_next(), dns_rdataset_setownercase(), DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, dns_trust_secure, inc_stats(), INSIST, isc_buffer_add, isc_buffer_allocate(), isc_buffer_availableregion, isc_buffer_forward, isc_buffer_free(), isc_buffer_remainingregion, ISC_LIST_APPEND, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_UNLINK, ISC_LOG_DEBUG, ISC_MIN, isc_netaddr_fromsockaddr(), ISC_R_NOMORE, ISC_R_SUCCESS, ISC_UINT32_MAX, isc_region::length, ns_client::mctx, ns_client::message, name, NS_QUERYATTR_NOADDITIONAL, NS_QUERYATTR_SECURE, ns_client::peeraddr, ns_client::query, query_addrdataset(), query_keepname(), query_releasename(), r, dns_rdatalist::rdclass, RECURSIONOK, RUNTIME_CHECK, ns_client::signer, dns_rdataset::trust, dns_rdataset::ttl, dns_rdatalist::ttl, dns_rdatalist::type, and ns_client::view.

Referenced by query_find().

static void query_filter64 ( ns_client_t client,
dns_name_t **  namep,
dns_rdataset_t rdataset,
isc_buffer_t dbuf,
dns_section_t  section 
) [static]

Definition at line 2442 of file query.c.

References ns_query::attributes, buffer, cleanup(), dns_rdataset::covers, CTRACE, dns_rdata::data, ns_query::dns64_aaaaok, ns_query::dns64_aaaaoklen, dns_message_addname(), dns_message_findname(), dns_message_gettemprdata(), dns_message_gettemprdatalist(), dns_message_gettemprdataset(), dns_message_puttemprdata(), dns_message_puttemprdatalist(), dns_message_puttemprdataset(), dns_message_takebuffer(), DNS_R_NXDOMAIN, DNS_R_NXRRSET, dns_rdata_fromregion(), dns_rdata_init(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdatalist_init(), dns_rdatalist_tordataset(), dns_rdataset_count(), dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_next(), dns_rdataset_setownercase(), DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, dns_trust_secure, INSIST, isc_buffer_allocate(), isc_buffer_forward, isc_buffer_free(), isc_buffer_putmem, isc_buffer_remainingregion, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_UNLINK, ISC_LOG_DEBUG, ISC_R_NOMORE, ISC_R_SUCCESS, dns_rdata::length, ns_client::mctx, ns_client::message, name, NS_QUERYATTR_NOADDITIONAL, NS_QUERYATTR_SECURE, ns_client::query, query_addrdataset(), query_keepname(), query_releasename(), r, dns_rdatalist::rdclass, RUNTIME_CHECK, dns_rdataset::trust, dns_rdataset::ttl, dns_rdatalist::ttl, and dns_rdatalist::type.

Referenced by query_find().

static void query_addrrset ( ns_client_t client,
dns_name_t **  namep,
dns_rdataset_t **  rdatasetp,
dns_rdataset_t **  sigrdatasetp,
isc_buffer_t dbuf,
dns_section_t  section 
) [static]

To the current response for 'client', add the answer RRset '*rdatasetp' and an optional signature set '*sigrdatasetp', with owner name '*namep', to section 'section', unless they are already there. Also add any pertinent additional data.

If 'dbuf' is not NULL, then '*namep' is the name whose data is stored in 'dbuf'. In this case, query_addrrset() guarantees that when it returns the name will either have been kept or released.

Definition at line 2581 of file query.c.

References ns_query::attributes, dns_rdataset::attributes, dns_rdataset::covers, CTRACE, dns_message_addname(), dns_message_findname(), DNS_R_NXDOMAIN, DNS_R_NXRRSET, dns_rdataset_isassociated(), DNS_RDATASETATTR_REQUIRED, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, dns_trust_secure, ISC_LIST_APPEND, ISC_LOG_DEBUG, ISC_R_SUCCESS, ns_client::message, name, NS_QUERYATTR_SECURE, ns_client::query, query_addrdataset(), query_keepname(), query_releasename(), RUNTIME_CHECK, dns_rdataset::trust, and dns_rdataset::type.

Referenced by query_add_cname(), query_addbestns(), query_addds(), query_addnoqnameproof(), query_addns(), query_addnxrrsetnsec(), query_addsoa(), query_addwildcardproof(), and query_find().

static isc_result_t query_addsoa ( ns_client_t client,
dns_db_t db,
dns_dbversion_t version,
unsigned int  override_ttl,
isc_boolean_t  isassociated,
dns_section_t  section 
) [inline, static]

Definition at line 2659 of file query.c.

References dns_rdataset::attributes, cleanup(), CTRACE, ns_query::dboptions, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_detachnode(), dns_db_findext(), dns_db_findrdataset(), dns_db_getoriginnode(), dns_db_issecure(), dns_db_origin(), dns_fixedname_init, dns_fixedname_name, dns_message_gettempname(), dns_name_clone(), dns_name_init(), DNS_R_SERVFAIL, DNS_RDATA_INIT, dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_first(), DNS_RDATASETATTR_REQUIRED, DNS_SECTION_ADDITIONAL, ISC_LOG_DEBUG, ISC_LOG_ERROR, ISC_R_SUCCESS, ISC_UINT32_MAX, ns_client::message, name, ns_client::now, ns_client_sourceip(), ns_client::query, query_addrrset(), query_newrdataset(), query_putrdataset(), query_releasename(), RUNTIME_CHECK, dns_rdataset::ttl, ttl, and WANTDNSSEC.

Referenced by query_find().

static isc_result_t query_addns ( ns_client_t client,
dns_db_t db,
dns_dbversion_t version 
) [inline, static]

Definition at line 2791 of file query.c.

References cleanup(), CTRACE, ns_query::dboptions, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_detachnode(), dns_db_findext(), dns_db_findrdataset(), dns_db_getoriginnode(), dns_db_issecure(), dns_db_origin(), dns_fixedname_init, dns_fixedname_name, dns_message_gettempname(), dns_name_clone(), dns_name_init(), DNS_R_SERVFAIL, DNS_SECTION_AUTHORITY, ISC_LOG_DEBUG, ISC_LOG_ERROR, ISC_R_SUCCESS, ns_client::message, name, ns_client::now, ns_client_sourceip(), ns_client::query, query_addrrset(), query_newrdataset(), query_putrdataset(), query_releasename(), and WANTDNSSEC.

Referenced by query_find().

static isc_result_t query_add_cname ( ns_client_t client,
dns_name_t qname,
dns_name_t tname,
dns_trust_t  trust,
dns_ttl_t  ttl 
) [static]

Definition at line 2890 of file query.c.

References isc_region::base, dns_rdata::data, dns_message_gettempname(), dns_message_gettemprdata(), dns_message_gettemprdatalist(), dns_message_gettemprdataset(), dns_message_puttempname(), dns_message_puttemprdata(), dns_message_puttemprdatalist(), dns_message_puttemprdataset(), dns_name_dup(), dns_name_toregion(), dns_rdatalist_tordataset(), dns_rdataset_disassociate(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_setownercase(), DNS_SECTION_ANSWER, ISC_LIST_APPEND, ISC_R_SUCCESS, isc_region::length, dns_rdata::length, ns_client::mctx, ns_client::message, query_addrrset(), r, dns_rdata::rdclass, dns_message::rdclass, dns_rdatalist::rdclass, RUNTIME_CHECK, dns_rdataset::trust, dns_rdatalist::ttl, dns_rdata::type, and dns_rdatalist::type.

Referenced by query_find(), and rpz_add_cname().

static void mark_secure ( ns_client_t client,
dns_db_t db,
dns_name_t name,
dns_rdata_rrsig_t *  rrsig,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 2970 of file query.c.

References dns_view::acceptexpired, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_addrdataset(), dns_db_detachnode(), dns_db_findnodeext(), dns_rdataset_trimttl(), dns_trust_secure, ISC_R_SUCCESS, isc_stdtime_get(), ISC_TRUE, ns_client::now, now, ns_client_sourceip(), dns_rdataset::trust, and ns_client::view.

Referenced by validate().

static isc_boolean_t get_key ( ns_client_t client,
dns_db_t db,
dns_rdata_rrsig_t *  rrsig,
dns_rdataset_t keyrdataset,
dst_key_t **  keyp 
) [static]

Definition at line 3010 of file query.c.

References dns_rdata::data, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_detachnode(), dns_db_findnodeext(), dns_db_findrdataset(), DNS_RDATA_INIT, dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_isassociated(), dns_rdataset_next(), dns_trust_secure, dst_key_alg(), dst_key_free(), dst_key_fromdns(), dst_key_id(), dst_key_iszonekey(), isc_buffer_add, isc_buffer_init, ISC_FALSE, ISC_R_SUCCESS, ISC_TRUE, dns_rdata::length, ns_client::mctx, ns_client::now, ns_client_sourceip(), dns_rdata::rdclass, secure(), and dns_rdataset::trust.

static isc_boolean_t verify ( dst_key_t key,
dns_name_t name,
dns_rdataset_t rdataset,
dns_rdata_t rdata,
ns_client_t client 
) [static]

Definition at line 3066 of file query.c.

References dns_view::acceptexpired, dns_dnssec_verify3(), dns_fixedname_init, DNS_R_FROMWILDCARD, DNS_R_SIGEXPIRED, fixed, ignore(), ISC_FALSE, ISC_R_SUCCESS, ISC_TRUE, dns_view::maxbits, ns_client::mctx, and ns_client::view.

static void query_addbestns ( ns_client_t client  )  [static]

Definition at line 3138 of file query.c.

References dns_view::cachedb, cleanup(), CTRACE, ns_query::dboptions, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_attach(), dns_db_detach(), dns_db_detachnode(), dns_db_findext(), dns_db_findzonecut(), dns_name_issubdomain(), DNS_R_DELEGATION, DNS_SECTION_AUTHORITY, DNS_TRUST_GLUE, DNS_TRUST_PENDING, dns_trust_secure, dns_zone_detach(), ISC_FALSE, ISC_LOG_DEBUG, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, ns_client::now, ns_client_sourceip(), PENDINGOK, ns_query::qname, ns_client::query, query_addrrset(), query_getdb(), query_getnamebuf(), query_keepname(), query_newname(), query_newrdataset(), query_putrdataset(), query_releasename(), SECURE, dns_rdataset::trust, USECACHE, validate(), version, ns_client::view, WANTAD, WANTDNSSEC, and zone.

Referenced by query_find().

static void fixrdataset ( ns_client_t client,
dns_rdataset_t **  rdataset 
) [static]

Definition at line 3326 of file query.c.

References dns_rdataset_disassociate(), dns_rdataset_isassociated(), and query_newrdataset().

Referenced by query_addds(), and query_find().

static void fixfname ( ns_client_t client,
dns_name_t **  fname,
isc_buffer_t **  dbuf,
isc_buffer_t nbuf 
) [static]

Definition at line 3334 of file query.c.

References query_getnamebuf(), and query_newname().

Referenced by query_addds(), and query_find().

static void query_addds ( ns_client_t client,
dns_db_t db,
dns_dbnode_t node,
dns_dbversion_t version,
dns_name_t name 
) [static]

Definition at line 3346 of file query.c.

References addnsec3(), cleanup(), CTRACE, dns_db_findrdataset(), dns_db_iszone(), dns_fixedname_init, dns_fixedname_name, dns_message_currentname(), dns_message_findtype(), dns_message_firstname(), dns_name_countlabels(), dns_name_equal(), dns_name_getlabelsequence(), dns_rdataset_disassociate(), dns_rdataset_isassociated(), DNS_SECTION_AUTHORITY, fixed, fixfname(), fixrdataset(), ISC_FALSE, ISC_LIST_APPEND, ISC_LOG_DEBUG, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, ns_client::message, ns_client::now, query_addrrset(), query_findclosestnsec3(), query_getnamebuf(), query_newname(), query_newrdataset(), query_putrdataset(), and query_releasename().

Referenced by query_find().

static void query_addwildcardproof ( ns_client_t client,
dns_db_t db,
dns_dbversion_t version,
dns_name_t name,
isc_boolean_t  ispositive,
isc_boolean_t  nodata 
) [static]

Definition at line 3465 of file query.c.

References cleanup(), CTRACE, ns_query::dboptions, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_detachnode(), dns_db_findext(), DNS_DBFIND_NOWILD, dns_fixedname_init, dns_fixedname_name, dns_name_concatenate(), dns_name_copy(), dns_name_countlabels(), dns_name_equal(), dns_name_fullcompare(), dns_name_split(), DNS_R_NXDOMAIN, dns_rdata_freestruct(), DNS_RDATA_INIT, dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_isassociated(), DNS_SECTION_AUTHORITY, dns_wildcardname, ISC_FALSE, ISC_LOG_DEBUG, ISC_R_SUCCESS, ISC_TRUE, ns_client_sourceip(), ns_client::query, query_addrrset(), query_findclosestnsec3(), query_getnamebuf(), query_newname(), query_newrdataset(), query_putrdataset(), and query_releasename().

Referenced by query_addnxrrsetnsec(), and query_find().

static void query_addnxrrsetnsec ( ns_client_t client,
dns_db_t db,
dns_dbversion_t version,
dns_name_t **  namep,
dns_rdataset_t **  rdatasetp,
dns_rdataset_t **  sigrdatasetp 
) [static]

Definition at line 3729 of file query.c.

References dns_name::attributes, dns_name_concatenate(), dns_name_countlabels(), dns_name_split(), DNS_NAMEATTR_WILDCARD, dns_rdata_init(), dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_isassociated(), DNS_SECTION_AUTHORITY, dns_wildcardname, ISC_FALSE, ISC_R_SUCCESS, ISC_TRUE, dns_name::labels, name, ns_query::qname, ns_client::query, query_addrrset(), query_addwildcardproof(), query_getnamebuf(), query_newname(), and RUNTIME_CHECK.

Referenced by query_find().

static void query_resume ( isc_task_t task,
isc_event_t event 
) [static]

Definition at line 3790 of file query.c.

References ns_query::attributes, CTRACE, dns_db_detach(), dns_db_detachnode(), DNS_EVENT_FETCHDONE, DNS_R_SERVFAIL, dns_resolver_destroyfetch(), dns_resolver_logfetch(), ns_query::fetch, ns_query::fetchlock, INSIST, isc_event_free(), ISC_FALSE, ISC_LOG_DEBUG, ISC_LOG_ERROR, isc_log_wouldlog(), ISC_R_CANCELED, ISC_R_SUCCESS, isc_stdtime_get(), ISC_TRUE, LOCK, ns_client::now, ns_client_detach(), ns_client_shuttingdown(), NS_CLIENT_VALID, NS_LOGCATEGORY_QUERY_EERRORS, NS_LOGMODULE_QUERY, NS_QUERYATTR_RECURSING, ns_client::query, query_error, query_find(), query_next(), query_putrdataset(), RECURSING, REQUIRE, ns_client::task, UNLOCK, and UNUSED.

Referenced by query_recurse().

static void prefetch_done ( isc_task_t task,
isc_event_t event 
) [static]

Definition at line 3880 of file query.c.

References dns_db_detach(), dns_db_detachnode(), DNS_EVENT_FETCHDONE, dns_resolver_destroyfetch(), ns_query::fetchlock, INSIST, isc_event_free(), LOCK, ns_client_detach(), NS_CLIENT_VALID, ns_query::prefetch, ns_client::query, query_putrdataset(), REQUIRE, ns_client::task, UNLOCK, and UNUSED.

Referenced by query_prefetch().

static void query_prefetch ( ns_client_t client,
dns_name_t qname,
dns_rdataset_t rdataset 
) [static]

Definition at line 3909 of file query.c.

References ns_client::attributes, dns_rdataset::attributes, DNS_FETCHOPT_PREFETCH, dns_nsstatscounter_recursclients, dns_rdataset_clearprefetch(), DNS_RDATASETATTR_PREFETCH, dns_resolver_createfetch3(), dummy, ns_query::fetchoptions, dns_message::id, isc_quota_attach(), ISC_R_SUCCESS, isc_stats_increment(), ns_client::message, ns_client_attach(), ns_client_detach(), NS_CLIENTATTR_TCP, ns_client::peeraddr, ns_query::prefetch, prefetch_done(), dns_view::prefetch_trigger, ns_client::query, query_newrdataset(), query_putrdataset(), ns_client::recursionquota, dns_view::resolver, ns_client::task, dns_rdataset::ttl, dns_rdataset::type, and ns_client::view.

Referenced by query_find().

static isc_result_t query_recurse ( ns_client_t client,
dns_rdatatype_t  qtype,
dns_name_t qname,
dns_name_t qdomain,
dns_rdataset_t nameservers,
isc_boolean_t  resuming 
) [static]

Definition at line 3957 of file query.c.

References ns_client::attributes, dns_nsstatscounter_recursclients, dns_nsstatscounter_recursion, dns_resolver_createfetch3(), ns_query::fetch, ns_query::fetchoptions, dns_message::id, inc_stats(), ISC_FALSE, ISC_LOG_WARNING, isc_quota_attach(), isc_quota_detach(), ISC_R_NOMEMORY, ISC_R_QUOTA, ISC_R_SOFTQUOTA, ISC_R_SUCCESS, isc_result_totext(), isc_stats_decrement(), isc_stats_increment(), isc_stdtime_get(), isc_quota::max, ns_client::message, ns_client::mortal, now, ns_client_killoldestquery(), ns_client_log(), ns_client_recursing(), ns_client_replace(), ns_client_settimeout(), NS_CLIENTATTR_TCP, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_QUERY, ns_client::peeraddr, ns_client::query, query_newrdataset(), query_putrdataset(), query_resume(), ns_client::recursionquota, REQUIRE, dns_view::resolver, isc_quota::soft, ns_client::task, ns_query::timerset, dns_rdataset::type, isc_quota::used, ns_client::view, and WANTDNSSEC.

Referenced by query_find(), redirect2(), and rpz_rrset_find().

static void rpz_clean ( dns_zone_t **  zonep,
dns_db_t **  dbp,
dns_dbnode_t **  nodep,
dns_rdataset_t **  rdatasetp 
) [inline, static]

Definition at line 4088 of file query.c.

References dns_db_detach(), dns_db_detachnode(), dns_rdataset_disassociate(), dns_rdataset_isassociated(), dns_zone_detach(), and REQUIRE.

Referenced by query_find(), rpz_find_p(), rpz_match_clear(), rpz_rewrite(), rpz_rewrite_ip(), rpz_rewrite_name(), rpz_rrset_find(), and rpz_st_clear().

static void rpz_match_clear ( dns_rpz_st_t st  )  [inline, static]

Definition at line 4105 of file query.c.

References dns_rpz_st_t::db, dns_rpz_st_t::m, dns_rpz_st_t::node, dns_rpz_st_t::rdataset, rpz_clean(), dns_rpz_st_t::version, and dns_rpz_st_t::zone.

Referenced by query_find(), rpz_rewrite(), rpz_save_p(), and rpz_st_clear().

static isc_result_t rpz_ready ( ns_client_t client,
dns_rdataset_t **  rdatasetp 
) [inline, static]

Definition at line 4112 of file query.c.

References CTRACE, DNS_R_SERVFAIL, dns_rdataset_disassociate(), dns_rdataset_isassociated(), ISC_LOG_ERROR, ISC_R_SUCCESS, query_newrdataset(), and REQUIRE.

static dns_rpz_zbits_t rpz_get_zbits ( ns_client_t client,
dns_rdatatype_t  ip_type,
dns_rpz_type_t  rpz_type 
) [static]

Definition at line 4154 of file query.c.

References dns_rpz_zones::client_ip, DNS_RPZ_POLICY_MISS, DNS_RPZ_TYPE_CLIENT_IP, DNS_RPZ_TYPE_IP, DNS_RPZ_TYPE_NSDNAME, DNS_RPZ_TYPE_NSIP, DNS_RPZ_TYPE_QNAME, DNS_RPZ_ZMASK, dns_rpz_zones::have, INSIST, dns_rpz_zones::ip, dns_rpz_zones::ipv4, dns_rpz_zones::ipv6, dns_rpz_st_t::m, dns_rpz_zones::no_rd_ok, dns_rpz_zones::nsdname, dns_rpz_zones::nsip, dns_rpz_zones::nsipv4, dns_rpz_zones::nsipv6, dns_rpz_zone::num, dns_rpz_zones::p, dns_rpz_st_t::policy, dns_rpz_zones::qname, ns_client::query, RECURSIONOK, dns_rpz_st_t::rpz, ns_query::rpz_st, dns_view::rpzs, dns_rpz_st_t::type, and ns_client::view.

Referenced by rpz_rewrite(), rpz_rewrite_ip_rrset(), and rpz_rewrite_name().

static isc_result_t rpz_rrset_find ( ns_client_t client,
dns_name_t name,
dns_rdatatype_t  type,
dns_rpz_type_t  rpz_type,
dns_db_t **  dbp,
dns_dbversion_t version,
dns_rdataset_t **  rdatasetp,
isc_boolean_t  resuming 
) [static]

Definition at line 4228 of file query.c.

References dns_view::cachedb, CTRACE, dns_rpz_st_t::db, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_attach(), dns_db_findext(), DNS_DBFIND_GLUEOK, dns_fixedname_init, dns_fixedname_name, dns_name_copy(), dns_name_equal(), DNS_R_DELEGATION, DNS_R_NXRRSET, DNS_R_SERVFAIL, dns_rdataset_isassociated(), DNS_RPZ_ERROR_LEVEL, DNS_RPZ_POLICY_ERROR, DNS_RPZ_RECURSING, DNS_RPZ_TYPE_IP, dns_zone_detach(), fixed, INSIST, ISC_FALSE, ISC_LOG_ERROR, ISC_R_SUCCESS, dns_rpz_st_t::m, ns_client::now, ns_client_sourceip(), dns_rpz_st_t::policy, ns_client::query, query_getdb(), query_putrdataset(), query_recurse(), dns_rpz_st_t::r, dns_rpz_st_t::r_name, dns_rpz_st_t::r_rdataset, dns_rpz_st_t::r_result, dns_rpz_st_t::r_type, rpz_clean(), rpz_log_fail(), rpz_ready(), ns_query::rpz_st, dns_rpz_st_t::state, USECACHE, ns_client::view, and zone.

Referenced by rpz_rewrite(), and rpz_rewrite_ip_rrset().

static isc_result_t rpz_get_p_name ( ns_client_t client,
dns_name_t p_name,
dns_rpz_zone_t rpz,
dns_rpz_type_t  rpz_type,
dns_name_t trig_name 
) [static]

Definition at line 4343 of file query.c.

References dns_rpz_zone::client_ip, dns_name_concatenate(), dns_name_countlabels(), dns_name_getlabelsequence(), dns_name_init(), DNS_R_NAMETOOLONG, DNS_RPZ_DEBUG_LEVEL1, DNS_RPZ_ERROR_LEVEL, DNS_RPZ_TYPE_CLIENT_IP, DNS_RPZ_TYPE_IP, DNS_RPZ_TYPE_NSDNAME, DNS_RPZ_TYPE_NSIP, DNS_RPZ_TYPE_QNAME, INSIST, dns_rpz_zone::ip, ISC_R_FAILURE, ISC_R_SUCCESS, dns_rpz_zone::nsdname, dns_rpz_zone::nsip, dns_rpz_zone::origin, and rpz_log_fail().

Referenced by rpz_rewrite_ip(), and rpz_rewrite_name().

static isc_result_t rpz_find_p ( ns_client_t client,
dns_name_t self_name,
dns_rdatatype_t  qtype,
dns_name_t p_name,
dns_rpz_zone_t rpz,
dns_rpz_type_t  rpz_type,
dns_zone_t **  zonep,
dns_db_t **  dbp,
dns_dbversion_t **  versionp,
dns_dbnode_t **  nodep,
dns_rdataset_t **  rdatasetp,
dns_rpz_policy_t policyp 
) [static]

Definition at line 4424 of file query.c.

References CTRACE, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_allrdatasets(), dns_db_detachnode(), dns_db_findext(), dns_fixedname_init, dns_fixedname_name, DNS_R_CNAME, DNS_R_DNAME, DNS_R_EMPTYNAME, DNS_R_NXDOMAIN, DNS_R_NXRRSET, DNS_R_SERVFAIL, dns_rdataset_disassociate(), dns_rdataset_isassociated(), dns_rdatasetiter_current(), dns_rdatasetiter_destroy(), dns_rdatasetiter_first(), dns_rdatasetiter_next(), dns_rpz_decode_cname(), DNS_RPZ_ERROR_LEVEL, DNS_RPZ_POLICY_NODATA, DNS_RPZ_POLICY_RECORD, DNS_RPZ_POLICY_WILDCNAME, ISC_LOG_ERROR, ISC_R_NOMORE, ISC_R_SUCCESS, ns_client::now, ns_client_sourceip(), REQUIRE, rpz_clean(), rpz_getdb(), rpz_log_fail(), and rpz_ready().

Referenced by rpz_rewrite_ip(), and rpz_rewrite_name().

static void rpz_save_p ( dns_rpz_st_t st,
dns_rpz_zone_t rpz,
dns_rpz_type_t  rpz_type,
dns_rpz_policy_t  policy,
dns_name_t p_name,
dns_rpz_prefix_t  prefix,
isc_result_t  result,
dns_zone_t **  zonep,
dns_db_t **  dbp,
dns_dbnode_t **  nodep,
dns_rdataset_t **  rdatasetp,
dns_dbversion_t version 
) [static]

Definition at line 4556 of file query.c.

References dns_rpz_st_t::db, dns_name_copy(), dns_rdataset_isassociated(), DNS_RPZ_TTL_DEFAULT, ISC_MIN, dns_rpz_st_t::m, dns_rpz_zone::max_policy_ttl, dns_rpz_st_t::node, dns_rpz_st_t::p_name, dns_rpz_st_t::policy, dns_rpz_st_t::prefix, dns_rpz_st_t::rdataset, dns_rpz_st_t::result, dns_rpz_st_t::rpz, rpz_match_clear(), dns_rdataset::ttl, dns_rpz_st_t::ttl, dns_rpz_st_t::type, dns_rpz_st_t::version, and dns_rpz_st_t::zone.

Referenced by rpz_rewrite_ip(), and rpz_rewrite_name().

static isc_result_t rpz_rewrite_ip ( ns_client_t client,
const isc_netaddr_t netaddr,
dns_rdatatype_t  qtype,
dns_rpz_type_t  rpz_type,
dns_rpz_zbits_t  zbits,
dns_rdataset_t **  p_rdatasetp 
) [static]

Definition at line 4596 of file query.c.

References dns_fixedname_init, dns_fixedname_name, dns_name_rdatacompare(), DNS_R_NXDOMAIN, DNS_R_SERVFAIL, dns_rpz_find_ip(), DNS_RPZ_INVALID_NUM, DNS_RPZ_POLICY_DISABLED, DNS_RPZ_POLICY_ERROR, DNS_RPZ_POLICY_MISS, DNS_RPZ_ZMASK, ISC_R_SUCCESS, ISC_TRUE, dns_rpz_st_t::m, dns_rpz_zone::num, dns_rpz_st_t::p_name, dns_rpz_zone::policy, dns_rpz_st_t::policy, dns_rpz_st_t::prefix, ns_client::query, dns_rpz_st_t::rpz, rpz_clean(), rpz_find_p(), rpz_get_p_name(), rpz_log_rewrite(), rpz_save_p(), ns_query::rpz_st, dns_view::rpzs, dns_rpz_st_t::type, ns_client::view, and dns_rpz_zones::zones.

Referenced by rpz_rewrite(), and rpz_rewrite_ip_rrset().

static isc_result_t rpz_rewrite_ip_rrset ( ns_client_t client,
dns_name_t name,
dns_rdatatype_t  qtype,
dns_rpz_type_t  rpz_type,
dns_rdatatype_t  ip_type,
dns_db_t **  ip_dbp,
dns_dbversion_t ip_version,
dns_rdataset_t **  ip_rdatasetp,
dns_rdataset_t **  p_rdatasetp,
isc_boolean_t  resuming 
) [static]

Definition at line 4729 of file query.c.

References CTRACE, dns_rdata::data, DNS_R_CNAME, DNS_R_DELEGATION, DNS_R_DNAME, DNS_R_DROP, DNS_R_DUPLICATE, DNS_R_EMPTYNAME, DNS_R_EMPTYWILD, DNS_R_GLUE, DNS_R_NCACHENXDOMAIN, DNS_R_NCACHENXRRSET, DNS_R_NXDOMAIN, DNS_R_NXRRSET, DNS_R_SERVFAIL, DNS_R_ZONECUT, DNS_RDATA_INIT, dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_next(), DNS_RPZ_DEBUG_LEVEL1, DNS_RPZ_ERROR_LEVEL, DNS_RPZ_POLICY_ERROR, INSIST, ISC_LOG_ERROR, isc_netaddr_fromin(), isc_netaddr_fromin6(), ISC_R_NOTFOUND, ISC_R_SUCCESS, dns_rdata::length, dns_rpz_st_t::m, dns_rpz_st_t::policy, ns_client::query, rpz_get_zbits(), rpz_log_fail(), rpz_rewrite_ip(), rpz_rrset_find(), ns_query::rpz_st, and dns_rdata::type.

Referenced by rpz_rewrite_ip_rrsets().

static isc_result_t rpz_rewrite_ip_rrsets ( ns_client_t client,
dns_name_t name,
dns_rdatatype_t  qtype,
dns_rpz_type_t  rpz_type,
dns_rdataset_t **  ip_rdatasetp,
isc_boolean_t  resuming 
) [static]

Definition at line 4823 of file query.c.

References dns_db_detach(), DNS_RPZ_DONE_IPv4, DNS_RPZ_TYPE_NSIP, ISC_R_SUCCESS, ns_client::query, query_putrdataset(), rpz_rewrite_ip_rrset(), ns_query::rpz_st, and dns_rpz_st_t::state.

Referenced by rpz_rewrite().

static isc_result_t rpz_rewrite_name ( ns_client_t client,
dns_name_t trig_name,
dns_rdatatype_t  qtype,
dns_rpz_type_t  rpz_type,
dns_rpz_zbits_t  allowed_zbits,
dns_rdataset_t **  rdatasetp 
) [static]

Definition at line 4881 of file query.c.

References isc_region::base, dns_fixedname_init, dns_fixedname_name, dns_name_compare(), dns_name_countlabels(), dns_name_getlabel(), DNS_R_NXDOMAIN, DNS_R_SERVFAIL, dns_rpz_find_name(), DNS_RPZ_POLICY_DISABLED, DNS_RPZ_POLICY_ERROR, DNS_RPZ_POLICY_MISS, DNS_RPZ_PREFIX, INSIST, ISC_R_SUCCESS, ISC_TRUE, isc_region::length, dns_rpz_st_t::m, dns_rpz_zone::num, dns_rpz_st_t::p_name, dns_rpz_zone::policy, dns_rpz_st_t::policy, ns_client::query, dns_rpz_st_t::rpz, rpz_clean(), rpz_find_p(), rpz_get_p_name(), rpz_get_zbits(), rpz_log_rewrite(), rpz_save_p(), ns_query::rpz_st, dns_view::rpzs, dns_rpz_st_t::type, ns_client::view, and dns_rpz_zones::zones.

Referenced by rpz_rewrite().

static void rpz_rewrite_ns_skip ( ns_client_t client,
dns_name_t nsname,
isc_result_t  result,
int  level,
const char *  str 
) [static]

Definition at line 5054 of file query.c.

References dns_rdataset_disassociate(), dns_rdataset_isassociated(), DNS_RPZ_TYPE_NSIP, dns_rpz_st_t::label, dns_rpz_st_t::ns_rdataset, ns_client::query, dns_rpz_st_t::r, rpz_log_fail(), and ns_query::rpz_st.

Referenced by rpz_rewrite().

static isc_result_t rpz_rewrite ( ns_client_t client,
dns_rdatatype_t  qtype,
isc_result_t  qresult,
isc_boolean_t  resuming 
) [static]

Definition at line 5075 of file query.c.

References dns_rpz_st_t::_fnamef, dns_rpz_st_t::_p_namef, dns_rpz_st_t::_r_namef, allowed(), cleanup(), CTRACE, dns_rpz_st_t::db, dns_db_detach(), dns_fixedname_init, dns_fixedname_name, dns_name_clone(), dns_name_countlabels(), dns_name_equal(), dns_name_split(), DNS_R_BROKENCHAIN, DNS_R_CNAME, DNS_R_DELEGATION, DNS_R_DNAME, DNS_R_DROP, DNS_R_DUPLICATE, DNS_R_EMPTYNAME, DNS_R_EMPTYWILD, DNS_R_GLUE, DNS_R_NCACHENXDOMAIN, DNS_R_NCACHENXRRSET, DNS_R_NXDOMAIN, DNS_R_NXRRSET, DNS_R_SERVFAIL, DNS_R_ZONECUT, dns_rdata_freestruct(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_isassociated(), dns_rdataset_next(), dns_rootname, DNS_RPZ_ALL_ZBITS, DNS_RPZ_DEBUG_LEVEL1, DNS_RPZ_DEBUG_LEVEL3, DNS_RPZ_DONE_CLIENT_IP, DNS_RPZ_DONE_IPv4, DNS_RPZ_DONE_NSDNAME, DNS_RPZ_DONE_QNAME, DNS_RPZ_DONE_QNAME_IP, DNS_RPZ_ERROR_LEVEL, DNS_RPZ_INFO_LEVEL, DNS_RPZ_POLICY_ERROR, DNS_RPZ_POLICY_GIVEN, DNS_RPZ_POLICY_MISS, DNS_RPZ_POLICY_PASSTHRU, DNS_RPZ_RECURSING, DNS_RPZ_TYPE_BAD, DNS_RPZ_TYPE_CLIENT_IP, DNS_RPZ_TYPE_IP, DNS_RPZ_TYPE_NSDNAME, DNS_RPZ_TYPE_NSIP, DNS_RPZ_TYPE_QNAME, dns_rpz_st_t::fname, dns_rpz_zones::have, ISC_FALSE, ISC_LOG_ERROR, isc_mem_get, isc_netaddr_fromsockaddr(), ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_R_TIMEDOUT, dns_rpz_st_t::label, dns_rpz_st_t::m, ns_client::mctx, dns_rpz_zones::min_ns_labels, dns_rpz_st_t::ns_rdataset, dns_rpz_zones::p, dns_rpz_st_t::p_name, ns_client::peeraddr, dns_rpz_zone::policy, dns_rpz_st_t::policy, dns_rpz_st_t::q, ns_query::qname, dns_rpz_zones::qname_skip_recurse, ns_client::query, query_putrdataset(), dns_rpz_st_t::r, dns_rpz_st_t::r_name, RECURSIONOK, dns_rpz_st_t::rpz, rpz_clean(), rpz_get_zbits(), rpz_log_fail(), rpz_log_rewrite(), rpz_match_clear(), rpz_rewrite_ip(), rpz_rewrite_ip_rrsets(), rpz_rewrite_name(), rpz_rewrite_ns_skip(), rpz_rrset_find(), ns_query::rpz_st, dns_view::rpzs, dns_rpz_st_t::state, dns_rpz_st_t::ttl, dns_rpz_st_t::type, ns_client::view, and dns_rpz_st_t::zone.

Referenced by query_find().

static isc_boolean_t rpz_ck_dnssec ( ns_client_t client,
isc_result_t  qresult,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 5435 of file query.c.

References dns_rdataset::attributes, dns_rpz_zones::break_dnssec, dns_fixedname_init, dns_fixedname_name, dns_ncache_current(), DNS_R_DELEGATION, dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_next(), DNS_RDATASETATTR_NEGATIVE, fixed, ISC_FALSE, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, dns_rpz_zones::p, dns_view::rpzs, dns_rdataset::type, ns_client::view, and WANTDNSSEC.

Referenced by query_find().

static isc_result_t rpz_add_cname ( ns_client_t client,
dns_rpz_st_t st,
dns_name_t cname,
dns_name_t fname,
isc_buffer_t dbuf 
) [static]

Definition at line 5501 of file query.c.

References ns_client::attributes, dns_fixedname_init, dns_fixedname_name, dns_name_concatenate(), dns_name_copy(), dns_name_countlabels(), dns_name_iswildcard(), dns_name_split(), DNS_R_NAMETOOLONG, dns_rcode_yxdomain, dns_trust_authanswer, ISC_FALSE, ISC_R_SUCCESS, dns_rpz_st_t::m, ns_client::message, ns_client_qnamereplace(), NS_CLIENTATTR_WANTAD, NS_CLIENTATTR_WANTDNSSEC, dns_rpz_st_t::p_name, dns_rpz_st_t::policy, ns_query::qname, ns_client::query, query_add_cname(), query_keepname(), dns_message::rcode, rpz_log_rewrite(), RUNTIME_CHECK, dns_rpz_st_t::ttl, dns_rpz_st_t::type, and dns_rpz_st_t::zone.

Referenced by query_find().

static isc_result_t rdata_tonetaddr ( const dns_rdata_t rdata,
isc_netaddr_t netaddr 
) [static]

Definition at line 5570 of file query.c.

References dns_rdata::data, INSIST, isc_netaddr_fromin(), isc_netaddr_fromin6(), ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, dns_rdata::length, and dns_rdata::type.

Referenced by query_sortlist_order_1element(), and query_sortlist_order_2element().

static int query_sortlist_order_2element ( const dns_rdata_t rdata,
const void *  arg 
) [static]

Definition at line 5596 of file query.c.

References ISC_R_SUCCESS, ns_sortlist_addrorder2(), and rdata_tonetaddr().

Referenced by setup_query_sortlist().

static int query_sortlist_order_1element ( const dns_rdata_t rdata,
const void *  arg 
) [static]

Definition at line 5609 of file query.c.

References ISC_R_SUCCESS, ns_sortlist_addrorder1(), and rdata_tonetaddr().

Referenced by setup_query_sortlist().

static void setup_query_sortlist ( ns_client_t client  )  [static]

Definition at line 5622 of file query.c.

References dns_message_setsortorder(), INSIST, isc_netaddr_fromsockaddr(), ns_client::message, ns_sortlist_setup(), NS_SORTLISTTYPE_1ELEMENT, NS_SORTLISTTYPE_2ELEMENT, NS_SORTLISTTYPE_NONE, ns_client::peeraddr, query_sortlist_order_1element(), query_sortlist_order_2element(), dns_view::sortlist, and ns_client::view.

Referenced by query_find().

static void query_addnoqnameproof ( ns_client_t client,
dns_rdataset_t rdataset 
) [static]

Definition at line 5647 of file query.c.

References dns_rdataset::attributes, cleanup(), CTRACE, dns_rdataset_disassociate(), dns_rdataset_getclosest(), dns_rdataset_getnoqname(), dns_rdataset_isassociated(), DNS_RDATASETATTR_CLOSEST, DNS_SECTION_AUTHORITY, ISC_LOG_DEBUG, ISC_R_NOMEMORY, ISC_R_SUCCESS, query_addrrset(), query_getnamebuf(), query_newname(), query_newrdataset(), query_putrdataset(), query_releasename(), and RUNTIME_CHECK.

Referenced by query_find().

static void answer_in_glue ( ns_client_t client,
dns_rdatatype_t  qtype 
) [inline, static]

Definition at line 5709 of file query.c.

References dns_rdataset::attributes, dns_name_equal(), DNS_RDATASETATTR_REQUIRED, DNS_SECTION_ADDITIONAL, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_PREPEND, ISC_LIST_UNLINK, ns_client::message, name, ns_query::qname, ns_client::query, dns_message::sections, and dns_rdataset::type.

Referenced by query_find().

static void warn_rfc1918 ( ns_client_t client,
dns_name_t fname,
dns_rdataset_t rdataset 
) [static]

Definition at line 5802 of file query.c.

References DNS_LOGCATEGORY_SECURITY, dns_name_equal(), dns_name_format(), DNS_NAME_FORMATSIZE, dns_name_issubdomain(), dns_ncache_getrdataset(), DNS_RDATA_INIT, dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), ISC_LOG_WARNING, ISC_R_SUCCESS, ns_client_log(), NS_LOGMODULE_QUERY, and RUNTIME_CHECK.

Referenced by query_find().

static isc_uint32_t dns64_ttl ( dns_db_t db,
dns_dbversion_t version 
) [static]

Definition at line 5959 of file query.c.

References cleanup(), dns_db_detachnode(), dns_db_findrdataset(), dns_db_getoriginnode(), DNS_RDATA_INIT, dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), ISC_MIN, ISC_R_SUCCESS, ISC_UINT32_MAX, RUNTIME_CHECK, dns_rdataset::ttl, and ttl.

Referenced by query_find().

static isc_boolean_t dns64_aaaaok ( ns_client_t client,
dns_rdataset_t rdataset,
dns_rdataset_t sigrdataset 
) [static]

Definition at line 5995 of file query.c.

References dns_view::dns64, ns_query::dns64_aaaa, ns_query::dns64_aaaaok, ns_query::dns64_aaaaoklen, ns_query::dns64_sigaaaa, dns_dns64_aaaaok(), DNS_DNS64_DNSSEC, DNS_DNS64_RECURSIVE, dns_rdataset_count(), dns_rdataset_isassociated(), INSIST, ISC_FALSE, ISC_LIST_HEAD, isc_mem_get, isc_mem_put, isc_netaddr_fromsockaddr(), ISC_TRUE, ns_client::mctx, ns_client::peeraddr, ns_client::query, RECURSIONOK, ns_client::signer, and ns_client::view.

Referenced by query_find().

static isc_result_t redirect ( ns_client_t client,
dns_name_t name,
dns_rdataset_t rdataset,
dns_dbnode_t **  nodep,
dns_db_t **  dbp,
dns_dbversion_t **  versionp,
dns_rdatatype_t  qtype 
) [static]

Definition at line 6052 of file query.c.

References ns_query::attributes, dns_rdataset::attributes, CTRACE, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_attach(), dns_db_attachnode(), dns_db_detach(), dns_db_detachnode(), dns_db_findext(), dns_db_issecure(), dns_db_iszone(), DNS_DBFIND_NOZONECUT, dns_fixedname_init, dns_fixedname_name, dns_name_copy(), dns_ncache_current(), DNS_R_NCACHENXRRSET, DNS_R_NXRRSET, dns_rdataset_clone(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_next(), DNS_RDATASETATTR_NEGATIVE, dns_trust_secure, dns_trust_ultimate, dns_zone_getdb(), dns_zone_getqueryacl(), fixed, ISC_LOG_DEBUG, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, ns_client::now, ns_client_checkaclsilent(), ns_client_sourceip(), NS_QUERYATTR_NOADDITIONAL, NS_QUERYATTR_NOAUTHORITY, ns_query::qname, ns_client::query, query_findversion(), dns_view::redirect, dns_rdataset::trust, dns_rdataset::type, ns_dbversion::version, ns_client::view, and WANTDNSSEC.

Referenced by query_find().

static isc_result_t redirect2 ( ns_client_t client,
dns_name_t name,
dns_rdataset_t rdataset,
dns_dbnode_t **  nodep,
dns_db_t **  dbp,
dns_dbversion_t **  versionp,
dns_rdatatype_t  qtype 
) [static]

Definition at line 6166 of file query.c.

References ns_query::attributes, dns_rdataset::attributes, CTRACE, dns_clientinfo_init(), dns_clientinfomethods_init(), dns_db_attach(), dns_db_attachnode(), dns_db_detach(), dns_db_detachnode(), dns_db_findext(), dns_db_issecure(), dns_db_iszone(), dns_fixedname_init, dns_fixedname_name, dns_name_concatenate(), dns_name_copy(), dns_name_countlabels(), dns_name_getlabelsequence(), dns_name_init(), dns_name_issubdomain(), dns_name_split(), dns_ncache_current(), DNS_R_CONTINUE, DNS_R_DELEGATION, DNS_R_NCACHENXRRSET, DNS_R_NXRRSET, dns_rdataset_clone(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_next(), DNS_RDATASETATTR_NEGATIVE, dns_rootname, dns_trust_secure, dns_trust_ultimate, fixed, ISC_FALSE, ISC_LOG_DEBUG, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_TRUE, ns_client::now, ns_client_sourceip(), NS_QUERYATTR_NOADDITIONAL, NS_QUERYATTR_NOAUTHORITY, NS_QUERYATTR_RECURSING, NS_QUERYATTR_REDIRECT, ns_client::query, query_getdb(), query_recurse(), REDIRECT, dns_view::redirectzone, RUNTIME_CHECK, dns_rdataset::trust, dns_rdataset::type, version, ns_client::view, WANTDNSSEC, and zone.

Referenced by query_find().

static void log_query ( ns_client_t client,
unsigned int  flags,
unsigned int  extflags 
) [inline, static]

Definition at line 8594 of file query.c.

References ns_client::attributes, ns_client::destaddr, DNS_MESSAGEEXTFLAG_DO, DNS_MESSAGEFLAG_CD, dns_name_format(), DNS_NAME_FORMATSIZE, dns_rdataclass_format(), DNS_RDATACLASS_FORMATSIZE, dns_rdatatype_format(), DNS_RDATATYPE_FORMATSIZE, ns_client::ednsversion, INSIST, ISC_LIST_HEAD, ISC_LOG_INFO, isc_log_wouldlog(), isc_netaddr_format(), ISC_NETADDR_FORMATSIZE, namebuf, ns_client_log(), NS_CLIENTATTR_TCP, NS_LOGCATEGORY_QUERIES, NS_LOGMODULE_QUERY, ns_query::qname, ns_client::query, dns_rdataset::rdclass, ns_client::signer, dns_rdataset::type, and WANTRECURSION.

Referenced by ns_query_start().

void ns_query_start ( ns_client_t client  ) 

Definition at line 8671 of file query.c.

References dns_view::additionalfromcache, ns_query::attributes, ns_client::attributes, dns_view::cachedb, dns_message::counts, CTRACE, ns_query::dboptions, DNS_DBFIND_PENDINGOK, DNS_FETCHOPT_NOVALIDATE, dns_message_currentname(), dns_message_firstname(), dns_message_nextname(), dns_message_reply(), DNS_MESSAGEEXTFLAG_DO, DNS_MESSAGEFLAG_AA, DNS_MESSAGEFLAG_AD, DNS_MESSAGEFLAG_CD, DNS_MESSAGEFLAG_RD, DNS_R_FORMERR, DNS_R_NOTIMP, dns_rdatatype_ismeta(), dns_rdatatypestats_increment(), DNS_SECTION_QUESTION, dns_tkey_processquery(), dns_view::dynamickeys, ns_client::ednsversion, dns_view::enablednssec, dns_view::enablevalidation, ns_client::extflags, ns_query::fetchoptions, dns_message::flags, INSIST, ISC_LIST_HEAD, ISC_LOG_DEBUG, ISC_R_NOMORE, ISC_R_SUCCESS, ISC_TRUE, log_query(), ns_client::message, dns_view::minimalresponses, ns_client::next, ns_client_attach(), ns_client_replace(), NS_CLIENTATTR_NOSETFC, NS_CLIENTATTR_RA, NS_CLIENTATTR_TCP, NS_CLIENTATTR_WANTAD, NS_CLIENTATTR_WANTDNSSEC, NS_QUERYATTR_CACHEOK, NS_QUERYATTR_NOADDITIONAL, NS_QUERYATTR_NOAUTHORITY, NS_QUERYATTR_RECURSIONOK, NS_QUERYATTR_SECURE, NS_QUERYATTR_WANTRECURSION, ns_xfr_start(), ns_query::origqname, ns_query::qname, ns_query::qtype, ns_client::query, query_error, query_find(), query_next(), query_next_callback(), query_send(), RUNTIME_CHECK, dns_rdataset::type, ns_client::udpsize, ns_client::view, WANTAD, and WANTDNSSEC.

Referenced by client_request().


Variable Documentation

unsigned char inaddr10_offsets[] = { 0, 3, 11, 16 } [static]

Definition at line 5745 of file query.c.

unsigned char inaddr172_offsets[] = { 0, 3, 7, 15, 20 } [static]

Definition at line 5746 of file query.c.

unsigned char inaddr192_offsets[] = { 0, 4, 8, 16, 21 } [static]

Definition at line 5747 of file query.c.

unsigned char inaddr10[] = "\00210\007IN-ADDR\004ARPA" [static]

Definition at line 5749 of file query.c.

unsigned char inaddr16172[] = "\00216\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5751 of file query.c.

unsigned char inaddr17172[] = "\00217\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5752 of file query.c.

unsigned char inaddr18172[] = "\00218\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5753 of file query.c.

unsigned char inaddr19172[] = "\00219\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5754 of file query.c.

unsigned char inaddr20172[] = "\00220\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5755 of file query.c.

unsigned char inaddr21172[] = "\00221\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5756 of file query.c.

unsigned char inaddr22172[] = "\00222\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5757 of file query.c.

unsigned char inaddr23172[] = "\00223\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5758 of file query.c.

unsigned char inaddr24172[] = "\00224\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5759 of file query.c.

unsigned char inaddr25172[] = "\00225\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5760 of file query.c.

unsigned char inaddr26172[] = "\00226\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5761 of file query.c.

unsigned char inaddr27172[] = "\00227\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5762 of file query.c.

unsigned char inaddr28172[] = "\00228\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5763 of file query.c.

unsigned char inaddr29172[] = "\00229\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5764 of file query.c.

unsigned char inaddr30172[] = "\00230\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5765 of file query.c.

unsigned char inaddr31172[] = "\00231\003172\007IN-ADDR\004ARPA" [static]

Definition at line 5766 of file query.c.

unsigned char inaddr168192[] = "\003168\003192\007IN-ADDR\004ARPA" [static]

Definition at line 5768 of file query.c.

dns_name_t rfc1918names[] [static]

Initial value:

Definition at line 5770 of file query.c.

unsigned char prisoner_data[] = "\010prisoner\004iana\003org" [static]

Definition at line 5792 of file query.c.

unsigned char hostmaster_data[] = "\012hostmaster\014root-servers\003org" [static]

Definition at line 5793 of file query.c.

unsigned char prisoner_offsets[] = { 0, 9, 14, 18 } [static]

Definition at line 5795 of file query.c.

unsigned char hostmaster_offsets[] = { 0, 11, 24, 28 } [static]

Definition at line 5796 of file query.c.

dns_name_t prisoner = NS_NAME_INIT(prisoner_data, prisoner_offsets) [static]

Definition at line 5798 of file query.c.

dns_name_t hostmaster = NS_NAME_INIT(hostmaster_data, hostmaster_offsets) [static]

Definition at line 5799 of file query.c.


Generated on Tue Apr 28 17:41:07 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha