so_rcv_listener passes the expected mark or priority to setsockopt() as its SO_RCVMARK or SO_RCVPRIORITY enable flag. Consequently, expecting zero also disables the ancillary message being tested. A zero mark or priority is valid, but invoking the listener with -M 0 or -P 0 fails with ENOMSG. Use a separate nonzero flag to enable reception and keep opt.val solely for checking the received value. This issue was found with AI-assisted source review and reproduced using real UDP sockets. Zero and nonzero mark/priority tests pass over IPv4 and IPv6 after the fix; the zero cases fail on the original helper. No kernel instrumentation or fault injection was used. Fixes: c935af429ec2 ("selftests: net: add support for testing SO_RCVMARK and SO_RCVPRIORITY") Signed-off-by: Jingjing Xu --- tools/testing/selftests/net/so_rcv_listener.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/so_rcv_listener.c b/tools/testing/selftests/net/so_rcv_listener.c index bc5841192aa6..3d43fa688338 100644 --- a/tools/testing/selftests/net/so_rcv_listener.c +++ b/tools/testing/selftests/net/so_rcv_listener.c @@ -65,6 +65,7 @@ static void parse_args(int argc, char *argv[]) int main(int argc, char *argv[]) { + int enable = 1; int err = 0; int recv_fd = -1; int ret_value = 0; @@ -88,7 +89,7 @@ int main(int argc, char *argv[]) goto cleanup; } - err = setsockopt(recv_fd, SOL_SOCKET, opt.rcvname, &opt.val, sizeof(opt.val)); + err = setsockopt(recv_fd, SOL_SOCKET, opt.rcvname, &enable, sizeof(enable)); if (err < 0) { perror("Recv setsockopt error"); ret_value = -errno; base-commit: 2208ab00f4f213ade91ab775e7f8c4dacdcc856e -- 2.53.0