mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
fix: nil: Add new convenience functions to classify rdata types
- `dns_rdatatype_ismulti()` returns true if a given type can have multiple answers: ANY, RRSIG, or SIG. - `dns_rdatatype_issig()` returns true for a signature: RRSIG or SIG. - `dns_rdatatype_isaddr()` returns true for an address: A or AAAA. - `dns_rdatatype_isalias()` returns true for an alias: CNAME or DNAME. Code has been modified to use these functions where applicable. These and all similar functions (e.g., `dns_rdatatype_ismeta()`, `dns_rdatatype_issingleton()`, etc) are now `static inline` functions defined in `rdata.h`. Merge branch 'each-rdatatype-functions' into 'main' See merge request isc-projects/bind9!10216
This commit is contained in:
commit
a8dd267bd0
13 changed files with 229 additions and 315 deletions
|
|
@ -246,8 +246,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
|||
(list_type == dns_rdatatype_any ||
|
||||
rdataset->type == list_type)) ||
|
||||
(list_addresses &&
|
||||
(rdataset->type == dns_rdatatype_a ||
|
||||
rdataset->type == dns_rdatatype_aaaa ||
|
||||
(dns_rdatatype_isaddr(rdataset->type) ||
|
||||
rdataset->type == dns_rdatatype_ns ||
|
||||
rdataset->type == dns_rdatatype_ptr))))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -232,9 +232,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||
dns_fixedname_init(&name);
|
||||
CHECK(dns__db_addrdataset(sampledb->db, node, version, now, rdataset,
|
||||
options, addedrdataset DNS__DB_FLARG_PASS));
|
||||
if (rdataset->type == dns_rdatatype_a ||
|
||||
rdataset->type == dns_rdatatype_aaaa)
|
||||
{
|
||||
if (dns_rdatatype_isaddr(rdataset->type)) {
|
||||
CHECK(dns_db_nodefullname(sampledb->db, node,
|
||||
dns_fixedname_name(&name)));
|
||||
CHECK(syncptrs(sampledb->inst, dns_fixedname_name(&name),
|
||||
|
|
@ -263,9 +261,7 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (rdataset->type == dns_rdatatype_a ||
|
||||
rdataset->type == dns_rdatatype_aaaa)
|
||||
{
|
||||
if (dns_rdatatype_isaddr(rdataset->type)) {
|
||||
CHECK(dns_db_nodefullname(sampledb->db, node,
|
||||
dns_fixedname_name(&name)));
|
||||
CHECK(syncptrs(sampledb->inst, dns_fixedname_name(&name),
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
|
|||
rdataset->ttl = ttlclamp(rdataset->ttl);
|
||||
}
|
||||
|
||||
REQUIRE(rdtype == dns_rdatatype_a || rdtype == dns_rdatatype_aaaa);
|
||||
REQUIRE(dns_rdatatype_isaddr(rdtype));
|
||||
|
||||
for (result = dns_rdataset_first(rdataset); result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(rdataset))
|
||||
|
|
@ -2557,7 +2557,7 @@ dbfind_name(dns_adbname_t *adbname, isc_stdtime_t now, dns_rdatatype_t rdtype) {
|
|||
adb = adbname->adb;
|
||||
|
||||
REQUIRE(DNS_ADB_VALID(adb));
|
||||
REQUIRE(rdtype == dns_rdatatype_a || rdtype == dns_rdatatype_aaaa);
|
||||
REQUIRE(dns_rdatatype_isaddr(rdtype));
|
||||
|
||||
fname = dns_fixedname_initname(&foundname);
|
||||
dns_rdataset_init(&rdataset);
|
||||
|
|
|
|||
|
|
@ -1516,8 +1516,7 @@ catz_process_primaries(dns_catz_zone_t *catz, dns_ipkeylist_t *ipkl,
|
|||
}
|
||||
/* else - 'simple' case - without labels */
|
||||
|
||||
if (value->type != dns_rdatatype_a && value->type != dns_rdatatype_aaaa)
|
||||
{
|
||||
if (!dns_rdatatype_isaddr(value->type)) {
|
||||
return ISC_R_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,36 @@ struct dns_rdata {
|
|||
ISC_LINK(dns_rdata_t) link;
|
||||
};
|
||||
|
||||
/*%
|
||||
* Rdatatype attributes.
|
||||
*/
|
||||
enum {
|
||||
/*% only one may exist for a name */
|
||||
DNS_RDATATYPEATTR_SINGLETON = 1 << 0,
|
||||
/*% requires no other data be present */
|
||||
DNS_RDATATYPEATTR_EXCLUSIVE = 1 << 1,
|
||||
/*% Is a meta type */
|
||||
DNS_RDATATYPEATTR_META = 1 << 2,
|
||||
/*% Is a DNSSEC type, like RRSIG or NSEC */
|
||||
DNS_RDATATYPEATTR_DNSSEC = 1 << 3,
|
||||
/*% Is a zone cut authority type */
|
||||
DNS_RDATATYPEATTR_ZONECUTAUTH = 1 << 4,
|
||||
/*% Is reserved (unusable) */
|
||||
DNS_RDATATYPEATTR_RESERVED = 1 << 5,
|
||||
/*% Is an unknown type */
|
||||
DNS_RDATATYPEATTR_UNKNOWN = 1 << 6,
|
||||
/*% Is META, and can only be in a question section */
|
||||
DNS_RDATATYPEATTR_QUESTIONONLY = 1 << 7,
|
||||
/*% Is META, and can NOT be in a question section */
|
||||
DNS_RDATATYPEATTR_NOTQUESTION = 1 << 8,
|
||||
/*% Is present at zone cuts in the parent, not the child */
|
||||
DNS_RDATATYPEATTR_ATPARENT = 1 << 9,
|
||||
/*% Can exist along side a CNAME */
|
||||
DNS_RDATATYPEATTR_ATCNAME = 1 << 10,
|
||||
/*% Follow additional */
|
||||
DNS_RDATATYPEATTR_FOLLOWADDITIONAL = 1 << 11,
|
||||
};
|
||||
|
||||
#define DNS_RDATA_INIT \
|
||||
{ \
|
||||
.data = NULL, \
|
||||
|
|
@ -530,16 +560,28 @@ dns_rdata_freestruct(void *source);
|
|||
* dns_rdata_tostruct().
|
||||
*/
|
||||
|
||||
bool
|
||||
dns_rdatatype_ismeta(dns_rdatatype_t type);
|
||||
unsigned int
|
||||
dns_rdatatype_attributes(dns_rdatatype_t rdtype);
|
||||
/*%<
|
||||
* Return attributes for the given type.
|
||||
*
|
||||
* Requires:
|
||||
*\li 'rdtype' are known.
|
||||
*
|
||||
* Returns:
|
||||
*\li a bitmask of the rdatatype attribute flags, defined above.
|
||||
*/
|
||||
|
||||
/*%
|
||||
* Return true iff the rdata type 'type' is a meta-type
|
||||
* like ANY or AXFR.
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_ismeta(dns_rdatatype_t type) {
|
||||
return (dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_META) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_issingleton(dns_rdatatype_t type);
|
||||
/*%<
|
||||
/*%
|
||||
* Return true iff the rdata type 'type' is a singleton type,
|
||||
* like CNAME or SOA.
|
||||
*
|
||||
|
|
@ -547,34 +589,108 @@ dns_rdatatype_issingleton(dns_rdatatype_t type);
|
|||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_issingleton(dns_rdatatype_t type) {
|
||||
return (dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_SINGLETON) !=
|
||||
0;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdataclass_ismeta(dns_rdataclass_t rdclass);
|
||||
/*%<
|
||||
* Return true iff the rdata class 'rdclass' is a meta-class
|
||||
* like ANY or NONE.
|
||||
/*%
|
||||
* Return true iff rdata of type 'type' can not appear in the question
|
||||
* section of a properly formatted message.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_notquestion(dns_rdatatype_t type) {
|
||||
return (dns_rdatatype_attributes(type) &
|
||||
DNS_RDATATYPEATTR_NOTQUESTION) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_isdnssec(dns_rdatatype_t type);
|
||||
/*%<
|
||||
/*%
|
||||
* Return true iff rdata of type 'type' can only appear in the question
|
||||
* section of a properly formatted message.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_questiononly(dns_rdatatype_t type) {
|
||||
return (dns_rdatatype_attributes(type) &
|
||||
DNS_RDATATYPEATTR_QUESTIONONLY) != 0;
|
||||
}
|
||||
|
||||
/*%
|
||||
* Return true iff rdata of type 'type' can appear beside a cname.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_atcname(dns_rdatatype_t type) {
|
||||
return (dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_ATCNAME) !=
|
||||
0;
|
||||
}
|
||||
|
||||
/*%
|
||||
* Return true iff rdata of type 'type' should appear at the parent of
|
||||
* a zone cut.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_atparent(dns_rdatatype_t type) {
|
||||
return (dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_ATPARENT) !=
|
||||
0;
|
||||
}
|
||||
|
||||
/*%
|
||||
* Return true if adding a record of type 'type' to the ADDITIONAL section
|
||||
* of a message can itself trigger the addition of still more data to the
|
||||
* additional section.
|
||||
*
|
||||
* (For example: adding SRV to the ADDITIONAL section may trigger
|
||||
* the addition of address records associated with that SRV.)
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_followadditional(dns_rdatatype_t type) {
|
||||
return (dns_rdatatype_attributes(type) &
|
||||
DNS_RDATATYPEATTR_FOLLOWADDITIONAL) != 0;
|
||||
}
|
||||
|
||||
/*%
|
||||
* Return true iff 'type' is one of the DNSSEC
|
||||
* rdata types that may exist alongside a CNAME record.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_isdnssec(dns_rdatatype_t type) {
|
||||
return (dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_DNSSEC) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_iskeymaterial(dns_rdatatype_t type);
|
||||
/*%<
|
||||
/*%
|
||||
* Return true iff the rdata type 'type' is a DNSSEC key
|
||||
* related type, like DNSKEY, CDNSKEY, or CDS.
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_iskeymaterial(dns_rdatatype_t type) {
|
||||
return type == dns_rdatatype_dnskey || type == dns_rdatatype_cdnskey ||
|
||||
type == dns_rdatatype_cds;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_iszonecutauth(dns_rdatatype_t type);
|
||||
/*%<
|
||||
/*%
|
||||
* Return true iff rdata of type 'type' is considered authoritative
|
||||
* data (not glue) in the NSEC chain when it occurs in the parent zone
|
||||
* at a zone cut.
|
||||
|
|
@ -583,16 +699,68 @@ dns_rdatatype_iszonecutauth(dns_rdatatype_t type);
|
|||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_iszonecutauth(dns_rdatatype_t type) {
|
||||
return (dns_rdatatype_attributes(type) &
|
||||
DNS_RDATATYPEATTR_ZONECUTAUTH) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_isknown(dns_rdatatype_t type);
|
||||
/*%<
|
||||
/*%
|
||||
* Return true iff the rdata type 'type' is known.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_isknown(dns_rdatatype_t type) {
|
||||
return (dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_UNKNOWN) ==
|
||||
0;
|
||||
}
|
||||
|
||||
/*%
|
||||
* Return true iff a query for the rdata type can have multiple
|
||||
* unrelated answers in a response: ANY, RRSIG, or SIG.
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_ismulti(dns_rdatatype_t type) {
|
||||
return type == dns_rdatatype_any || type == dns_rdatatype_rrsig ||
|
||||
type == dns_rdatatype_sig;
|
||||
}
|
||||
|
||||
/*%
|
||||
* Return true iff the rdata type is a signature: either RRSIG or SIG.
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_issig(dns_rdatatype_t type) {
|
||||
return type == dns_rdatatype_rrsig || type == dns_rdatatype_sig;
|
||||
}
|
||||
|
||||
/*%
|
||||
* Return true iff the rdata type is an address: either A or AAAA.
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_isaddr(dns_rdatatype_t type) {
|
||||
return type == dns_rdatatype_a || type == dns_rdatatype_aaaa;
|
||||
}
|
||||
|
||||
/*%
|
||||
* Return true iff the rdata type is an alias: either CNAME or DNAME.
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdatatype_isalias(dns_rdatatype_t type) {
|
||||
return type == dns_rdatatype_cname || type == dns_rdatatype_dname;
|
||||
}
|
||||
|
||||
/*%
|
||||
* Return true iff the rdata class 'rdclass' is a meta-class
|
||||
* like ANY or NONE.
|
||||
*/
|
||||
static inline bool
|
||||
dns_rdataclass_ismeta(dns_rdataclass_t rdclass) {
|
||||
return rdclass == dns_rdataclass_reserved0 ||
|
||||
rdclass == dns_rdataclass_none || rdclass == dns_rdataclass_any;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_rdata_additionaldata(dns_rdata_t *rdata, const dns_name_t *owner,
|
||||
|
|
@ -653,101 +821,6 @@ dns_rdata_digest(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg);
|
|||
*\li Many other results are possible if not successful.
|
||||
*/
|
||||
|
||||
bool
|
||||
dns_rdatatype_questiononly(dns_rdatatype_t type);
|
||||
/*%<
|
||||
* Return true iff rdata of type 'type' can only appear in the question
|
||||
* section of a properly formatted message.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
|
||||
bool
|
||||
dns_rdatatype_notquestion(dns_rdatatype_t type);
|
||||
/*%<
|
||||
* Return true iff rdata of type 'type' can not appear in the question
|
||||
* section of a properly formatted message.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
|
||||
bool
|
||||
dns_rdatatype_atparent(dns_rdatatype_t type);
|
||||
/*%<
|
||||
* Return true iff rdata of type 'type' should appear at the parent of
|
||||
* a zone cut.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
|
||||
bool
|
||||
dns_rdatatype_atcname(dns_rdatatype_t type);
|
||||
/*%<
|
||||
* Return true iff rdata of type 'type' can appear beside a cname.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
|
||||
bool
|
||||
dns_rdatatype_followadditional(dns_rdatatype_t type);
|
||||
/*%<
|
||||
* Return true if adding a record of type 'type' to the ADDITIONAL section
|
||||
* of a message can itself trigger the addition of still more data to the
|
||||
* additional section.
|
||||
*
|
||||
* (For example: adding SRV to the ADDITIONAL section may trigger
|
||||
* the addition of address records associated with that SRV.)
|
||||
*
|
||||
* Requires:
|
||||
* \li 'type' is a valid rdata type.
|
||||
*
|
||||
*/
|
||||
|
||||
unsigned int
|
||||
dns_rdatatype_attributes(dns_rdatatype_t rdtype);
|
||||
/*%<
|
||||
* Return attributes for the given type.
|
||||
*
|
||||
* Requires:
|
||||
*\li 'rdtype' are known.
|
||||
*
|
||||
* Returns:
|
||||
*\li a bitmask consisting of the following flags.
|
||||
*/
|
||||
|
||||
/*% only one may exist for a name */
|
||||
#define DNS_RDATATYPEATTR_SINGLETON 0x00000001U
|
||||
/*% requires no other data be present */
|
||||
#define DNS_RDATATYPEATTR_EXCLUSIVE 0x00000002U
|
||||
/*% Is a meta type */
|
||||
#define DNS_RDATATYPEATTR_META 0x00000004U
|
||||
/*% Is a DNSSEC type, like RRSIG or NSEC */
|
||||
#define DNS_RDATATYPEATTR_DNSSEC 0x00000008U
|
||||
/*% Is a zone cut authority type */
|
||||
#define DNS_RDATATYPEATTR_ZONECUTAUTH 0x00000010U
|
||||
/*% Is reserved (unusable) */
|
||||
#define DNS_RDATATYPEATTR_RESERVED 0x00000020U
|
||||
/*% Is an unknown type */
|
||||
#define DNS_RDATATYPEATTR_UNKNOWN 0x00000040U
|
||||
/*% Is META, and can only be in a question section */
|
||||
#define DNS_RDATATYPEATTR_QUESTIONONLY 0x00000080U
|
||||
/*% Is META, and can NOT be in a question section */
|
||||
#define DNS_RDATATYPEATTR_NOTQUESTION 0x00000100U
|
||||
/*% Is present at zone cuts in the parent, not the child */
|
||||
#define DNS_RDATATYPEATTR_ATPARENT 0x00000200U
|
||||
/*% Can exist along side a CNAME */
|
||||
#define DNS_RDATATYPEATTR_ATCNAME 0x00000400U
|
||||
/*% Follow additional */
|
||||
#define DNS_RDATATYPEATTR_FOLLOWADDITIONAL 0x00000800U
|
||||
|
||||
dns_rdatatype_t
|
||||
dns_rdata_covers(dns_rdata_t *rdata);
|
||||
/*%<
|
||||
|
|
|
|||
|
|
@ -1914,7 +1914,7 @@ load_text(dns_loadctx_t *lctx) {
|
|||
}
|
||||
}
|
||||
|
||||
if (type == dns_rdatatype_rrsig || type == dns_rdatatype_sig) {
|
||||
if (dns_rdatatype_issig(type)) {
|
||||
covers = dns_rdata_covers(&rdata[rdcount]);
|
||||
} else {
|
||||
covers = 0;
|
||||
|
|
|
|||
|
|
@ -513,8 +513,7 @@ need_headerupdate(dns_slabheader_t *header, isc_stdtime_t now) {
|
|||
#if DNS_QPDB_LIMITLRUUPDATE
|
||||
if (header->type == dns_rdatatype_ns ||
|
||||
(header->trust == dns_trust_glue &&
|
||||
(header->type == dns_rdatatype_a ||
|
||||
header->type == dns_rdatatype_aaaa)))
|
||||
dns_rdatatype_isaddr(header->type)))
|
||||
{
|
||||
/*
|
||||
* Glue records are updated if at least DNS_QPDB_LRUUPDATE_GLUE
|
||||
|
|
|
|||
107
lib/dns/rdata.c
107
lib/dns/rdata.c
|
|
@ -2354,113 +2354,6 @@ dns_rdata_covers(dns_rdata_t *rdata) {
|
|||
return covers_sig(rdata);
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_ismeta(dns_rdatatype_t type) {
|
||||
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_META) != 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_issingleton(dns_rdatatype_t type) {
|
||||
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_SINGLETON) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_notquestion(dns_rdatatype_t type) {
|
||||
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_NOTQUESTION) !=
|
||||
0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_questiononly(dns_rdatatype_t type) {
|
||||
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_QUESTIONONLY) !=
|
||||
0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_atcname(dns_rdatatype_t type) {
|
||||
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_ATCNAME) != 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_atparent(dns_rdatatype_t type) {
|
||||
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_ATPARENT) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_followadditional(dns_rdatatype_t type) {
|
||||
if ((dns_rdatatype_attributes(type) &
|
||||
DNS_RDATATYPEATTR_FOLLOWADDITIONAL) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdataclass_ismeta(dns_rdataclass_t rdclass) {
|
||||
if (rdclass == dns_rdataclass_reserved0 ||
|
||||
rdclass == dns_rdataclass_none || rdclass == dns_rdataclass_any)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; /* Assume it is not a meta class. */
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_isdnssec(dns_rdatatype_t type) {
|
||||
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_DNSSEC) != 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_iskeymaterial(dns_rdatatype_t type) {
|
||||
return type == dns_rdatatype_dnskey || type == dns_rdatatype_cdnskey ||
|
||||
type == dns_rdatatype_cds;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_iszonecutauth(dns_rdatatype_t type) {
|
||||
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_ZONECUTAUTH) !=
|
||||
0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
dns_rdatatype_isknown(dns_rdatatype_t type) {
|
||||
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_UNKNOWN) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
dns_rdata_exists(dns_rdata_t *rdata, dns_rdatatype_t type) {
|
||||
REQUIRE(rdata != NULL);
|
||||
|
|
|
|||
|
|
@ -1569,9 +1569,7 @@ fctx_sendevents(fetchctx_t *fctx, isc_result_t result) {
|
|||
|
||||
INSIST(resp->result != ISC_R_SUCCESS ||
|
||||
dns_rdataset_isassociated(resp->rdataset) ||
|
||||
fctx->type == dns_rdatatype_any ||
|
||||
fctx->type == dns_rdatatype_rrsig ||
|
||||
fctx->type == dns_rdatatype_sig);
|
||||
dns_rdatatype_ismulti(fctx->type));
|
||||
|
||||
/*
|
||||
* Negative results must be indicated in resp->result.
|
||||
|
|
@ -5400,10 +5398,7 @@ validated(void *arg) {
|
|||
|
||||
hresp = ISC_LIST_HEAD(fctx->resps);
|
||||
if (hresp != NULL) {
|
||||
if (!negative && !chaining &&
|
||||
(fctx->type == dns_rdatatype_any ||
|
||||
fctx->type == dns_rdatatype_rrsig ||
|
||||
fctx->type == dns_rdatatype_sig))
|
||||
if (!negative && !chaining && dns_rdatatype_ismulti(fctx->type))
|
||||
{
|
||||
/*
|
||||
* Don't bind rdatasets; the caller
|
||||
|
|
@ -5625,9 +5620,7 @@ validated(void *arg) {
|
|||
|
||||
if (!ISC_LIST_EMPTY(fctx->validators)) {
|
||||
INSIST(!negative);
|
||||
INSIST(fctx->type == dns_rdatatype_any ||
|
||||
fctx->type == dns_rdatatype_rrsig ||
|
||||
fctx->type == dns_rdatatype_sig);
|
||||
INSIST(dns_rdatatype_ismulti(fctx->type));
|
||||
/*
|
||||
* Don't send a response yet - we have
|
||||
* more rdatasets that still need to
|
||||
|
|
@ -6044,9 +6037,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_message_t *message,
|
|||
* DNS_R_CNAME or DNS_R_DNAME and we must set up
|
||||
* the rdatasets.
|
||||
*/
|
||||
if ((fctx->type != dns_rdatatype_any &&
|
||||
fctx->type != dns_rdatatype_rrsig &&
|
||||
fctx->type != dns_rdatatype_sig) ||
|
||||
if (!dns_rdatatype_ismulti(fctx->type) ||
|
||||
name->attributes.chaining)
|
||||
{
|
||||
ardataset = resp->rdataset;
|
||||
|
|
@ -6295,10 +6286,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_message_t *message,
|
|||
}
|
||||
|
||||
if (ANSWER(rdataset) && need_validation) {
|
||||
if (fctx->type != dns_rdatatype_any &&
|
||||
fctx->type != dns_rdatatype_rrsig &&
|
||||
fctx->type != dns_rdatatype_sig)
|
||||
{
|
||||
if (!dns_rdatatype_ismulti(fctx->type)) {
|
||||
/*
|
||||
* This is The Answer. We will
|
||||
* validate it, but first we
|
||||
|
|
@ -6913,14 +6901,12 @@ check_section(void *arg, const dns_name_t *addname, dns_rdatatype_t type,
|
|||
rdataset != NULL;
|
||||
rdataset = ISC_LIST_NEXT(rdataset, link))
|
||||
{
|
||||
if (rdataset->type == dns_rdatatype_rrsig) {
|
||||
if (dns_rdatatype_issig(rdataset->type)) {
|
||||
rtype = rdataset->covers;
|
||||
} else {
|
||||
rtype = rdataset->type;
|
||||
}
|
||||
if (rtype == dns_rdatatype_a ||
|
||||
rtype == dns_rdatatype_aaaa)
|
||||
{
|
||||
if (dns_rdatatype_isaddr(rtype)) {
|
||||
mark_related(name, rdataset, external,
|
||||
gluing);
|
||||
}
|
||||
|
|
@ -7050,8 +7036,7 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname,
|
|||
int order;
|
||||
|
||||
REQUIRE(rdataset != NULL);
|
||||
REQUIRE(rdataset->type == dns_rdatatype_cname ||
|
||||
rdataset->type == dns_rdatatype_dname);
|
||||
REQUIRE(dns_rdatatype_isalias(rdataset->type));
|
||||
|
||||
/*
|
||||
* By default, we allow any target name.
|
||||
|
|
@ -7981,9 +7966,7 @@ rctx_answer_init(respctx_t *rctx) {
|
|||
* we treat these types as a subset of ANY.
|
||||
*/
|
||||
rctx->type = fctx->type;
|
||||
if (rctx->type == dns_rdatatype_rrsig ||
|
||||
rctx->type == dns_rdatatype_sig)
|
||||
{
|
||||
if (dns_rdatatype_issig(fctx->type)) {
|
||||
rctx->type = dns_rdatatype_any;
|
||||
}
|
||||
|
||||
|
|
@ -8676,15 +8659,13 @@ rctx_answer_any(respctx_t *rctx) {
|
|||
return ISC_R_COMPLETE;
|
||||
}
|
||||
|
||||
if ((fctx->type == dns_rdatatype_sig ||
|
||||
fctx->type == dns_rdatatype_rrsig) &&
|
||||
if (dns_rdatatype_issig(fctx->type) &&
|
||||
rdataset->type != fctx->type)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((rdataset->type == dns_rdatatype_a ||
|
||||
rdataset->type == dns_rdatatype_aaaa) &&
|
||||
if (dns_rdatatype_isaddr(rdataset->type) &&
|
||||
!is_answeraddress_allowed(fctx->res->view, rctx->aname,
|
||||
rdataset))
|
||||
{
|
||||
|
|
@ -8692,8 +8673,7 @@ rctx_answer_any(respctx_t *rctx) {
|
|||
return ISC_R_COMPLETE;
|
||||
}
|
||||
|
||||
if ((rdataset->type == dns_rdatatype_cname ||
|
||||
rdataset->type == dns_rdatatype_dname) &&
|
||||
if (dns_rdatatype_isalias(rdataset->type) &&
|
||||
!is_answertarget_allowed(fctx, fctx->name, rctx->aname,
|
||||
rdataset, NULL))
|
||||
{
|
||||
|
|
@ -8728,16 +8708,14 @@ rctx_answer_match(respctx_t *rctx) {
|
|||
return ISC_R_COMPLETE;
|
||||
}
|
||||
|
||||
if ((rctx->ardataset->type == dns_rdatatype_a ||
|
||||
rctx->ardataset->type == dns_rdatatype_aaaa) &&
|
||||
if (dns_rdatatype_isaddr(rctx->ardataset->type) &&
|
||||
!is_answeraddress_allowed(fctx->res->view, rctx->aname,
|
||||
rctx->ardataset))
|
||||
{
|
||||
rctx->result = DNS_R_SERVFAIL;
|
||||
return ISC_R_COMPLETE;
|
||||
}
|
||||
if ((rctx->ardataset->type == dns_rdatatype_cname ||
|
||||
rctx->ardataset->type == dns_rdatatype_dname) &&
|
||||
if (dns_rdatatype_isalias(rctx->ardataset->type) &&
|
||||
rctx->type != rctx->ardataset->type &&
|
||||
rctx->type != dns_rdatatype_any &&
|
||||
!is_answertarget_allowed(fctx, fctx->name, rctx->aname,
|
||||
|
|
@ -9158,7 +9136,7 @@ rctx_authority_negative(respctx_t *rctx) {
|
|||
rdataset = ISC_LIST_NEXT(rdataset, link))
|
||||
{
|
||||
dns_rdatatype_t type = rdataset->type;
|
||||
if (type == dns_rdatatype_rrsig) {
|
||||
if (dns_rdatatype_issig(rdataset->type)) {
|
||||
type = rdataset->covers;
|
||||
}
|
||||
if ((type == dns_rdatatype_ns ||
|
||||
|
|
@ -9329,7 +9307,7 @@ rctx_authority_dnssec(respctx_t *rctx) {
|
|||
bool secure_domain = false;
|
||||
dns_rdatatype_t type = rdataset->type;
|
||||
|
||||
if (type == dns_rdatatype_rrsig) {
|
||||
if (dns_rdatatype_issig(type)) {
|
||||
type = rdataset->covers;
|
||||
}
|
||||
|
||||
|
|
@ -9482,9 +9460,7 @@ rctx_referral(respctx_t *rctx) {
|
|||
* additional section that are in the answer section or if
|
||||
* the record gets dropped due to message size constraints.
|
||||
*/
|
||||
if (rctx->glue_in_answer &&
|
||||
(fctx->type == dns_rdatatype_aaaa || fctx->type == dns_rdatatype_a))
|
||||
{
|
||||
if (rctx->glue_in_answer && dns_rdatatype_isaddr(fctx->type)) {
|
||||
(void)dns_rdataset_additionaldata(
|
||||
rctx->ns_rdataset, rctx->ns_name, check_answer, fctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||
UNUSED(now);
|
||||
UNUSED(sigrdataset);
|
||||
|
||||
if (type == dns_rdatatype_sig || type == dns_rdatatype_rrsig) {
|
||||
if (dns_rdatatype_issig(type)) {
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3318,9 +3318,7 @@ rpz_find_p(ns_client_t *client, dns_name_t *self_name, dns_rdatatype_t qtype,
|
|||
}
|
||||
dns_db_detachnode(*dbp, nodep);
|
||||
|
||||
if (qtype == dns_rdatatype_rrsig ||
|
||||
qtype == dns_rdatatype_sig)
|
||||
{
|
||||
if (dns_rdatatype_issig(qtype)) {
|
||||
result = DNS_R_NXRRSET;
|
||||
} else {
|
||||
result = dns_db_findext(*dbp, p_name, *versionp,
|
||||
|
|
@ -5044,9 +5042,7 @@ qctx_init(ns_client_t *client, dns_fetchresponse_t **frespp,
|
|||
/*
|
||||
* If it's an RRSIG or SIG query, we'll iterate the node.
|
||||
*/
|
||||
if (qctx->qtype == dns_rdatatype_rrsig ||
|
||||
qctx->qtype == dns_rdatatype_sig)
|
||||
{
|
||||
if (dns_rdatatype_issig(qctx->qtype)) {
|
||||
qctx->type = dns_rdatatype_any;
|
||||
}
|
||||
|
||||
|
|
@ -5439,8 +5435,7 @@ ns__query_start(query_ctx_t *qctx) {
|
|||
*/
|
||||
if (qctx->view->root_key_sentinel &&
|
||||
qctx->client->query.restarts == 0 &&
|
||||
(qctx->qtype == dns_rdatatype_a ||
|
||||
qctx->qtype == dns_rdatatype_aaaa) &&
|
||||
(dns_rdatatype_isaddr(qctx->qtype)) &&
|
||||
(qctx->client->message->flags & DNS_MESSAGEFLAG_CD) == 0)
|
||||
{
|
||||
root_key_sentinel_detect(qctx);
|
||||
|
|
@ -6495,9 +6490,7 @@ query_resume(query_ctx_t *qctx) {
|
|||
}
|
||||
INSIST(qctx->rdataset != NULL);
|
||||
|
||||
if (qctx->qtype == dns_rdatatype_rrsig ||
|
||||
qctx->qtype == dns_rdatatype_sig)
|
||||
{
|
||||
if (dns_rdatatype_issig(qctx->qtype)) {
|
||||
qctx->type = dns_rdatatype_any;
|
||||
} else {
|
||||
qctx->type = qctx->qtype;
|
||||
|
|
@ -7735,8 +7728,7 @@ query_respond_any(query_ctx_t *qctx) {
|
|||
} else if (qctx->view->minimal_any && !TCP(qctx->client) &&
|
||||
!WANTDNSSEC(qctx->client) &&
|
||||
qctx->qtype == dns_rdatatype_any &&
|
||||
(qctx->rdataset->type == dns_rdatatype_sig ||
|
||||
qctx->rdataset->type == dns_rdatatype_rrsig))
|
||||
(dns_rdatatype_issig(qctx->rdataset->type)))
|
||||
{
|
||||
CCTRACE(ISC_LOG_DEBUG(5), "query_respond_any: "
|
||||
"minimal-any skip signature");
|
||||
|
|
@ -7781,9 +7773,7 @@ query_respond_any(query_ctx_t *qctx) {
|
|||
* Remember the first RRtype we find so we
|
||||
* can skip others with minimal-any.
|
||||
*/
|
||||
if (qctx->rdataset->type == dns_rdatatype_sig ||
|
||||
qctx->rdataset->type == dns_rdatatype_rrsig)
|
||||
{
|
||||
if (dns_rdatatype_issig(qctx->rdataset->type)) {
|
||||
onetype = qctx->rdataset->covers;
|
||||
} else {
|
||||
onetype = qctx->rdataset->type;
|
||||
|
|
@ -7847,9 +7837,7 @@ query_respond_any(query_ctx_t *qctx) {
|
|||
* At least one matching rdataset was found
|
||||
*/
|
||||
query_addauth(qctx);
|
||||
} else if (qctx->qtype == dns_rdatatype_rrsig ||
|
||||
qctx->qtype == dns_rdatatype_sig)
|
||||
{
|
||||
} else if (dns_rdatatype_issig(qctx->qtype)) {
|
||||
/*
|
||||
* No matching rdatasets were found, but we got
|
||||
* here on a search for RRSIG/SIG, so that's okay.
|
||||
|
|
@ -9918,8 +9906,7 @@ query_coveringnsec(query_ctx_t *qctx) {
|
|||
goto cleanup;
|
||||
}
|
||||
if (!ISC_LIST_EMPTY(qctx->view->dns64) &&
|
||||
(qctx->type == dns_rdatatype_a ||
|
||||
qctx->type == dns_rdatatype_aaaa)) /* XXX not yet */
|
||||
dns_rdatatype_isaddr(qctx->type)) /* XXX not yet */
|
||||
{
|
||||
goto cleanup;
|
||||
}
|
||||
|
|
@ -9978,8 +9965,7 @@ query_coveringnsec(query_ctx_t *qctx) {
|
|||
goto cleanup;
|
||||
}
|
||||
if (!ISC_LIST_EMPTY(qctx->view->dns64) &&
|
||||
(qctx->type == dns_rdatatype_a ||
|
||||
qctx->type == dns_rdatatype_aaaa)) /* XXX not yet */
|
||||
dns_rdatatype_isaddr(qctx->type)) /* XXX not yet */
|
||||
{
|
||||
goto cleanup;
|
||||
}
|
||||
|
|
@ -11329,8 +11315,7 @@ query_glueanswer(query_ctx_t *qctx) {
|
|||
|
||||
if (!ISC_LIST_EMPTY(secs[DNS_SECTION_ANSWER]) ||
|
||||
qctx->client->message->rcode != dns_rcode_noerror ||
|
||||
(qctx->qtype != dns_rdatatype_a &&
|
||||
qctx->qtype != dns_rdatatype_aaaa))
|
||||
!dns_rdatatype_isaddr(qctx->qtype))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1165,9 +1165,7 @@ temp_check(isc_mem_t *mctx, dns_diff_t *temp, dns_db_t *db,
|
|||
* this name and type */
|
||||
|
||||
*typep = type = t->rdata.type;
|
||||
if (type == dns_rdatatype_rrsig ||
|
||||
type == dns_rdatatype_sig)
|
||||
{
|
||||
if (dns_rdatatype_issig(type)) {
|
||||
covers = dns_rdata_covers(&t->rdata);
|
||||
} else if (type == dns_rdatatype_any) {
|
||||
dns_db_detachnode(db, &node);
|
||||
|
|
|
|||
|
|
@ -135,9 +135,7 @@ log_rr(dns_name_t *name, dns_rdata_t *rdata, uint32_t ttl) {
|
|||
rdl.type = rdata->type;
|
||||
rdl.rdclass = rdata->rdclass;
|
||||
rdl.ttl = ttl;
|
||||
if (rdata->type == dns_rdatatype_sig ||
|
||||
rdata->type == dns_rdatatype_rrsig)
|
||||
{
|
||||
if (dns_rdatatype_issig(rdata->type)) {
|
||||
rdl.covers = dns_rdata_covers(rdata);
|
||||
} else {
|
||||
rdl.covers = dns_rdatatype_none;
|
||||
|
|
@ -1553,9 +1551,7 @@ sendstream(xfrout_ctx_t *xfr) {
|
|||
msgrdl->type = rdata->type;
|
||||
msgrdl->rdclass = rdata->rdclass;
|
||||
msgrdl->ttl = ttl;
|
||||
if (rdata->type == dns_rdatatype_sig ||
|
||||
rdata->type == dns_rdatatype_rrsig)
|
||||
{
|
||||
if (dns_rdatatype_issig(rdata->type)) {
|
||||
msgrdl->covers = dns_rdata_covers(rdata);
|
||||
} else {
|
||||
msgrdl->covers = dns_rdatatype_none;
|
||||
|
|
|
|||
Loading…
Reference in a new issue