task->retry.data = task;
task->timeout.data = task;
task->on_complete = NULL;
+ task->req.qsource.key = NULL;
+ task->req.qsource.addr = NULL;
/* Remember query source addr */
if (addr) {
size_t addr_len = sizeof(struct sockaddr_in);
return ret;
}
}
- /* Set AD=1 if succeeded and requested secured answer. */
struct kr_rplan *rplan = &request->rplan;
+ /* Always set SERVFAIL for bogus answers. */
+ if (state == KNOT_STATE_FAIL && rplan->pending.len > 0) {
+ struct kr_query *last = array_tail(rplan->pending);
+ if ((last->flags & QUERY_DNSSEC_WANT) && (last->flags & QUERY_DNSSEC_BOGUS)) {
+ knot_wire_set_rcode(answer->wire,KNOT_RCODE_SERVFAIL);
+ }
+ }
+ /* Set AD=1 if succeeded and requested secured answer. */
if (state == KNOT_STATE_DONE && rplan->resolved.len > 0) {
struct kr_query *last = array_tail(rplan->resolved);
/* Do not set AD for RRSIG query, as we can't validate it. */
request->options = ctx->options;
request->state = KNOT_STATE_CONSUME;
request->current_query = NULL;
- request->qsource.key = NULL;
- request->qsource.addr = NULL;
array_init(request->authority);
array_init(request->additional);