From ad15f25b336fb4c392c8962c6778359b309cb509 Mon Sep 17 00:00:00 2001 From: Peter Haag Date: Sun, 10 Nov 2024 15:01:17 +0100 Subject: [PATCH] Fix flow counter in sort list. #575 --- src/nfdump/nflowcache.c | 12 +++++++++--- src/nfpcapd/nfpcapd.c | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/nfdump/nflowcache.c b/src/nfdump/nflowcache.c index 4003836d..dbb41216 100755 --- a/src/nfdump/nflowcache.c +++ b/src/nfdump/nflowcache.c @@ -1610,9 +1610,15 @@ static inline void PrintSortList(SortElement_t *SortList, uint64_t maxindex, out genericFlow->tcpFlags = flowRecord->inFlags; EXcntFlow_t tmpCntFlow = {0}; - if (cntFlow == NULL && (flowRecord->flows > 1 || flowRecord->outPackets)) { - recordHandle.extensionList[EXcntFlowID] = &tmpCntFlow; - cntFlow = &tmpCntFlow; + if (cntFlow == NULL) { + if (flowRecord->flows > 1 || flowRecord->outPackets) { + recordHandle.extensionList[EXcntFlowID] = &tmpCntFlow; + cntFlow = &tmpCntFlow; + cntFlow->outPackets = flowRecord->outPackets; + cntFlow->outBytes = flowRecord->outBytes; + cntFlow->flows = flowRecord->flows; + } + } else { cntFlow->outPackets = flowRecord->outPackets; cntFlow->outBytes = flowRecord->outBytes; cntFlow->flows = flowRecord->flows; diff --git a/src/nfpcapd/nfpcapd.c b/src/nfpcapd/nfpcapd.c index 99577cdd..4d2284e6 100755 --- a/src/nfpcapd/nfpcapd.c +++ b/src/nfpcapd/nfpcapd.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "config.h"