uint32_t timestamp = qry->timestamp.tv_sec;
const knot_dname_t *qname = qry->sname;
uint16_t rrtype = qry->stype;
- const bool want_secure = (qry->flags & QUERY_DNSSEC_WANT) &&
- !knot_wire_get_cd(req->answer->wire);
struct kr_cache_entry *entry = NULL;
int ret = kr_cache_peek(cache, KR_CACHE_PKT, qname,
}
/* Check that we have secure rank. */
- if (want_secure && entry->rank == KR_RANK_BAD) {
+ if (!knot_wire_get_cd(req->answer->wire) && entry->rank == KR_RANK_BAD) {
return kr_error(ENOENT);
}
/* Check if entry is insecure and setup query flags if needed. */
- if (want_secure && entry->rank == KR_RANK_INSECURE) {
+ if ((qry->flags & QUERY_DNSSEC_WANT) && entry->rank == KR_RANK_INSECURE) {
qry->flags |= QUERY_DNSSEC_INSECURE;
qry->flags &= ~QUERY_DNSSEC_WANT;
}