From: Michal Luczaj <[email protected]>

[ Upstream commit 65f46946e951373275d793b35129a7c3ebeaaf51 ]

Update sockmap_basic tests to bind sockets before they are used. This
accommodates the recent change in sockmap that rejects unbound UDP sockets.

Signed-off-by: Michal Luczaj <[email protected]>
Reviewed-by: Kuniyuki Iwashima <[email protected]>
Reviewed-by: Jakub Sitnicki <[email protected]>
Link: 
https://lore.kernel.org/bpf/[email protected]
Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]>
Signed-off-by: Ricardo B. Marlière (SUSE) <[email protected]>
---
 tools/testing/selftests/bpf/prog_tests/sockmap_basic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c 
b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
index d2846579285f..b4019d1a5575 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
@@ -807,7 +807,7 @@ static void test_sockmap_many_socket(void)
                return;
        }
 
-       udp = xsocket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
+       udp = socket_loopback(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK);
        if (udp < 0) {
                close(dgram);
                close(tcp);
@@ -876,7 +876,7 @@ static void test_sockmap_many_maps(void)
                return;
        }
 
-       udp = xsocket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
+       udp = socket_loopback(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK);
        if (udp < 0) {
                close(dgram);
                close(tcp);
@@ -947,7 +947,7 @@ static void test_sockmap_same_sock(void)
                return;
        }
 
-       udp = xsocket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
+       udp = socket_loopback(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK);
        if (udp < 0) {
                close(dgram);
                close(tcp);

-- 
2.55.0


Reply via email to