]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
mod-cookies: add 'dropped' statistics counter
authorDaniel Salzman <daniel.salzman@nic.cz>
Fri, 22 Oct 2021 10:58:20 +0000 (12:58 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Fri, 22 Oct 2021 11:00:08 +0000 (13:00 +0200)
src/knot/modules/cookies/cookies.c
src/knot/modules/cookies/cookies.rst

index ae9b61d32745841834463cc3de2cb50cb09907c0..fbc9c9eb22ffbf404beca9b8bfe8f2f6c6975ff1 100644 (file)
@@ -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);
 
index 7594080083796aa31440040c795afdf6259f16aa..b04f092c3759b007532784881ee24b3a9d479ce6 100644 (file)
@@ -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<mod-rrl>` module must also