- Fix for #1099: Fix to check for deleted RRset when the contents

is updated and fetched after it is stored, and also check for a
  changed RRset.
This commit is contained in:
W.C.A. Wijngaards 2024-07-05 17:54:46 +02:00
parent b53d90053e
commit c8a2289542
2 changed files with 13 additions and 5 deletions

View file

@ -2,6 +2,9 @@
- Fix for neater printout for error for missing DS response. - Fix for neater printout for error for missing DS response.
- Fix neater printout. - Fix neater printout.
- Fix #1099: Unbound core dump on SIGSEGV. - Fix #1099: Unbound core dump on SIGSEGV.
- Fix for #1099: Fix to check for deleted RRset when the contents
is updated and fetched after it is stored, and also check for a
changed RRset.
4 July 2024: Wouter 4 July 2024: Wouter
- Fix to print details about the failure to lookup a DNSKEY record - Fix to print details about the failure to lookup a DNSKEY record

11
services/cache/dns.c vendored
View file

@ -96,7 +96,8 @@ store_rrsets(struct module_env* env, struct reply_info* rep, time_t now,
struct ub_packed_rrset_key* ck; struct ub_packed_rrset_key* ck;
lock_rw_rdlock(&rep->ref[i].key->entry.lock); lock_rw_rdlock(&rep->ref[i].key->entry.lock);
/* if deleted rrset, do not copy it */ /* if deleted rrset, do not copy it */
if(rep->ref[i].key->id == 0) if(rep->ref[i].key->id == 0 ||
rep->ref[i].id != rep->ref[i].key->id)
ck = NULL; ck = NULL;
else ck = packed_rrset_copy_region( else ck = packed_rrset_copy_region(
rep->ref[i].key, region, now); rep->ref[i].key, region, now);
@ -115,11 +116,15 @@ store_rrsets(struct module_env* env, struct reply_info* rep, time_t now,
} }
/* if ref was updated make sure the message ttl is updated to /* if ref was updated make sure the message ttl is updated to
* the minimum of the current rrsets. */ * the minimum of the current rrsets. */
lock_rw_rdlock(&rep->rrsets[i]->entry.lock); lock_rw_rdlock(&rep->ref[i].key->entry.lock);
if(rep->ref[i].key->id != 0 &&
rep->ref[i].id == rep->ref[i].key->id) {
/* if deleted, skip ttl update. */
ttl = ((struct packed_rrset_data*)rep->rrsets[i]->entry.data)->ttl; ttl = ((struct packed_rrset_data*)rep->rrsets[i]->entry.data)->ttl;
lock_rw_unlock(&rep->rrsets[i]->entry.lock);
if(ttl < min_ttl) min_ttl = ttl; if(ttl < min_ttl) min_ttl = ttl;
} }
lock_rw_unlock(&rep->ref[i].key->entry.lock);
}
if(min_ttl < rep->ttl) { if(min_ttl < rep->ttl) {
rep->ttl = min_ttl; rep->ttl = min_ttl;
rep->prefetch_ttl = PREFETCH_TTL_CALC(rep->ttl); rep->prefetch_ttl = PREFETCH_TTL_CALC(rep->ttl);