selftests/bpf: Fix invalid flag of recv()
SOCK_NONBLOCK flag is only effective during socket creation, not during recv. Use MSG_DONTWAIT instead. Signed-off-by: Jiayuan Chen <mrpre@163.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Acked-by: Jakub Sitnicki <jakub@cloudflare.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://patch.msgid.link/20250122100917.49845-5-mrpre@163.com
This commit is contained in:
parent
5459cce6bf
commit
a0c1114950
1 changed files with 3 additions and 3 deletions
|
@ -522,8 +522,8 @@ static void test_sockmap_skb_verdict_shutdown(void)
|
||||||
if (!ASSERT_EQ(err, 1, "epoll_wait(fd)"))
|
if (!ASSERT_EQ(err, 1, "epoll_wait(fd)"))
|
||||||
goto out_close;
|
goto out_close;
|
||||||
|
|
||||||
n = recv(c1, &b, 1, SOCK_NONBLOCK);
|
n = recv(c1, &b, 1, MSG_DONTWAIT);
|
||||||
ASSERT_EQ(n, 0, "recv_timeout(fin)");
|
ASSERT_EQ(n, 0, "recv(fin)");
|
||||||
out_close:
|
out_close:
|
||||||
close(c1);
|
close(c1);
|
||||||
close(p1);
|
close(p1);
|
||||||
|
@ -628,7 +628,7 @@ static void test_sockmap_skb_verdict_fionread(bool pass_prog)
|
||||||
ASSERT_EQ(avail, expected, "ioctl(FIONREAD)");
|
ASSERT_EQ(avail, expected, "ioctl(FIONREAD)");
|
||||||
/* On DROP test there will be no data to read */
|
/* On DROP test there will be no data to read */
|
||||||
if (pass_prog) {
|
if (pass_prog) {
|
||||||
recvd = recv_timeout(c1, &buf, sizeof(buf), SOCK_NONBLOCK, IO_TIMEOUT_SEC);
|
recvd = recv_timeout(c1, &buf, sizeof(buf), MSG_DONTWAIT, IO_TIMEOUT_SEC);
|
||||||
ASSERT_EQ(recvd, sizeof(buf), "recv_timeout(c0)");
|
ASSERT_EQ(recvd, sizeof(buf), "recv_timeout(c0)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue