From: Kiran Vemula Date: Fri, 16 Jun 2023 12:04:37 +0000 (+0530) Subject: resolved: Initialize until_valid while storing negative/NXDOMAIN response in the... X-Git-Tag: v254-rc1~185 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=88c6f8f894435c38a075dd268d34f7bcc839dfd2;p=thirdparty%2Fsystemd.git resolved: Initialize until_valid while storing negative/NXDOMAIN response in the cache Initialize until_valid is properly for negative response, the cached negative responses can be used to answer the queries before contacting upstream server. --- diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c index 3f8378ae30b..9d2a2fa1acb 100644 --- a/src/resolve/resolved-dns-cache.c +++ b/src/resolve/resolved-dns-cache.c @@ -602,7 +602,7 @@ static int dns_cache_put_negative( /* Determine how long to cache this entry. In case we have some RRs in the answer use the lowest TTL * of any of them. Typically that's the SOA's TTL, which is OK, but could possibly be lower because * of some other RR. Let's better take the lowest option here than a needlessly high one */ - i->until = + i->until = i->until_valid = i->type == DNS_CACHE_RCODE ? timestamp + CACHE_TTL_STRANGE_RCODE_USEC : calculate_until_valid(soa, dns_answer_min_ttl(answer), nsec_ttl, timestamp, true);