mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 01:08:13 -04:00
selftests/bpf: Ensure UDP sockets are bound
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 <mhal@rbox.co> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com> Link: https://lore.kernel.org/bpf/20260707-sockmap-lookup-udp-leak-v4-1-f878346f27ab@rbox.co Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
This commit is contained in:
committed by
Kumar Kartikeya Dwivedi
parent
7cbd0c4ceb
commit
fe3ff27376
@@ -853,7 +853,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);
|
||||
@@ -922,7 +922,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);
|
||||
@@ -993,7 +993,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);
|
||||
|
||||
Reference in New Issue
Block a user