Re: [PATCH net-next v3 4/5] selftest: seg6: explicit cleanup for SRv6 End PSP test

From: netdev-bot+sashiko

Date: Mon Nov 16 2026 - 07:30:03 EST


Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In tools/testing/selftests/net/srv6_end_flavors_test.sh, the
PSP defer scope does not remove everything the PSP block sets up.
- [Low] The commit message says the patch uses "defer and
defer_scopes_cleanup", but srv6_end_flavors_test.sh never calls…

--

selftest: seg6: explicit cleanup for SRv6 End PSP test

This commit adds defer calls to setup_rt_endpoint(), setup_rt_host_proxy()
and __setup_rt_policy() in srv6_end_flavors_test.sh. It also wraps the End
PSP setup and tests in a defer_scope_push/defer_scope_pop pair, so the
PSP-specific configuration is removed when that scope ends instead of at
namespace teardown.

> Use defer and defer_scopes_cleanup to remove the PSP specified
> configurations. i.e.

[Severity: Low]
Is this description accurate? The script never calls defer_scopes_cleanup.

The patch uses defer_scope_push and defer_scope_pop in the main script
body. The EXIT handler is unchanged:

trap cleanup EXIT

and cleanup() only deletes the namespaces. net/lib.sh does not install a
trap that runs pending defers either. If setup_end_flv_psp fails under
set -e before defer_scope_pop, the queued jobs are simply dropped.

This doesn't leak anything today, because every deferred command is an
ip -netns command and cleanup() deletes those namespaces anyway.

Could the commit message refer to defer_scope_push/defer_scope_pop instead?

> diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh
> index 0ed5bfe99029b..374b43661c285 100755
> --- a/tools/testing/selftests/net/srv6_end_flavors_test.sh
> +++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh

[ ... ]

> @@ -1460,11 +1470,13 @@ set +e
> router_tests
> host2gateway_tests
>
> +defer_scope_push
> set -e
> setup_end_flv_psp
> set +e
> host_srv6_end_flv_psp_tests
> host_srv6_end_flv_next_csid_psp_tests
> host_srv6_end_flv_consumed_srh_tests
> +defer_scope_pop

[Severity: Medium]
Does this scope pop leave the cafe::1:e9 and cafe::2:e9 addresses and
routes in place?

Inside this scope, setup_end_flv_psp() calls setup_hs_lo_addr() for both
hosts:

setup_hs_lo_addr 1 1 "${END_CSID_PSP_FUNC}"
setup_hs_lo_addr 2 2 "${END_CSID_PSP_FUNC}"

setup_hs_lo_addr() did not get any defer calls:

ip -netns "${hsname}" addr add "${addr}/128" dev lo nodad

ip -netns "${rtname}" -6 route \
add "${addr}" \
via "${IPv6_HS_NETWORK}::${hs}" dev "${RT2HS_DEVNAME}"

So after defer_scope_pop, hs-1 and hs-2 still have cafe::<hs>:e9/128 on lo,
and rt-1 and rt-2 still have their routes to those addresses. The commit
message lists the cafe::1:e9 and cafe::2:e9 routes as state this patch
removes.

A later block that calls setup_hs_lo_addr with the same suffix under set -e
would fail with EEXIST and be reported as a setup skip. Nothing fails yet:
the End.X block added later in the series ("selftests: seg6: add PSP
flavor testing for SRv6 End.X") uses a different suffix (a9). But
setup_hs_lo_addr() is still not deferred at the end of the series.

Would adding something like this to setup_hs_lo_addr() fix it?

defer ip -netns "${hsname}" addr del "${addr}/128" dev lo
defer ip -netns "${rtname}" -6 route del "${addr}"

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-srv6_flavors_endx-v3-0-c9177bbbd965%40kylinos.cn