Commit 4176d278 authored by Mukund Sivaraman's avatar Mukund Sivaraman

Fix inconsistencies in inline signing time comparisons (#42112)

parent f7c66b31
4599. [bug] Fix inconsistencies in inline signing time
comparison that were introduced with the
introduction of rdatasetheader->resign_lsb.
[RT #42112]
4598. [func] Update fuzzing code to (1) reply to a DNSKEY
query from named with appropriate DNSKEY used in
fuzzing; (2) patch the QTYPE correctly in
......
......@@ -662,7 +662,7 @@ struct dns_rbtdb {
* context to use for the heap (which differs from the main
* database memory context in the case of a cache).
*/
isc_mem_t * hmctx;
isc_mem_t *hmctx;
isc_heap_t **heaps;
/*
......@@ -1076,9 +1076,7 @@ ttl_sooner(void *v1, void *v2) {
rdatasetheader_t *h1 = v1;
rdatasetheader_t *h2 = v2;
if (h1->rdh_ttl < h2->rdh_ttl)
return (ISC_TRUE);
return (ISC_FALSE);
return (ISC_TF(h1->rdh_ttl < h2->rdh_ttl));
}
static isc_boolean_t
......@@ -1086,10 +1084,9 @@ resign_sooner(void *v1, void *v2) {
rdatasetheader_t *h1 = v1;
rdatasetheader_t *h2 = v2;
if (h1->resign < h2->resign ||
(h1->resign == h2->resign && h1->resign_lsb < h2->resign_lsb))
return (ISC_TRUE);
return (ISC_FALSE);
return (ISC_TF(h1->resign < h2->resign ||
(h1->resign == h2->resign &&
h1->resign_lsb < h2->resign_lsb)));
}
/*%
......@@ -6172,7 +6169,8 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion,
update_newheader(newheader, header);
if (loading && RESIGN(newheader) &&
RESIGN(header) &&
header->resign < newheader->resign) {
resign_sooner(header, newheader))
{
newheader->resign = header->resign;
newheader->resign_lsb =
header->resign_lsb;
......@@ -7253,7 +7251,9 @@ rbt_datafixer(dns_rbtnode_t *rbtnode, void *base, size_t filesize,
header->node = rbtnode;
header->node_is_relative = 0;
if (rbtdb != NULL && RESIGN(header) && header->resign != 0) {
if (rbtdb != NULL && RESIGN(header) &&
(header->resign != 0 || header->resign_lsb != 0))
{
int idx = header->node->locknum;
result = isc_heap_insert(rbtdb->heaps[idx], header);
if (result != ISC_R_SUCCESS)
......@@ -7889,7 +7889,7 @@ setsigningtime(dns_db_t *db, dns_rdataset_t *rdataset, isc_stdtime_t resign) {
NODE_LOCK(&rbtdb->node_locks[header->node->locknum].lock,
isc_rwlocktype_write);
oldresign = header->resign;
oldresign = (header->resign << 1) | header->resign_lsb;
header->resign = (isc_stdtime_t)(dns_time64_from32(resign) >> 1);
header->resign_lsb = resign & 0x1;
if (header->heap_index != 0) {
......@@ -7937,7 +7937,7 @@ getsigningtime(dns_db_t *db, dns_rdataset_t *rdataset,
}
if (header == NULL)
header = this;
else if (isc_serial_lt(this->resign, header->resign)) {
else if (resign_sooner(this, header)) {
locknum = header->node->locknum;
NODE_UNLOCK(&rbtdb->node_locks[locknum].lock,
isc_rwlocktype_read);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment