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>,
David Ahern <dsahern@kernel.org>, Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
Justin Iurman <justin.iurman@gmail.com>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
Ahmed Abdelsalam <ahabdels@cisco.com>,
Stefano Salsano <stefano.salsano@uniroma2.it>,
andrea@common-net.org
Subject: Re: [PATCH net-next v2 5/5] selftests: seg6: add tests for PSP with a consumed SRH
Date: Thu, 5 Nov 2026 17:24:10 +0800 [thread overview]
Message-ID: <auxLOoW97AQ55QdH@fedora> (raw)
In-Reply-To: <20261105015715.57-6-andrea.mayer@uniroma2.it>
Hi Andrea,
On Thu, Nov 05, 2026 at 02:57:15AM +0100, Andrea Mayer wrote:
> Extend srv6_end_flavors_test.sh with tests for the SRv6 End behavior
> with the PSP flavor, alone and together with NEXT-C-SID, on packets that
> carry a consumed SRH in front of the SRH to process.
>
> Each test sends a ping along an existing SRv6 Policy, and a router on
> the path inserts an extra SRH in front of the Policy's SRH. An End
> behavior on another router consumes the extra SRH, and the router
> connected to the host must then remove only the Policy's SRH.
>
> These tests set seg6_enabled to 1 on the hosts, which must accept the
> extra SRH, and set it back to 0 at the end. With seg6_enabled set to 1,
> a host also accepts the packet when the Policy's SRH is not removed, or
> when the extra SRH is removed in its place. For this reason, the
> receiving host accepts the echo request only when its first SRH is the
> extra SRH, with Segments Left 0 and followed by the ICMPv6 header. Any
> other echo request is dropped, including one without any SRH. The extra
> SRH is recognized by its last segment, which is the SID that triggered
> its insertion.
>
> The check on the receiving host uses the ip6tables srh match. Without
> it, these tests are skipped. A test fails if the route that inserts the
> extra SRH, or the rules on the receiving host, cannot be added.
>
> Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
> ---
> tools/testing/selftests/net/config | 1 +
> .../selftests/net/srv6_end_flavors_test.sh | 280 +++++++++++++++++-
> 2 files changed, 279 insertions(+), 2 deletions(-)
>
[...]
> +
> +# Test a Policy with a consumed SRH: a router inserts the extra SRH on the
> +# packets towards a SID, and another router consumes it. The destination host
> +# accepts only the echo requests that carry the extra SRH alone.
> +# args:
> +# $1 - router that inserts the extra SRH
> +# $2 - SID that triggers the insertion
> +# $3 - router with the SRv6 End behavior that consumes the extra SRH
> +# $4 - source host
> +# $5 - destination host
> +# $6 - suffix of the address on the loopback of the destination host
> +# (i.e. cafe::<host>:<suffix>), if any
> +check_and_log_consumed_srh()
> +{
> + local rt="$1"
> + local sid="$2"
> + local end_rt="$3"
> + local hssrc="$4"
> + local hsdst="$5"
> + local suffix="$6"
> + local msg
> +
> + if ! ${HAS_SRH_MATCH}; then
> + msg="IPv6 Hosts connectivity: hs-${hssrc} -> hs-${hsdst}"
> + if [ -n "${suffix}" ]; then
> + msg="${msg} (${IPv6_HS_NETWORK}::${hsdst}:${suffix})"
> + fi
> + log_test_skipped "${msg}"
> + return
> + fi
> +
> + if ! setup_rt_consumed_srh "${rt}" "${sid}" "${end_rt}"; then
> + log_test 1 0 "Extra SRH on rt-${rt} for ${sid}"
> + return
> + fi
> +
> + if ! setup_hs_srh_check "${hsdst}" "${sid}"; then
> + log_test 1 0 "SRH check on hs-${hsdst} for ${sid}"
> + elif [ -n "${suffix}" ]; then
> + check_and_log_hs_lo_addr_connectivity "${hssrc}" "${hsdst}" \
> + "${suffix}"
> + else
> + check_and_log_hs_connectivity "${hssrc}" "${hsdst}"
> + fi
> +
> + cleanup_hs_srh_check "${hsdst}"
> + cleanup_rt_consumed_srh "${rt}" "${sid}"
> +}
> +
> +host_srv6_end_flv_consumed_srh_tests()
> +{
> + local sid
> +
> + log_section \
> + "SRv6 connectivity test hosts (h1 <-> h2, PSP with a consumed SRH)"
> +
> + if ! ${HAS_SRH_MATCH}; then
> + echo "SKIP: ip6tables srh match not available"
> + fi
Ah, forgot to say. We can return directly here if srh match not available.
There is no need to check $HAS_SRH_MATCH again in each
check_and_log_consumed_srh() testing.
Not need to update for another version if you don't plan to change other
stuff.
Thanks
Hangbin
> +
> + set_hs_seg6_enabled 1
> +
> + # Policy (i.a): rt-4 inserts the extra SRH consumed by rt-3
> + sid="${LOCATOR_SERVICE}:2::${END_PSP_FUNC}"
> + check_and_log_consumed_srh 4 "${sid}" 3 1 2
> +
> + # Policy (i.b): rt-2 inserts the extra SRH consumed by rt-3
> + sid="${LOCATOR_SERVICE}:1::${END_PSP_FUNC}"
> + check_and_log_consumed_srh 2 "${sid}" 3 2 1
> +
> + # Policy (i.c): rt-4 inserts the extra SRH consumed by rt-3
> + sid="$(build_csid_container 2 "${END_CSID_PSP_FUNC}")"
> + check_and_log_consumed_srh 4 "${sid}" 3 1 2 "${END_CSID_PSP_FUNC}"
> +
> + # Policy (i.d): rt-3 inserts the extra SRH consumed by rt-4
> + sid="$(build_csid_container 1 "${END_CSID_PSP_FUNC}")"
> + check_and_log_consumed_srh 3 "${sid}" 4 2 1 "${END_CSID_PSP_FUNC}"
> +
> + set_hs_seg6_enabled 0
> +}
prev parent reply other threads:[~2026-11-05 9:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 1:57 [PATCH net-next v2 0/5] seg6: fixes for the PSP flavor of SRv6 End Andrea Mayer
2026-11-05 1:57 ` [PATCH net-next v2 1/5] seg6: handle a Fragment or AH header before the SRH consistently in PSP Andrea Mayer
2026-11-05 1:57 ` [PATCH net-next v2 2/5] seg6: handle a consumed SRH in SRv6 End with the PSP flavor Andrea Mayer
2026-11-05 1:57 ` [PATCH net-next v2 3/5] seg6: apply the PSP flavor together with NEXT-C-SID in SRv6 End Andrea Mayer
2026-11-05 1:57 ` [PATCH net-next v2 4/5] selftests: seg6: add tests for PSP together with NEXT-C-SID Andrea Mayer
2026-11-05 7:07 ` Hangbin Liu
2026-11-05 1:57 ` [PATCH net-next v2 5/5] selftests: seg6: add tests for PSP with a consumed SRH Andrea Mayer
2026-11-05 8:17 ` Hangbin Liu
2026-11-05 9:24 ` 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=auxLOoW97AQ55QdH@fedora \
--to=hangbin.liu@linux.dev \
--cc=ahabdels@cisco.com \
--cc=andrea.mayer@uniroma2.it \
--cc=andrea@common-net.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=justin.iurman@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--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®