]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util-ebpf: fix loop on maps
authorEric Leblond <eric@regit.org>
Sat, 8 Dec 2018 07:21:44 +0000 (08:21 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 18 Jun 2019 05:07:01 +0000 (07:07 +0200)
We were missing the last element of the map by working on previous
key instead of current key.

src/util-ebpf.c

index 70e359189cf49cc51cc3180da841463657962fa7..1aa19d96decd5db13a19a446c31733443a8b61df 100644 (file)
@@ -401,7 +401,7 @@ static int EBPFForEachFlowV4Table(LiveDevice *dev, const char *name,
          * is 1 then we have a global hash. */
         struct pair values_array[tcfg->cpus_count];
         memset(values_array, 0, sizeof(values_array));
-        int res = bpf_map_lookup_elem(mapfd, &key, values_array);
+        int res = bpf_map_lookup_elem(mapfd, &next_key, values_array);
         if (res < 0) {
             SCLogDebug("no entry in v4 table for %d -> %d", key.port16[0], key.port16[1]);
             SCLogDebug("errno: (%d) %s", errno, strerror(errno));
@@ -487,7 +487,7 @@ static int EBPFForEachFlowV6Table(LiveDevice *dev, const char *name,
          * is 1 then we have a global hash. */
         struct pair values_array[tcfg->cpus_count];
         memset(values_array, 0, sizeof(values_array));
-        int res = bpf_map_lookup_elem(mapfd, &key, values_array);
+        int res = bpf_map_lookup_elem(mapfd, &next_key, values_array);
         if (res < 0) {
             SCLogDebug("no entry in v4 table for %d -> %d", key.port16[0], key.port16[1]);
             key = next_key;