* [PATCH net-next] selftests: net: reuseport_addr_any: report epoll_wait timeouts honestly
@ 2026-11-20 6:58 Omokefe Emmanuel Onanaroghene
2026-11-23 5:38 ` Hangbin Liu
0 siblings, 1 reply; 2+ messages in thread
From: Omokefe Emmanuel Onanaroghene @ 2026-11-20 6:58 UTC (permalink / raw)
To: netdev, linux-kselftest
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, linux-kernel, skhan,
Omokefe Emmanuel Onanaroghene
receive_once() waits 3ms for a packet but only checks for errors
(i < 0). On timeout (i == 0) it falls through and uses ev.data.fd
uninitialized. recv() on a garbage fd fails with a misleading
"failed to recv" (or worse, blocks or returns a bogus fd). Report
the timeout for what it is; errnum 0, since epoll_wait sets no
errno on timeout.
Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
---
tools/testing/selftests/net/reuseport_addr_any.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/net/reuseport_addr_any.c b/tools/testing/selftests/net/reuseport_addr_any.c
index 1c43401a1c807..2e8aa83f68dd0 100644
--- a/tools/testing/selftests/net/reuseport_addr_any.c
+++ b/tools/testing/selftests/net/reuseport_addr_any.c
@@ -155,6 +155,8 @@ static int receive_once(int epfd, int proto)
i = epoll_wait(epfd, &ev, 1, 3);
if (i < 0)
error(1, errno, "epoll_wait failed");
+ if (i == 0)
+ error(1, 0, "epoll_wait timed out waiting for packet");
if (proto == SOCK_STREAM) {
fd = accept(ev.data.fd, NULL, NULL);
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH net-next] selftests: net: reuseport_addr_any: report epoll_wait timeouts honestly
2026-11-20 6:58 [PATCH net-next] selftests: net: reuseport_addr_any: report epoll_wait timeouts honestly Omokefe Emmanuel Onanaroghene
@ 2026-11-23 5:38 ` Hangbin Liu
0 siblings, 0 replies; 2+ messages in thread
From: Hangbin Liu @ 2026-11-23 5:38 UTC (permalink / raw)
To: Omokefe Emmanuel Onanaroghene
Cc: netdev, linux-kselftest, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
linux-kernel, skhan
On Fri, Nov 20, 2026 at 07:58:55AM +0100, Omokefe Emmanuel Onanaroghene wrote:
> receive_once() waits 3ms for a packet but only checks for errors
> (i < 0). On timeout (i == 0) it falls through and uses ev.data.fd
> uninitialized. recv() on a garbage fd fails with a misleading
> "failed to recv" (or worse, blocks or returns a bogus fd). Report
> the timeout for what it is; errnum 0, since epoll_wait sets no
> errno on timeout.
>
> Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
> ---
> tools/testing/selftests/net/reuseport_addr_any.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/net/reuseport_addr_any.c b/tools/testing/selftests/net/reuseport_addr_any.c
> index 1c43401a1c807..2e8aa83f68dd0 100644
> --- a/tools/testing/selftests/net/reuseport_addr_any.c
> +++ b/tools/testing/selftests/net/reuseport_addr_any.c
> @@ -155,6 +155,8 @@ static int receive_once(int epfd, int proto)
> i = epoll_wait(epfd, &ev, 1, 3);
> if (i < 0)
> error(1, errno, "epoll_wait failed");
> + if (i == 0)
> + error(1, 0, "epoll_wait timed out waiting for packet");
>
> if (proto == SOCK_STREAM) {
> fd = accept(ev.data.fd, NULL, NULL);
> --
> 2.43.0
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 5:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 6:58 [PATCH net-next] selftests: net: reuseport_addr_any: report epoll_wait timeouts honestly Omokefe Emmanuel Onanaroghene
2026-11-23 5:38 ` Hangbin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®