]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests/bpf: Support SOCK_STREAM in unix_inet_redir_to_connected()
authorMichal Luczaj <mhal@rbox.co>
Sat, 13 Jul 2024 19:41:39 +0000 (21:41 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 17 Jul 2024 20:51:45 +0000 (22:51 +0200)
Function ignores the AF_UNIX socket type argument, SOCK_DGRAM is hardcoded.
Fix to respect the argument provided.

Fixes: 75e0e27db6cf ("selftest/bpf: Change udp to inet in some function names")
Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Jakub Sitnicki <jakub@cloudflare.com>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/20240713200218.2140950-3-mhal@rbox.co
tools/testing/selftests/bpf/prog_tests/sockmap_listen.c

index e91b593660301838ed9c553c62630bfe68ebd8bd..c075d376fcabfd02ec7d90b2d7e45cf41a4a0f92 100644 (file)
@@ -1828,7 +1828,7 @@ static void unix_inet_redir_to_connected(int family, int type,
        if (err)
                return;
 
-       if (socketpair(AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0, sfd))
+       if (socketpair(AF_UNIX, type | SOCK_NONBLOCK, 0, sfd))
                goto close_cli0;
        c1 = sfd[0], p1 = sfd[1];
 
@@ -1840,7 +1840,6 @@ static void unix_inet_redir_to_connected(int family, int type,
 close_cli0:
        xclose(c0);
        xclose(p0);
-
 }
 
 static void unix_inet_skb_redir_to_connected(struct test_sockmap_listen *skel,