From: Hangbin Liu <hangbin.liu@linux.dev>
To: Jingjing Xu <xujingjing@cmss.chinamobile.com>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
kuba@kernel.org, edumazet@kernel.org, pabeni@redhat.com,
horms@kernel.org, shuah@kernel.org, willemb@google.com,
annaemesenyiri@gmail.com, idosch@nvidia.com
Subject: Re: [PATCH net-next 1/2] selftests: net: enable receive metadata independently of its value
Date: Mon, 23 Nov 2026 10:59:06 +0800 [thread overview]
Message-ID: <20261123025906.GC10218@Liu-laptop> (raw)
In-Reply-To: <20261122154912.1272447-1-xujingjing@cmss.chinamobile.com>
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>
prev parent reply other threads:[~2026-11-23 2:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Hangbin Liu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261123025906.GC10218@Liu-laptop \
--to=hangbin.liu@linux.dev \
--cc=annaemesenyiri@gmail.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=willemb@google.com \
--cc=xujingjing@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox