From: Philip Homburg Date: Wed, 26 Apr 2023 15:11:29 +0000 (+0200) Subject: Remove msg_del_for_0ttl, call msg_cache_remove directly X-Git-Tag: release-1.18.0rc1~24^2~48^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F866%2Fhead;p=thirdparty%2Funbound.git Remove msg_del_for_0ttl, call msg_cache_remove directly --- diff --git a/services/cache/dns.c b/services/cache/dns.c index 9fbcb5f0f..11ea40b7f 100644 --- a/services/cache/dns.c +++ b/services/cache/dns.c @@ -132,26 +132,6 @@ msg_cache_remove(struct module_env* env, uint8_t* qname, size_t qnamelen, slabhash_remove(env->msg_cache, h, &k); } -/** remove servfail msg cache entry */ -static void -msg_del_for_0ttl(struct module_env* env, struct query_info* qinfo, - uint32_t flags) -{ - struct msgreply_entry* e; - /* see if there is an existing entry, and then remove it, so that - * lookups move from the cacheresponse stage to the recursionresponse - * stage */ - e = msg_cache_lookup(env, qinfo->qname, qinfo->qname_len, - qinfo->qtype, qinfo->qclass, flags, 0, 0); - if(!e) return; - /* we don't check for the ttl here, also expired entries - * are removed. If the user uses serve-expired, they would still be - * used to answer from cache */ - lock_rw_unlock(&e->entry.lock); - msg_cache_remove(env, qinfo->qname, qinfo->qname_len, qinfo->qtype, - qinfo->qclass, flags); -} - void dns_cache_store_msg(struct module_env* env, struct query_info* qinfo, hashvalue_type hash, struct reply_info* rep, time_t leeway, int pside, @@ -189,7 +169,8 @@ dns_cache_store_msg(struct module_env* env, struct query_info* qinfo, * - NODATA * - an older record that is expired * - an older record that did not yet expire */ - msg_del_for_0ttl(env, qinfo, flags); + msg_cache_remove(env, qinfo->qname, qinfo->qname_len, + qinfo->qtype, qinfo->qclass, flags); return; }