From: Eric Leblond Date: Sun, 17 Dec 2017 10:58:59 +0000 (+0100) Subject: util-ebpf: fix ipv6 cleaning and add comments X-Git-Tag: suricata-4.1.0-beta1~214 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b937e1afefe065ce7489b1455fccf99c5ad3f0d0;p=thirdparty%2Fsuricata.git util-ebpf: fix ipv6 cleaning and add comments --- 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();