Skip to content
Snippets Groups Projects
Verified Commit 060349c9 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

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.
parent 4079a1a9
Branches
Tags v5.3.0
1 merge request!1147dnstap: don't break request resolution on dnstap errors
Pipeline #77994 failed with stages
in 1 hour, 1 minute, and 41 seconds
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)
================================
......
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment