netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ulogd2] nfct: fix counter-reset without hashtable
@ 2025-03-25  0:24 Corubba Smith
  2025-03-25  5:56 ` Florian Westphal
  0 siblings, 1 reply; 4+ messages in thread
From: Corubba Smith @ 2025-03-25  0:24 UTC (permalink / raw)
  To: netfilter-devel

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>
---
 input/flow/ulogd_inpflow_NFCT.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/input/flow/ulogd_inpflow_NFCT.c b/input/flow/ulogd_inpflow_NFCT.c
index 93edb76..cdda741 100644
--- a/input/flow/ulogd_inpflow_NFCT.c
+++ b/input/flow/ulogd_inpflow_NFCT.c
@@ -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);
--
2.49.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-25 10:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25  0:24 [PATCH ulogd2] nfct: fix counter-reset without hashtable Corubba Smith
2025-03-25  5:56 ` Florian Westphal
2025-03-25  9:20   ` Corubba Smith
2025-03-25 10:35     ` Florian Westphal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).