flags |= BIT_AA;
flags &= ~BIT_AD;
}
- log_assert(flags & BIT_QR); /* QR bit must be on in our replies */
+ log_assert((flags & BIT_QR)); /* QR bit must be on in our replies */
+ if(cached_ttl && rep->ttl - timenow == 0) {
+ /* The last remaining second of the TTL for a cached response
+ * is replied. This makes a 0 in the protocol message. The
+ * response is valid for the cache, but the DNS TTL 0 item
+ * causes the received to drop the contents. Even though the
+ * contents are cachable, so the time used is decremented
+ * to change that into 1 second, and it can be cached, and
+ * used for expired response generation, and does not give
+ * repeated queries during that last second. */
+ timenow --;
+ }
if(udpsize < LDNS_HEADER_SIZE)
return 0;
/* currently edns does not change during calculations;