bpf, selftests: Fix test_maps now that sockmap supports UDP
authorJohn Fastabend <john.fastabend@gmail.com>
Tue, 20 Jul 2021 18:48:32 +0000 (11:48 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 20 Jul 2021 20:18:51 +0000 (13:18 -0700)
UDP socket support was added recently so testing UDP insert failure is no
longer correct and causes test_maps failure. The fix is easy though, we
simply need to test that UDP is correctly added instead of blocked.

Fixes: 122e6c79efe1c ("sock_map: Update sock type checks for UDP")
Reported-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210720184832.452430-1-john.fastabend@gmail.com
tools/testing/selftests/bpf/test_maps.c

index d832d135211cc592b0c967a10cdc3387fc7cb5fd..5a8e069e64faeefe54a9757c2b5636c599d9207e 100644 (file)
@@ -764,8 +764,8 @@ static void test_sockmap(unsigned int tasks, void *data)
        udp = socket(AF_INET, SOCK_DGRAM, 0);
        i = 0;
        err = bpf_map_update_elem(fd, &i, &udp, BPF_ANY);
-       if (!err) {
-               printf("Failed socket SOCK_DGRAM allowed '%i:%i'\n",
+       if (err) {
+               printf("Failed socket update SOCK_DGRAM '%i:%i'\n",
                       i, udp);
                goto out_sockmap;
        }