]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- For #1411: Fix that the lookup for DNAME uses flag. Fix assertion
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 3 Mar 2026 16:44:31 +0000 (17:44 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 3 Mar 2026 16:44:31 +0000 (17:44 +0100)
  in expired calc debug routine.

doc/Changelog
services/cache/dns.c
util/data/msgparse.c

index 878bcab895cc3eabdc044f57203b5529ef48033f..4d7ea443301a8cb3d2754e71c2dc48fbdfd0b174 100644 (file)
@@ -4,6 +4,8 @@
          a 1-second grace period. Reduces recursion when authoritative
          servers return DNAME with TTL=0 (RFC 2308). Response
          still returns TTL=0 to clients. Adds a test for it.
+       - For #1411: Fix that the lookup for DNAME uses flag. Fix assertion
+         in expired calc debug routine.
 
 27 February 2026: Wouter
        - Merge #1409: Documentation CNAME in redirect-type local-zone.
index b2ceb012f45b6a40a0415375a5df554c67a9606e..c593dcd72ceb7177aa21505337f65158038361b8 100644 (file)
@@ -232,8 +232,15 @@ find_closest_of_type(struct module_env* env, uint8_t* qname, size_t qnamelen,
 
        /* snip off front part of qname until the type is found */
        while(qnamelen > 0) {
-               if((rrset = rrset_cache_lookup(env->rrset_cache, qname, 
-                       qnamelen, searchtype, qclass, 0, now, 0))) {
+               rrset = rrset_cache_lookup(env->rrset_cache, qname,
+                       qnamelen, searchtype, qclass, 0, now, 0);
+               if(!rrset && searchtype == LDNS_RR_TYPE_DNAME)
+                       /* If not found, for type DNAME, try 0TTL stored,
+                        * for its grace period. */
+                       rrset = rrset_cache_lookup(env->rrset_cache, qname,
+                               qnamelen, searchtype, qclass,
+                               PACKED_RRSET_UPSTREAM_0TTL, now, 0);
+               if(rrset) {
                        uint8_t* origqname = qname;
                        size_t origqnamelen = qnamelen;
                        if(!noexpiredabove)
index fc7018def6c8a4af994a05610157c5a6fb3142ef..afbcbca5bc9d75c15533bd7e9c92959498b90e9d 100644 (file)
@@ -1366,7 +1366,9 @@ msgparse_rrset_remove_rr(const char* str, sldns_buffer* pkt, struct rrset_parse*
 time_t debug_expired_reply_ttl_calc(time_t ttl, time_t ttl_add) {
        /* Check that we are serving expired when this is called */
        /* ttl (absolute) should be later than ttl_add */
-       log_assert(SERVE_EXPIRED && ttl_add <= ttl);
+       /* It is also called during the grace period for type DNAME,
+        * and then the 'SERVE_EXPIRED' boolean may not be on. */
+       log_assert(ttl_add <= ttl);
        return (SERVE_EXPIRED_REPLY_TTL < (ttl) - (ttl_add) ?
                SERVE_EXPIRED_REPLY_TTL : (ttl) - (ttl_add));
 }