From ee59d9a894ba6d396e98becc7aa7a8484f7f0f60 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 6 May 2025 19:42:48 +0200 Subject: [PATCH] flow: fix unittests for ThreadVars requirement --- src/flow-hash.c | 2 +- src/util-unittest-helper.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/flow-hash.c b/src/flow-hash.c index 5984ad9573..fb4892d802 100644 --- a/src/flow-hash.c +++ b/src/flow-hash.c @@ -658,7 +658,7 @@ static void FlowExceptionPolicyStatsIncr( ThreadVars *tv, FlowLookupStruct *fls, enum ExceptionPolicy policy) { #ifdef UNITTESTS - if (tv == NULL) { + if (tv == NULL || fls->dtv == NULL) { return; } #endif diff --git a/src/util-unittest-helper.c b/src/util-unittest-helper.c index c1fa775255..4d56b2d377 100644 --- a/src/util-unittest-helper.c +++ b/src/util-unittest-helper.c @@ -860,6 +860,8 @@ uint32_t UTHBuildPacketOfFlows(uint32_t start, uint32_t end, uint8_t dir) { FlowLookupStruct fls; memset(&fls, 0, sizeof(fls)); + ThreadVars tv; + memset(&tv, 0, sizeof(tv)); uint32_t i = start; uint8_t payload[] = "Payload"; @@ -872,7 +874,7 @@ uint32_t UTHBuildPacketOfFlows(uint32_t start, uint32_t end, uint8_t dir) p->src.addr_data32[0] = i + 1; p->dst.addr_data32[0] = i; } - FlowHandlePacket(NULL, &fls, p); + FlowHandlePacket(&tv, &fls, p); if (p->flow != NULL) { FLOWLOCK_UNLOCK(p->flow); } -- 2.47.2