From b937e1afefe065ce7489b1455fccf99c5ad3f0d0 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Sun, 17 Dec 2017 11:58:59 +0100 Subject: [PATCH] util-ebpf: fix ipv6 cleaning and add comments --- src/util-ebpf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util-ebpf.c b/src/util-ebpf.c index 48c9e6c349..d3d26220eb 100644 --- a/src/util-ebpf.c +++ b/src/util-ebpf.c @@ -246,13 +246,17 @@ static int EBPFForEachFlowV4Table(const char *name, for (i = 0; i < nr_cpus; i++) { int ret = FlowCallback(mapfd, &key, &values_array[i], data); if (ret) { + /* no packet for the flow on this CPU, let's start accumulating + value we can compute the counters */ pkts_cnt += values_array[i].packets; bytes_cnt += values_array[i].bytes; } else { + /* Packet seen on one CPU so we keep the flow */ iret = 0; break; } } + /* No packet seen, we discard the flow and do accounting */ if (iret) { flowstats->count++; flowstats->packets += pkts_cnt; @@ -273,7 +277,6 @@ static int EBPFForEachFlowV6Table(const char *name, { int mapfd = EBPFGetMapFDByName(name); struct flowv6_keys key = {}, next_key; - struct pair value = {0, 0, 0}; int found = 0; unsigned int i; unsigned int nr_cpus = UtilCpuGetNumProcessorsConfigured(); -- 2.47.2