All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] selftests: net: enable receive metadata independently of its value
@ 2026-11-22 15:49 Jingjing Xu
  2026-11-22 15:49 ` [PATCH net-next 2/2] selftests: net: cover zero receive mark and priority Jingjing Xu
  2026-11-23  2:59 ` [PATCH net-next 1/2] selftests: net: enable receive metadata independently of its value Hangbin Liu
  0 siblings, 2 replies; 4+ messages in thread
From: Jingjing Xu @ 2026-11-22 15:49 UTC (permalink / raw)
  To: netdev
  Cc: linux-kselftest, kuba, edumazet, pabeni, horms, shuah, willemb,
	annaemesenyiri, idosch

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 <xujingjing@cmss.chinamobile.com>
---
 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




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-23  2:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 15:49 [PATCH net-next 1/2] selftests: net: enable receive metadata independently of its value Jingjing Xu
2026-11-22 15:49 ` [PATCH net-next 2/2] selftests: net: cover zero receive mark and priority Jingjing Xu
2026-11-23  2:44   ` Hangbin Liu
2026-11-23  2:59 ` [PATCH net-next 1/2] selftests: net: enable receive metadata independently of its value Hangbin Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.