[EXPERIMENT] Fix "Consider non-stale data with serve-stale"

Commit 86a80e72 fixed an issue dealing with CNAME records where the CNAME in cache has become stale, but the target record is still valid. However, when in serve-stale mode the valid target record was not considered.

The fix introduced some bad side effects where if a valid target record was used when in serve-stale mode, the required attributes were no longer set.

Specifically when we are dealing with a stale-answer-client-timeout, we are adding the RRset to the client message, whether the RRset is stale or valid doesn't matter. But we do want to know that we have added RRsets during the stale-answer-client-timeout lookup, because when we resume from recursion we can clean it up.

Closes #3678 (closed)

Merge request reports