]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix wrong response ttl for prepended short CNAME ttls, this would
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 19 Sep 2019 14:29:51 +0000 (16:29 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 19 Sep 2019 14:29:51 +0000 (16:29 +0200)
  create a wrong zero_ttl response count with serve-expired enabled.

doc/Changelog
iterator/iterator.c

index 8c7562dabfd0cf3a62dcd0a5cf790ba7cbb7044a..347b465366bd85cc4d41c7dcda3d7a9d42a96987 100644 (file)
@@ -5,6 +5,8 @@
        - oss-fuzz badge on README.md.
        - Fix fix for #78 to also free service callback struct.
        - Fix for oss-fuzz build warning.
+       - Fix wrong response ttl for prepended short CNAME ttls, this would
+         create a wrong zero_ttl response count with serve-expired enabled.
 
 11 September 2019: Wouter
        - Use explicit bzero for wiping clear buffer of hash in cachedb,
index c906c271448316fdd7ba920e5b4be71e215f6c99..1e0113a8740ffd6e2b6d7d5cce93944981776e0b 100644 (file)
@@ -409,6 +409,8 @@ iter_prepend(struct iter_qstate* iq, struct dns_msg* msg,
        num_an = 0;
        for(p = iq->an_prepend_list; p; p = p->next) {
                sets[num_an++] = p->rrset;
+               if(ub_packed_rrset_ttl(p->rrset) < msg->rep->ttl)
+                       msg->rep->ttl = ub_packed_rrset_ttl(p->rrset);
        }
        memcpy(sets+num_an, msg->rep->rrsets, msg->rep->an_numrrsets *
                sizeof(struct ub_packed_rrset_key*));
@@ -421,6 +423,8 @@ iter_prepend(struct iter_qstate* iq, struct dns_msg* msg,
                        msg->rep->ns_numrrsets, p->rrset))
                        continue;
                sets[msg->rep->an_numrrsets + num_an + num_ns++] = p->rrset;
+               if(ub_packed_rrset_ttl(p->rrset) < msg->rep->ttl)
+                       msg->rep->ttl = ub_packed_rrset_ttl(p->rrset);
        }
        memcpy(sets + num_an + msg->rep->an_numrrsets + num_ns, 
                msg->rep->rrsets + msg->rep->an_numrrsets,