From: Hangbin Liu <hangbin.liu@linux.dev>
To: Andrea Mayer <andrea.mayer@uniroma2.it>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>, Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org, bpf@vger.kernel.org,
David Lebrun <david.lebrun@uclouvain.be>,
Daniel Borkmann <daniel@iogearbox.net>,
Mathieu Xhonneux <m.xhonneux@gmail.com>,
David Lebrun <dlebrun@google.com>,
Stefano Salsano <stefano.salsano@uniroma2.it>,
Andrea Mayer <andrea@common-net.org>
Subject: Re: [PATCH net 6/6] selftests: seg6: add test for skb checksum with CHECKSUM_COMPLETE
Date: Tue, 3 Nov 2026 11:26:35 +0800 [thread overview]
Message-ID: <aulUayPCDOYwAm1e@fedora> (raw)
In-Reply-To: <20261031225033.64-7-andrea.mayer@uniroma2.it>
Hi Andrea,
On Sat, Oct 31, 2026 at 11:50:33PM +0100, Andrea Mayer wrote:
> Add a selftest for received packets with CHECKSUM_COMPLETE that the SRv6
> code processes before they are delivered on the same node. The test checks
> that, after the node changes the packet, UDP does not read a wrong
> skb->csum.
>
> The test uses a host and a router connected through a veth pair. Since veth
> does not provide CHECKSUM_COMPLETE, a tc ct action on the router computes
> skb->csum in software.
>
> The host sends a UDP datagram to the router along five paths: no SRH (the
> reference), an SRH with local segments, End.B6.Encaps with End.DT6, End
> with the next-csid flavor, and End.BPF. Each datagram is expected to be
> delivered, not dropped as a checksum error. Without the previous patches,
> every path except the reference fails. With them, every path passes.
>
> The host also sends a control datagram. It checks that the test detects a
> wrong skb->csum after a change to the packet. After the ct action, a BPF
> program on the router changes the Flow Label of the control datagram
> without updating skb->csum, and UDP must drop it. If UDP accepts it, the
> paths above may report a false pass, and the test fails.
>
> Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
> ---
> tools/testing/selftests/net/Makefile | 1 +
> .../selftests/net/srv6_csum_complete.bpf.c | 65 ++
> .../selftests/net/srv6_csum_complete_test.sh | 642 ++++++++++++++++++
> 3 files changed, 708 insertions(+)
> create mode 100644 tools/testing/selftests/net/srv6_csum_complete.bpf.c
> create mode 100755 tools/testing/selftests/net/srv6_csum_complete_test.sh
>
[...]
> +
> +log_test()
> +{
> + log_test_expected "$1" "$2" "$3"
> +}
We'd better use log_test_expected directly, otherwise the log_test in
lib.sh will be overwrite.
> +
> +test_command_or_ksft_skip()
> +{
> + local cmd="$1"
> +
> + if [ ! -x "$(command -v "${cmd}")" ]; then
> + echo "SKIP: Could not run test without \"${cmd}\" tool"
> + exit "${ksft_skip}"
> + fi
> +}
Then we can use require_command() in lib.sh here, which will call
log_test() in lib.sh.
[...]
> +
> +if [ "$(id -u)" -ne 0 ]; then
> + echo "SKIP: Need root privileges"
> + exit "${ksft_skip}"
> +fi
I wonder if there is any one run the selftest with none root privileges.
Cause almost all the selftests need ip configurations.
Thanks
Hangbin
prev parent reply other threads:[~2026-11-03 3:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 22:50 [PATCH net 0/6] seg6: fix skb checksum updates " Andrea Mayer
2026-10-31 22:50 ` [PATCH net 1/6] seg6: fix skb checksum update helpers Andrea Mayer
2026-11-03 1:25 ` Hangbin Liu
2026-10-31 22:50 ` [PATCH net 2/6] seg6: update skb checksum when ipv6_srh_rcv() decrements the Hop Limit Andrea Mayer
2026-11-03 1:27 ` Hangbin Liu
2026-10-31 22:50 ` [PATCH net 3/6] seg6: update skb checksum when SRv6 behaviors advance to the next SID Andrea Mayer
2026-11-03 2:15 ` Hangbin Liu
2026-10-31 22:50 ` [PATCH net 4/6] seg6: discard CHECKSUM_COMPLETE after the End.BPF program Andrea Mayer
2026-11-03 2:28 ` Hangbin Liu
2026-10-31 22:50 ` [PATCH net 5/6] seg6: account for the MAC header in skb checksum on L2 encapsulation Andrea Mayer
2026-11-03 2:37 ` Hangbin Liu
2026-10-31 22:50 ` [PATCH net 6/6] selftests: seg6: add test for skb checksum with CHECKSUM_COMPLETE Andrea Mayer
2026-11-03 3:26 ` 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=aulUayPCDOYwAm1e@fedora \
--to=hangbin.liu@linux.dev \
--cc=andrea.mayer@uniroma2.it \
--cc=andrea@common-net.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=david.lebrun@uclouvain.be \
--cc=dlebrun@google.com \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=m.xhonneux@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=stefano.salsano@uniroma2.it \
/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
all inboxes | Powered by JetHome®