break;
case KNOT_RRTYPE_DS:
VERBOSE_MSG(qry, "<= parent: updating DS\n");
- if (qry->flags & QUERY_DNSSEC_INSECURE) { /* DS non-existence proven. */
+ if (qry->flags & (QUERY_DNSSEC_NODS | QUERY_DNSSEC_INSECURE)) { /* DS non-existence proven. */
mark_insecure_parents(qry);
} else { /* DS existence proven. */
parent->zone_cut.trust_anchor = knot_rrset_copy(qry->zone_cut.trust_anchor, parent->zone_cut.pool);
qry->flags |= QUERY_DNSSEC_BOGUS;
} else {
VERBOSE_MSG(qry, "<= DS doesn't exist, going insecure\n");
- qry->flags &= ~QUERY_DNSSEC_WANT;
- qry->flags |= QUERY_DNSSEC_INSECURE;
+ qry->flags |= QUERY_DNSSEC_NODS;
}
return ret;
}
if (ret != 0) {
if (has_nsec3 && (ret == kr_error(DNSSEC_OUT_OF_RANGE))) {
VERBOSE_MSG(qry, "<= can't prove NODATA due to optout, going insecure\n");
- qry->flags &= ~QUERY_DNSSEC_WANT;
- qry->flags |= QUERY_DNSSEC_INSECURE;
+ qry->flags |= QUERY_DNSSEC_NODS;
/* Could not return from here,
* we must continue, validate NSEC\NSEC3 and
* call update_parent_keys() to mark
return KR_STATE_FAIL;
} else if (pkt_rcode == KNOT_RCODE_NOERROR &&
referral &&
- ((qry->flags & (QUERY_DNSSEC_WANT | QUERY_DNSSEC_INSECURE)) == QUERY_DNSSEC_INSECURE)) {
+ (((qry->flags & (QUERY_DNSSEC_WANT | QUERY_DNSSEC_INSECURE)) == QUERY_DNSSEC_INSECURE) ||
+ (qry->flags & QUERY_DNSSEC_NODS))) {
/* referral with proven DS non-existance */
qtype = KNOT_RRTYPE_DS;
}
/* It can occur that here parent query already have
* provably insecured zonecut which not in the cache yet. */
+ const uint32_t insec_flags = QUERY_DNSSEC_INSECURE | QUERY_DNSSEC_NODS;
+ const uint32_t cut_flags = QUERY_AWAIT_IPV4 | QUERY_AWAIT_IPV6;
const bool is_insecured = ((qry->parent != NULL) &&
- (qry->parent->flags & (QUERY_AWAIT_IPV4 | QUERY_AWAIT_IPV6)) == 0 &&
- (qry->parent->flags & QUERY_DNSSEC_INSECURE) != 0);
+ (qry->parent->flags & cut_flags) == 0 &&
+ (qry->parent->flags & insec_flags) != 0);
/* Want DNSSEC if it's possible to secure this name
* (e.g. is covered by any TA) */
X(REORDER_RR, 1 << 24) /**< Reorder cached RRs. */ \
X(TRACE, 1 << 25) /**< Log answer with kr_verbose_log(), unless -DNDEBUG. */ \
X(NO_0X20, 1 << 26) /**< Disable query case randomization . */ \
+ X(DNSSEC_NODS, 1 << 27) /**< DS non-existance is proven */ \
/* 1 << 31 Used by ../modules/dns64/dns64.lua */
/** Query flags */