]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
nfct: fix counter-reset without hashtable
authorCorubba Smith <corubba@gmx.de>
Tue, 25 Mar 2025 00:24:04 +0000 (01:24 +0100)
committerFlorian Westphal <fw@strlen.de>
Tue, 25 Mar 2025 10:16:38 +0000 (11:16 +0100)
In event mode the hashtable is optional, and sending SIGUSR2 to ulogd will
call get_ctr_zero().

The dump_reset_handler will try to update the hashtable regardless of
whether it is used (and thus initialized), which results in a segfault
if it isn't. Instead just short-circuit the handler, and skip any
further result processing because it's not used in this case anyway.
All flow counters in conntrack are reset regardless of the return value
of the handler/callback.

Signed-off-by: Corubba Smith <corubba@gmx.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
input/flow/ulogd_inpflow_NFCT.c

index 93edb7682daf6790204371e34cef10690cb81c35..cdda74131749c727dfe07e015db190acc8bae4c4 100644 (file)
@@ -989,6 +989,9 @@ dump_reset_handler(enum nf_conntrack_msg_type type,
        int ret = NFCT_CB_CONTINUE, rc, id;
        struct ct_timestamp *ts;
 
+       if (!cpi->ct_active)
+               return NFCT_CB_STOP;
+
        switch(type) {
        case NFCT_T_UPDATE:
                id = hashtable_hash(cpi->ct_active, ct);