From: Yorgos Thessalonikefs Date: Fri, 5 Jul 2024 17:58:19 +0000 (+0200) Subject: - Don't check for message TTL changes if the RRsets remain the same. X-Git-Tag: release-1.21.0rc1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02f4446833a4b9b167fff9134318b354e73ad9d6;p=thirdparty%2Funbound.git - Don't check for message TTL changes if the RRsets remain the same. --- diff --git a/doc/Changelog b/doc/Changelog index c184ac22b..150817308 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +5 July 2024: Yorgos + - Don't check for message TTL changes if the RRsets remain the same. + 5 July 2024: Wouter - Fix for neater printout for error for missing DS response. - Fix neater printout. diff --git a/services/cache/dns.c b/services/cache/dns.c index ff434ed4c..426c4506e 100644 --- a/services/cache/dns.c +++ b/services/cache/dns.c @@ -113,17 +113,18 @@ store_rrsets(struct module_env* env, struct reply_info* rep, time_t now, /* fallthrough */ case 1: /* ref updated, item inserted */ rep->rrsets[i] = rep->ref[i].key; - } - /* if ref was updated make sure the message ttl is updated to - * the minimum of the current rrsets. */ - 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) { + /* ref was updated; make sure the message ttl is + * updated to the minimum of the current rrsets. */ + lock_rw_rdlock(&rep->ref[i].key->entry.lock); /* if deleted, skip ttl update. */ - ttl = ((struct packed_rrset_data*)rep->rrsets[i]->entry.data)->ttl; - if(ttl < min_ttl) min_ttl = ttl; + if(rep->ref[i].key->id != 0 && + rep->ref[i].id == rep->ref[i].key->id) { + ttl = ((struct packed_rrset_data*) + rep->rrsets[i]->entry.data)->ttl; + if(ttl < min_ttl) min_ttl = ttl; + } + lock_rw_unlock(&rep->ref[i].key->entry.lock); } - lock_rw_unlock(&rep->ref[i].key->entry.lock); } if(min_ttl < rep->ttl) { rep->ttl = min_ttl;