From 2dac9b119a800a3e18c080f00d1a6d1e6ab92e56 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Fri, 15 Apr 2022 15:50:43 +0000 Subject: [PATCH] Remove reduntant checks of 'rdclass' in catz.c We check the `rdclass` to be of type IN in `dns_catz_update_process()` function, and all the other static functions where similar checks exist are called after (and in the result of) that function being called, so they are effectively redundant. (cherry picked from commit 84d3aba4f3e87cd293e765b9ba5b070d4156cdce) --- lib/dns/catz.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/dns/catz.c b/lib/dns/catz.c index 3b55a552ce..70a1251559 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -1034,10 +1034,6 @@ catz_process_zones(dns_catz_zone_t *zone, dns_rdataset_t *value, REQUIRE(DNS_RDATASET_VALID(value)); REQUIRE(ISC_MAGIC_VALID(name, DNS_NAME_MAGIC)); - if (value->rdclass != dns_rdataclass_in) { - return (ISC_R_FAILURE); - } - if (name->labels == 0) { return (ISC_R_FAILURE); } @@ -1073,8 +1069,7 @@ catz_process_coo(dns_catz_zone_t *zone, dns_label_t *mhash, return (ISC_R_FAILURE); } - if (value->rdclass != dns_rdataclass_in || - value->type != dns_rdatatype_ptr) { + if (value->type != dns_rdatatype_ptr) { return (ISC_R_FAILURE); } @@ -1145,8 +1140,7 @@ catz_process_zones_entry(dns_catz_zone_t *zone, dns_rdataset_t *value, dns_rdata_ptr_t ptr; dns_catz_entry_t *entry = NULL; - if (value->rdclass != dns_rdataclass_in || - value->type != dns_rdatatype_ptr) { + if (value->type != dns_rdatatype_ptr) { return (ISC_R_FAILURE); } @@ -1211,8 +1205,7 @@ catz_process_version(dns_catz_zone_t *zone, dns_rdataset_t *value) { REQUIRE(DNS_CATZ_ZONE_VALID(zone)); REQUIRE(DNS_RDATASET_VALID(value)); - if (value->rdclass != dns_rdataclass_in || - value->type != dns_rdatatype_txt) { + if (value->type != dns_rdatatype_txt) { return (ISC_R_FAILURE); } @@ -1311,10 +1304,6 @@ catz_process_primaries(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl, * - label and IN A/IN AAAA * - label and IN TXT - TSIG key name */ - if (value->rdclass != dns_rdataclass_in) { - return (ISC_R_FAILURE); - } - if (name->labels > 0) { isc_sockaddr_t sockaddr; size_t i; @@ -1478,8 +1467,7 @@ catz_process_apl(dns_catz_zone_t *zone, isc_buffer_t **aclbp, REQUIRE(DNS_RDATASET_VALID(value)); REQUIRE(dns_rdataset_isassociated(value)); - if (value->rdclass != dns_rdataclass_in || - value->type != dns_rdatatype_apl) { + if (value->type != dns_rdatatype_apl) { return (ISC_R_FAILURE); }