From: Vladimír Čunát Date: Thu, 11 Mar 2021 14:23:28 +0000 (+0100) Subject: dnstap: don't break request resolution on dnstap errors X-Git-Tag: v5.3.1~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=060349c9;p=thirdparty%2Fknot-resolver.git dnstap: don't break request resolution on dnstap errors This isn't a regression of 5.3.0 changes. Layer functions are supposed to return new values for ctx->state, but here we were sometimes returning kr_error(EFOO) which altered processing of the request. Our case: answers directly from policy module would not end up finishing the request and we'd hit an assert at the end of processing. --- diff --git a/NEWS b/NEWS index 0498a5aeb..5fba50776 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,14 @@ -Knot Resolver 5.y.z (2021-0m-dd) +Knot Resolver 5.3.1 (2021-03-dd) ================================ Improvements ------------ - doh2: send HTTP error status codes (#618, !1102) +Bugfixes +-------- +- dnstap module: don't break request resolution on dnstap errors (!1147) + Knot Resolver 5.3.0 (2021-02-25) ================================ diff --git a/modules/dnstap/dnstap.c b/modules/dnstap/dnstap.c index 9dcb7bba1..6dd6f9512 100644 --- a/modules/dnstap/dnstap.c +++ b/modules/dnstap/dnstap.c @@ -93,7 +93,10 @@ static void set_address(const struct sockaddr *sockaddr, *has_port = true; } -/* dnstap_log prepares dnstap message and sends it to fstrm */ +/* dnstap_log prepares dnstap message and sends it to fstrm + * + * Return codes are kr_error(E*) and unused for now. + */ static int dnstap_log(kr_layer_t *ctx, enum dnstap_log_phase phase) { const struct kr_request *req = ctx->req; const struct kr_module *module = ctx->api->data; @@ -101,7 +104,7 @@ static int dnstap_log(kr_layer_t *ctx, enum dnstap_log_phase phase) { const struct dnstap_data *dnstap_dt = module->data; if (!req->qsource.addr) { - return ctx->state; + return kr_ok(); } /* check if we have a valid iothread */ @@ -232,17 +235,19 @@ static int dnstap_log(kr_layer_t *ctx, enum dnstap_log_phase phase) { return kr_error(EBUSY); } - return ctx->state; + return kr_ok(); } /* dnstap_log_query prepares dnstap CLIENT_QUERY message and sends it to fstrm */ static int dnstap_log_query(kr_layer_t *ctx) { - return dnstap_log(ctx, CLIENT_QUERY_PHASE); + dnstap_log(ctx, CLIENT_QUERY_PHASE); + return ctx->state; } /* dnstap_log_response prepares dnstap CLIENT_RESPONSE message and sends it to fstrm */ static int dnstap_log_response(kr_layer_t *ctx) { - return dnstap_log(ctx, CLIENT_RESPONSE_PHASE); + dnstap_log(ctx, CLIENT_RESPONSE_PHASE); + return ctx->state; } KR_EXPORT