This fixes tests for hints, in particular.
const uint32_t qflags = qry->flags;
uint8_t rank = 0;
if (qflags & QUERY_CACHED) {
- assert(rr->additional);
- rank = *(uint8_t *)rr->additional;
- } else if (answer) {
+ rank = rr->additional ? *(uint8_t *)rr->additional : KR_RANK_OMIT;
+ /* ^^ Current use case for "cached" RRs without rank: hints module. */
+ } else if (answer || rr->type == KNOT_RRTYPE_DS
+ || rr->type == KNOT_RRTYPE_NSEC || rr->type == KNOT_RRTYPE_NSEC3) {
+ /* TODO: this classifier of authoritativity may not be perfect yet. */
rank |= KR_RANK_AUTH;
}
return (uint8_t)rank;