#include <config.h>
#include <isc/buffer.h>
#include <isc/util.h>
#include <dns/db.h>
#include <dns/message.h>
#include <dns/ncache.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
Go to the source code of this file.
Defines | |
#define | DNS_NCACHE_RDATA 20U |
Functions | |
static isc_result_t | addoptout (dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, isc_boolean_t optout, isc_boolean_t secure, dns_rdataset_t *addedrdataset) |
static isc_result_t | copy_rdataset (dns_rdataset_t *rdataset, isc_buffer_t *buffer) |
isc_result_t | dns_ncache_add (dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, dns_rdataset_t *addedrdataset) |
isc_result_t | dns_ncache_addoptout (dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, isc_boolean_t optout, dns_rdataset_t *addedrdataset) |
Convert the authority data from 'message' into a negative cache rdataset, and store it in 'cache' at 'node' with a TTL limited to 'maxttl'. | |
isc_result_t | dns_ncache_towire (dns_rdataset_t *rdataset, dns_compress_t *cctx, isc_buffer_t *target, unsigned int options, unsigned int *countp) |
Convert the negative caching rdataset 'rdataset' to wire format, compressing names as specified in 'cctx', and storing the result in 'target'. If 'omit_dnssec' is set, DNSSEC records will not be added to 'target'. | |
static void | rdataset_disassociate (dns_rdataset_t *rdataset) |
static isc_result_t | rdataset_first (dns_rdataset_t *rdataset) |
static isc_result_t | rdataset_next (dns_rdataset_t *rdataset) |
static void | rdataset_current (dns_rdataset_t *rdataset, dns_rdata_t *rdata) |
static void | rdataset_clone (dns_rdataset_t *source, dns_rdataset_t *target) |
static unsigned int | rdataset_count (dns_rdataset_t *rdataset) |
static void | rdataset_settrust (dns_rdataset_t *rdataset, dns_trust_t trust) |
isc_result_t | dns_ncache_getrdataset (dns_rdataset_t *ncacherdataset, dns_name_t *name, dns_rdatatype_t type, dns_rdataset_t *rdataset) |
Search the negative caching rdataset for an rdataset with the specified name and type. | |
isc_result_t | dns_ncache_getsigrdataset (dns_rdataset_t *ncacherdataset, dns_name_t *name, dns_rdatatype_t covers, dns_rdataset_t *rdataset) |
Similar to dns_ncache_getrdataset() but get the rrsig that matches. | |
void | dns_ncache_current (dns_rdataset_t *ncacherdataset, dns_name_t *found, dns_rdataset_t *rdataset) |
Extract the current rdataset and name from a ncache entry. | |
Variables | |
static dns_rdatasetmethods_t | rdataset_methods |
Definition in file ncache.c.
#define DNS_NCACHE_RDATA 20U |
static isc_result_t addoptout | ( | dns_message_t * | message, | |
dns_db_t * | cache, | |||
dns_dbnode_t * | node, | |||
dns_rdatatype_t | covers, | |||
isc_stdtime_t | now, | |||
dns_ttl_t | maxttl, | |||
isc_boolean_t | optout, | |||
isc_boolean_t | secure, | |||
dns_rdataset_t * | addedrdataset | |||
) | [static] |
Definition at line 120 of file ncache.c.
References dns_rdataset::attributes, dns_name::attributes, isc_region::base, buffer, copy_rdataset(), dns_message::counts, dns_rdataset::covers, dns_rdatalist::covers, dns_rdata::data, dns_db_addrdataset(), dns_db_class(), dns_message_currentname(), dns_message_firstname(), dns_message_nextname(), DNS_MESSAGEFLAG_AA, dns_name_toregion(), DNS_NAMEATTR_NCACHE, DNS_NCACHE_RDATA, dns_rcode_nxdomain, dns_rdata_init(), dns_rdatalist_init(), dns_rdatalist_tordataset(), dns_rdataset_init(), DNS_RDATASETATTR_NCACHE, DNS_RDATASETATTR_NEGATIVE, DNS_RDATASETATTR_NXDOMAIN, DNS_RDATASETATTR_OPTOUT, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, dns_trust_additional, dns_trust_answer, dns_trust_authauthority, dns_message::flags, dns_rdata::flags, INSIST, isc_buffer_availableregion, isc_buffer_copyregion(), isc_buffer_forward, isc_buffer_init, isc_buffer_putuint16, isc_buffer_putuint8, isc_buffer_remainingregion, ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_R_NOMORE, ISC_R_NOSPACE, ISC_R_SUCCESS, dns_rdata::length, isc_region::length, name, r, dns_message::rcode, dns_rdata::rdclass, dns_rdatalist::rdclass, REQUIRE, RUNTIME_CHECK, dns_rdataset::trust, dns_rdataset::ttl, dns_rdatalist::ttl, ttl, dns_rdata::type, and dns_rdataset::type.
Referenced by dns_ncache_add(), and dns_ncache_addoptout().
static isc_result_t copy_rdataset | ( | dns_rdataset_t * | rdataset, | |
isc_buffer_t * | buffer | |||
) | [inline, static] |
Definition at line 57 of file ncache.c.
References DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_toregion(), dns_rdataset_count(), dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_next(), INSIST, isc_buffer_availableregion, isc_buffer_copyregion(), isc_buffer_putuint16, ISC_R_NOMORE, ISC_R_NOSPACE, ISC_R_SUCCESS, isc_region::length, and r.
Referenced by addoptout().
isc_result_t dns_ncache_add | ( | dns_message_t * | message, | |
dns_db_t * | cache, | |||
dns_dbnode_t * | node, | |||
dns_rdatatype_t | covers, | |||
isc_stdtime_t | now, | |||
dns_ttl_t | maxttl, | |||
dns_rdataset_t * | addedrdataset | |||
) |
Definition at line 101 of file ncache.c.
References addoptout(), and ISC_FALSE.
Referenced by ncache_adderesult().
isc_result_t dns_ncache_addoptout | ( | dns_message_t * | message, | |
dns_db_t * | cache, | |||
dns_dbnode_t * | node, | |||
dns_rdatatype_t | covers, | |||
isc_stdtime_t | now, | |||
dns_ttl_t | maxttl, | |||
isc_boolean_t | optout, | |||
dns_rdataset_t * | addedrdataset | |||
) |
Convert the authority data from 'message' into a negative cache rdataset, and store it in 'cache' at 'node' with a TTL limited to 'maxttl'.
'optout' indicates a DNS_RDATASETATTR_OPTOUT should be set.
Note:
Definition at line 110 of file ncache.c.
References addoptout(), and ISC_TRUE.
Referenced by ncache_adderesult().
isc_result_t dns_ncache_towire | ( | dns_rdataset_t * | rdataset, | |
dns_compress_t * | cctx, | |||
isc_buffer_t * | target, | |||
unsigned int | options, | |||
unsigned int * | countp | |||
) |
Convert the negative caching rdataset 'rdataset' to wire format, compressing names as specified in 'cctx', and storing the result in 'target'. If 'omit_dnssec' is set, DNSSEC records will not be added to 'target'.
Notes:
Definition at line 273 of file ncache.c.
References dns_rdataset::attributes, isc_region::base, dns_rdata::data, DNS_COMPRESS_GLOBAL14, dns_compress_rollback(), dns_compress_setmethods(), dns_name_fromregion(), dns_name_init(), dns_name_towire(), DNS_NCACHETOWIRE_OMITDNSSEC, DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_towire(), dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_next(), DNS_RDATASETATTR_NEGATIVE, dns_rdatatype_isdnssec(), INSIST, isc_buffer_add, isc_buffer_availableregion, isc_buffer_forward, isc_buffer_getuint16(), isc_buffer_init, isc_buffer_putuint16, isc_buffer_putuint32, isc_buffer_remaininglength, isc_buffer_remainingregion, ISC_R_NOMORE, ISC_R_NOSPACE, ISC_R_SUCCESS, dns_name::length, isc_region::length, dns_rdata::length, name, dns_rdataset::rdclass, dns_rdata::rdclass, REQUIRE, dns_rdataset::ttl, dns_rdata::type, dns_rdataset::type, and isc_buffer::used.
Referenced by towiresorted().
static void rdataset_disassociate | ( | dns_rdataset_t * | rdataset | ) | [static] |
static isc_result_t rdataset_first | ( | dns_rdataset_t * | rdataset | ) | [static] |
Definition at line 407 of file ncache.c.
References ISC_R_NOMORE, ISC_R_SUCCESS, dns_rdataset::private3, dns_rdataset::private5, and dns_rdataset::privateuint4.
static isc_result_t rdataset_next | ( | dns_rdataset_t * | rdataset | ) | [static] |
Definition at line 430 of file ncache.c.
References ISC_R_NOMORE, ISC_R_SUCCESS, dns_rdataset::private5, and dns_rdataset::privateuint4.
static void rdataset_current | ( | dns_rdataset_t * | rdataset, | |
dns_rdata_t * | rdata | |||
) | [static] |
Definition at line 449 of file ncache.c.
References isc_region::base, dns_rdata_fromregion(), isc_region::length, dns_rdataset::private5, r, dns_rdataset::rdclass, REQUIRE, and dns_rdataset::type.
static void rdataset_clone | ( | dns_rdataset_t * | source, | |
dns_rdataset_t * | target | |||
) | [static] |
Definition at line 462 of file ncache.c.
References dns_rdataset::private5, and dns_rdataset::privateuint4.
static unsigned int rdataset_count | ( | dns_rdataset_t * | rdataset | ) | [static] |
static void rdataset_settrust | ( | dns_rdataset_t * | rdataset, | |
dns_trust_t | trust | |||
) | [static] |
isc_result_t dns_ncache_getrdataset | ( | dns_rdataset_t * | ncacherdataset, | |
dns_name_t * | name, | |||
dns_rdatatype_t | type, | |||
dns_rdataset_t * | rdataset | |||
) |
Search the negative caching rdataset for an rdataset with the specified name and type.
Requires:
Definition at line 511 of file ncache.c.
References dns_rdataset::attributes, isc_region::base, dns_rdataset::covers, dns_rdata::data, dns_name_equal(), dns_name_fromregion(), dns_name_init(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdataset_clone(), dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_next(), DNS_RDATASETATTR_NEGATIVE, dns_trust_none, dns_trust_ultimate, INSIST, isc_buffer_add, isc_buffer_forward, isc_buffer_getuint16(), isc_buffer_getuint8(), isc_buffer_init, isc_buffer_remainingregion, ISC_R_NOMORE, ISC_R_NOTFOUND, ISC_R_SUCCESS, dns_name::length, isc_region::length, dns_rdata::length, dns_rdataset::methods, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::private5, dns_rdataset::private6, dns_rdataset::privateuint4, dns_rdataset::rdclass, REQUIRE, dns_rdataset::trust, dns_rdataset::ttl, and dns_rdataset::type.
Referenced by isdelegation(), and warn_rfc1918().
isc_result_t dns_ncache_getsigrdataset | ( | dns_rdataset_t * | ncacherdataset, | |
dns_name_t * | name, | |||
dns_rdatatype_t | covers, | |||
dns_rdataset_t * | rdataset | |||
) |
Similar to dns_ncache_getrdataset() but get the rrsig that matches.
Definition at line 585 of file ncache.c.
References dns_rdataset::attributes, isc_region::base, dns_rdataset::covers, dns_rdata::data, dns_name_equal(), dns_name_fromregion(), dns_name_init(), dns_rdata_fromregion(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), dns_rdataset_clone(), dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_next(), DNS_RDATASETATTR_NEGATIVE, dns_trust_none, dns_trust_ultimate, INSIST, isc_buffer_add, isc_buffer_forward, isc_buffer_getuint16(), isc_buffer_getuint8(), isc_buffer_init, isc_buffer_remainingregion, ISC_R_NOMORE, ISC_R_NOTFOUND, ISC_R_SUCCESS, dns_name::length, isc_region::length, dns_rdata::length, dns_rdataset::methods, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::private5, dns_rdataset::private6, dns_rdataset::privateuint4, dns_rdataset::rdclass, REQUIRE, dns_rdataset::trust, dns_rdataset::ttl, and dns_rdataset::type.
Referenced by validate_ncache().
void dns_ncache_current | ( | dns_rdataset_t * | ncacherdataset, | |
dns_name_t * | found, | |||
dns_rdataset_t * | rdataset | |||
) |
Extract the current rdataset and name from a ncache entry.
Requires:
Definition at line 687 of file ncache.c.
References dns_rdataset::attributes, isc_region::base, dns_rdataset::covers, dns_rdata::data, dns_name_fromregion(), dns_name_init(), dns_rdata_fromregion(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_isassociated(), DNS_RDATASETATTR_NEGATIVE, dns_trust_ultimate, INSIST, isc_buffer_add, isc_buffer_forward, isc_buffer_getuint16(), isc_buffer_getuint8(), isc_buffer_init, isc_buffer_remainingregion, dns_name::length, isc_region::length, dns_rdata::length, dns_rdataset::methods, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::private5, dns_rdataset::private6, dns_rdataset::privateuint4, dns_rdataset::rdclass, REQUIRE, dns_rdataset::trust, dns_rdataset::ttl, and dns_rdataset::type.
Referenced by isdelegation(), ncache_summary(), query_find(), redirect(), redirect2(), rpz_ck_dnssec(), val_rdataset_first(), val_rdataset_next(), and validate_ncache().
dns_rdatasetmethods_t rdataset_methods [static] |
Initial value:
{ rdataset_disassociate, rdataset_first, rdataset_next, rdataset_current, rdataset_clone, rdataset_count, NULL, NULL, NULL, NULL, NULL, NULL, NULL, rdataset_settrust, NULL, NULL, NULL, NULL }