If we know that the header has ZEROTTL set, the server should never send
stale records for it and the TTL should never be anything else than 0.
The comment was already there, but the code was not matching the
comment.
(cherry picked from commit
cfee6aa56557f9fde8bd47949c5165edaf350113)
* (these records should not be cached anyway).
*/
- if (KEEPSTALE(qpdb) && stale_ttl > now) {
+ if (!ZEROTTL(header) && KEEPSTALE(qpdb) && stale_ttl > now) {
stale = true;
} else {
/*
rdataset->rdclass = qpdb->common.rdclass;
rdataset->type = DNS_TYPEPAIR_TYPE(header->type);
rdataset->covers = DNS_TYPEPAIR_COVERS(header->type);
+ rdataset->ttl = !ZEROTTL(header) ? header->ttl - now : 0;
rdataset->ttl = header->ttl - now;
rdataset->trust = header->trust;
rdataset->resign = 0;
* (these records should not be cached anyway).
*/
- if (KEEPSTALE(rbtdb) && stale_ttl > now) {
+ if (!ZEROTTL(header) && KEEPSTALE(rbtdb) && stale_ttl > now) {
stale = true;
} else {
/*
rdataset->rdclass = rbtdb->common.rdclass;
rdataset->type = DNS_TYPEPAIR_TYPE(header->type);
rdataset->covers = DNS_TYPEPAIR_COVERS(header->type);
- rdataset->ttl = header->ttl - now;
+ rdataset->ttl = !ZEROTTL(header) ? header->ttl - now : 0;
rdataset->trust = header->trust;
if (NEGATIVE(header)) {