From: Mark Andrews Date: Thu, 30 Jan 2025 22:09:33 +0000 (+1100) Subject: Fix "CNAME and other data" detection X-Git-Tag: ondrej/lock-free-qpzone-reads-v1~61^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e49a9e4ae8d0a78fb5ac0c7b683de9a29b6b848;p=thirdparty%2Fbind9.git Fix "CNAME and other data" detection prio_type was being used in the wrong place to optimize cname_and_other. We have to first exclude and accepted types and we also have to determine that the record exists before we can check if we are at a point where a later CNAME cannot appear. --- diff --git a/lib/dns/qpzone.c b/lib/dns/qpzone.c index e0ddab3bfbf..14ede511ab5 100644 --- a/lib/dns/qpzone.c +++ b/lib/dns/qpzone.c @@ -1727,15 +1727,6 @@ cname_and_other(qpznode_t *node, uint32_t serial) { for (header = node->data; header != NULL; header = header_next) { header_next = header->next; - if (!prio_type(header->type)) { - /* - * CNAME is in the priority list, so if we are done - * with priority types, we know there will not be a - * CNAME, and are safe to skip the rest. - */ - return false; - } - rdtype = DNS_TYPEPAIR_TYPE(header->type); if (rdtype == dns_rdatatype_cname) { do { @@ -1767,6 +1758,15 @@ cname_and_other(qpznode_t *node, uint32_t serial) { header = header->down; } while (header != NULL); if (header != NULL) { + if (!prio_type(header->type)) { + /* + * CNAME is in the priority list, so if + * we are done with priority types, we + * know there will not be a CNAME, and + * are safe to skip the rest. + */ + return cname; + } other = true; } }