From: Daniel Salzman Date: Fri, 22 Oct 2021 10:58:20 +0000 (+0200) Subject: mod-cookies: add 'dropped' statistics counter X-Git-Tag: v3.3.dev~300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcff219339455f4b37b76f3a955213c8a8a48796;p=thirdparty%2Fknot-dns.git mod-cookies: add 'dropped' statistics counter --- diff --git a/src/knot/modules/cookies/cookies.c b/src/knot/modules/cookies/cookies.c index ae9b61d327..fbc9c9eb22 100644 --- a/src/knot/modules/cookies/cookies.c +++ b/src/knot/modules/cookies/cookies.c @@ -195,6 +195,7 @@ static knotd_state_t cookies_process(knotd_state_t state, knot_pkt_t *pkt, if (ATOMIC_GET(ctx->badcookie_ctr) > BADCOOKIE_CTR_INIT) { // Silently drop the response. update_ctr(ctx); + knotd_mod_stats_incr(mod, qdata->params->thread_id, 1, 0, 1); return KNOTD_STATE_NOOP; } else { if (ctx->badcookie_slip > 1) { @@ -250,6 +251,12 @@ int cookies_load(knotd_mod_t *mod) return ret; } + ret = knotd_mod_stats_add(mod, "dropped", 1, NULL); + if (ret != KNOT_EOK) { + free(ctx); + return ret; + } + // Store module context before rollover thread is created. knotd_mod_ctx_set(mod, ctx); diff --git a/src/knot/modules/cookies/cookies.rst b/src/knot/modules/cookies/cookies.rst index 7594080083..b04f092c37 100644 --- a/src/knot/modules/cookies/cookies.rst +++ b/src/knot/modules/cookies/cookies.rst @@ -11,8 +11,10 @@ by the presence of a correct cookie. Both the server and the client have to support DNS Cookies, otherwise they are not used. .. NOTE:: - This module introduces a statistics counter: the number of queries - containing the COOKIE option. + This module introduces two statistics counters: + + - ``presence`` – The number of queries containing the COOKIE option. + - ``dropped`` – The number of dropped queries due to the slip limit. .. WARNING:: For effective module operation the :ref:`RRL` module must also