Skip to content
Snippets Groups Projects
Commit d50a9ad9 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

daemon: servfail queries without RD=1

parent 3ce551ef
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,11 @@ static int input_query(knot_layer_t *ctx, knot_pkt_t *pkt)
return KNOT_NS_PROC_NOOP; /* Ignore. */
}
/* No authoritative service. */
if (!knot_wire_get_rd(pkt->wire)) {
return KNOT_NS_PROC_FAIL;
}
return KNOT_NS_PROC_FULL;
}
......@@ -64,6 +69,12 @@ static int output_answer(knot_layer_t *ctx, knot_pkt_t *pkt)
return KNOT_NS_PROC_DONE;
}
static int output_error(knot_layer_t *ctx, knot_pkt_t *pkt)
{
knot_wire_set_rcode(pkt->wire, KNOT_RCODE_SERVFAIL);
return KNOT_NS_PROC_DONE;
}
/*! \brief Module implementation. */
static const knot_layer_api_t LAYER_QUERY_MODULE = {
&begin,
......@@ -71,7 +82,7 @@ static const knot_layer_api_t LAYER_QUERY_MODULE = {
&reset,
&input_query,
&output_answer,
NULL
&output_error
};
const knot_layer_api_t *layer_query_module(void)
......
......@@ -81,7 +81,7 @@ int worker_exec(struct worker_ctx *worker, knot_pkt_t *answer, knot_pkt_t *query
int state = knot_layer_in(&proc, query);
/* Build an answer. */
if (state == KNOT_NS_PROC_FULL) {
if (state & (KNOT_NS_PROC_FULL|KNOT_NS_PROC_FAIL)) {
knot_pkt_init_response(answer, query);
state = knot_layer_out(&proc, answer);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment