Merge branch 'ondrej/various-rbtdb-fixes-9.18' into 'bind-9.18'
[9.18] Fix missing RRSIG for CNAME with different slabheader order See merge request isc-projects/bind9!8704
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
6338. [func] Optimize slabheader placement, so the infrastructure
|
||||
records are put in the beginning of the slabheader
|
||||
linked list. [GL !8675]
|
||||
|
||||
6334. [doc] Improve ARM parental-agents definition. [GL #4531]
|
||||
|
||||
6333. [bug] Fix the DNS_GETDB_STALEFIRST flag, which was defined
|
||||
|
||||
@@ -606,10 +606,10 @@ dig_with_opts @10.53.0.5 fetchall.tld any >dig.out.2.${n} || ret=1
|
||||
ttl2=$(awk '/"A" "short" "ttl"/ { print $2 }' dig.out.2.${n})
|
||||
sleep 1
|
||||
# check that prefetch occurred;
|
||||
# note that only one record is prefetched, which is the TXT record in this case,
|
||||
# note that only one record is prefetched, which is the AAAA record in this case,
|
||||
# because of the order of the records in the cache
|
||||
dig_with_opts @10.53.0.5 fetchall.tld any >dig.out.3.${n} || ret=1
|
||||
ttl3=$(awk '/"A" "short" "ttl"/ { print $2 }' dig.out.3.${n})
|
||||
ttl3=$(awk '/::1/ { print $2 }' dig.out.3.${n})
|
||||
test "${ttl3:-0}" -gt "${ttl2:-1}" || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
|
||||
+61
-11
@@ -906,6 +906,30 @@ set_ttl(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, dns_ttl_t newttl) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
prio_type(rbtdb_rdatatype_t type) {
|
||||
switch (type) {
|
||||
case dns_rdatatype_soa:
|
||||
case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_soa):
|
||||
case dns_rdatatype_a:
|
||||
case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_a):
|
||||
case dns_rdatatype_aaaa:
|
||||
case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_aaaa):
|
||||
case dns_rdatatype_nsec:
|
||||
case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec):
|
||||
case dns_rdatatype_nsec3:
|
||||
case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec3):
|
||||
case dns_rdatatype_ns:
|
||||
case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ns):
|
||||
case dns_rdatatype_ds:
|
||||
case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_ds):
|
||||
case dns_rdatatype_cname:
|
||||
case RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_cname):
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*%
|
||||
* These functions allow the heap code to rank the priority of each
|
||||
* element. It returns true if v1 happens "sooner" than v2.
|
||||
@@ -5086,13 +5110,18 @@ cache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
|
||||
*/
|
||||
found = header;
|
||||
if (header->type == dns_rdatatype_cname &&
|
||||
cname_ok && cnamesig != NULL)
|
||||
cname_ok)
|
||||
{
|
||||
/*
|
||||
* If we've already got the
|
||||
* CNAME RRSIG, use it.
|
||||
*/
|
||||
foundsig = cnamesig;
|
||||
if (cnamesig != NULL) {
|
||||
foundsig = cnamesig;
|
||||
} else {
|
||||
sigtype =
|
||||
RBTDB_RDATATYPE_SIGCNAME;
|
||||
}
|
||||
}
|
||||
} else if (header->type == sigtype) {
|
||||
/*
|
||||
@@ -6019,7 +6048,7 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
||||
static bool
|
||||
cname_and_other_data(dns_rbtnode_t *node, rbtdb_serial_t serial) {
|
||||
rdatasetheader_t *header, *header_next;
|
||||
bool cname, other_data;
|
||||
bool cname = false, other_data = false;
|
||||
dns_rdatatype_t rdtype;
|
||||
|
||||
/*
|
||||
@@ -6029,10 +6058,16 @@ cname_and_other_data(dns_rbtnode_t *node, rbtdb_serial_t serial) {
|
||||
/*
|
||||
* Look for CNAME and "other data" rdatasets active in our version.
|
||||
*/
|
||||
cname = false;
|
||||
other_data = false;
|
||||
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 the priority list, we know there will not be
|
||||
* CNAME, so we are safe to skip the rest of the types.
|
||||
*/
|
||||
return (false);
|
||||
}
|
||||
if (header->type == dns_rdatatype_cname) {
|
||||
/*
|
||||
* Look for an active extant CNAME.
|
||||
@@ -6092,10 +6127,9 @@ cname_and_other_data(dns_rbtnode_t *node, rbtdb_serial_t serial) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cname && other_data) {
|
||||
return (true);
|
||||
if (cname && other_data) {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
@@ -6167,6 +6201,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, const dns_name_t *nodename,
|
||||
rbtdb_changed_t *changed = NULL;
|
||||
rdatasetheader_t *topheader = NULL, *topheader_prev = NULL;
|
||||
rdatasetheader_t *header = NULL, *sigheader = NULL;
|
||||
rdatasetheader_t *prioheader = NULL;
|
||||
unsigned char *merged = NULL;
|
||||
isc_result_t result;
|
||||
bool header_nx;
|
||||
@@ -6313,6 +6348,9 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, const dns_name_t *nodename,
|
||||
for (topheader = rbtnode->data; topheader != NULL;
|
||||
topheader = topheader->next)
|
||||
{
|
||||
if (prio_type(topheader->type)) {
|
||||
prioheader = topheader;
|
||||
}
|
||||
if (topheader->type == newheader->type ||
|
||||
topheader->type == negtype)
|
||||
{
|
||||
@@ -6679,9 +6717,21 @@ find_header:
|
||||
/*
|
||||
* No rdatasets of the given type exist at the node.
|
||||
*/
|
||||
newheader->next = rbtnode->data;
|
||||
newheader->down = NULL;
|
||||
rbtnode->data = newheader;
|
||||
|
||||
if (prio_type(newheader->type)) {
|
||||
/* This is a priority type, prepend it */
|
||||
newheader->next = rbtnode->data;
|
||||
rbtnode->data = newheader;
|
||||
} else if (prioheader != NULL) {
|
||||
/* Append after the priority headers */
|
||||
newheader->next = prioheader->next;
|
||||
prioheader->next = newheader;
|
||||
} else {
|
||||
/* There were no priority headers */
|
||||
newheader->next = rbtnode->data;
|
||||
rbtnode->data = newheader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user