🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Jingjing Xu Sun, 22 Nov 2026 15:49
[PATCH net-next 1/2] selftests: net: enable receive metadata independently of its value
#20455
Author: Jingjing Xu
Date: Sun, 22 Nov 2026 15:49
45 lines
10003 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")
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
Re: [PATCH net-next 1/2] selftests: net: enable receive metadata independently of its value
#20674
Author: Hangbin Liu
Date: Mon, 23 Nov 2026 02:59
51 lines
10174 bytes
On Sun, Nov 22, 2026 at 03:49:11PM +0000, Jingjing Xu wrote:
> 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
> 
> 
> 

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
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