Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Jingjing Xu
Wed, 25 Nov 2026 06:41
[PATCH net-next v2 2/3] selftests: net: enable receive metadata independently of its value
Author: Jingjing Xu
Date: Wed, 25 Nov 2026 06:41
Date: Wed, 25 Nov 2026 06:41
47 lines
10400 bytes
10400 bytes
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")
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Signed-off-by: Jingjing Xu <xujingjing@cmss.chinamobile.com>
---
tools/testing/selftests/net/so_rcv_listener.c | 4 +++-
1 file changed, 3 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..a57fff256cc2 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,8 @@ 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: 57f165ff2f30491bc3511d24a52ca516751a268b
--
2.53.0
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads