map: fix return code check for bpf_map_get_next_key calls
authorFelix Fietkau <nbd@nbd.name>
Tue, 7 Mar 2023 20:50:12 +0000 (21:50 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 7 Mar 2023 20:50:15 +0000 (21:50 +0100)
It can now apparently return -2 instead of -1.
Fixes an infinite loop on startup

Signed-off-by: Felix Fietkau <nbd@nbd.name>
map.c

diff --git a/map.c b/map.c
index 4b381555ef072a7f40b576e966f3d4365d92eef2..4785cc597abe8e3d9e049a622c8f9d88ea02ce92 100644 (file)
--- a/map.c
+++ b/map.c
@@ -142,7 +142,7 @@ static void qosify_map_clear_list(enum qosify_map_id id)
        int fd = qosify_map_fds[id];
        __u32 key[4] = {};
 
-       while (bpf_map_get_next_key(fd, &key, &key) != -1)
+       while (bpf_map_get_next_key(fd, &key, &key) == 0)
                bpf_map_delete_elem(fd, &key);
 }