*
* \def DNS_RDATASETATTR_LOADORDER
* Output the RRset in load order.
+ *
+ * \def DNS_RDATASETATTR_STALE_ADDED
+ * Set on rdatasets that were added during a stale-answer-client-timeout
+ * lookup. In other words, the RRset was added during a lookup of stale
+ * data and does not necessarily mean that the rdataset itself is stale.
*/
#define DNS_RDATASETATTR_NONE 0x00000000 /*%< No ordering. */
dns_ttl_t stale_refresh = 0;
bool dbfind_stale = false;
bool stale_timeout = false;
+ bool answer_found = false;
bool stale_found = false;
bool stale_refresh_window = false;
uint16_t ede = 0;
*/
stale_timeout = ((dboptions & DNS_DBFIND_STALETIMEOUT) != 0);
+ if (dns_rdataset_isassociated(qctx->rdataset) &&
+ dns_rdataset_count(qctx->rdataset) > 0 && !STALE(qctx->rdataset))
+ {
+ /* Found non-stale usable rdataset. */
+ answer_found = true;
+ goto gotanswer;
+ }
+
if (dbfind_stale || stale_refresh_window || stale_timeout) {
dns_name_format(qctx->client->query.qname, namebuf,
sizeof(namebuf));
}
}
- if (stale_timeout && stale_found) {
+gotanswer:
+ if (stale_timeout && (answer_found || stale_found)) {
/*
* Mark RRsets that we are adding to the client message on a
* lookup during 'stale-answer-client-timeout', so we can