Re: [PATCH net v2] selftests: netfilter: conntrack_sctp_collision.sh: Introduce SCTP INIT collision test
From: Xin Long
Date: Mon Apr 20 2026 - 16:52:47 EST
On Mon, Apr 20, 2026 at 11:23 AM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> On Sun, 19 Apr 2026 03:58:43 +0800 Yi Chen wrote:
> > The existing test covered a scenario where a delayed INIT_ACK chunk
> > updates the vtag in conntrack after the association has already been
> > established.
>
> AI says:
>
> The conntrack_sctp_collision.sh selftest is now failing in the NIPA CI on
> both the normal and debug kernel builds:
>
> not ok 1 1 selftests: net/netfilter: conntrack_sctp_collision.sh # exit=1
>
> # Test for SCTP INIT_ACK Collision in nf_conntrack:
> # Invalid netns name ""
> # Invalid netns name ""
>
> The root cause is a shell variable scoping bug introduced by this patch.
> The new test structure wraps `topo_setup` in a subshell:
>
> (topo_setup && conf_delay $SERVER_NS link0 2) || exit $?
Better to change it to:
topo_setup || exit $?
conf_delay $SERVER_NS link0 2 || exit $?
Again, please do not post the patch until the fix gets merged into net.git:
https://lore.kernel.org/netdev/cover.1775847557.git.lucien.xin@xxxxxxxxx/
Otherwise, it will still be failing in the NIPA CI.
Thanks.
> if ! do_test; then
> ...
> fi
>
> `topo_setup` calls `setup_ns CLIENT_NS SERVER_NS ROUTER_NS`, which sets
> those variables inside the subshell. Those assignments do not propagate
> back to the parent shell, so when `do_test` is called afterwards, both
> `$SERVER_NS` and `$CLIENT_NS` expand to empty strings. The `ip net exec ""`
> calls then fail with "Invalid netns name """.
>
> The second test case (SCTP INIT Collision) would have the same problem.
>
> The fix is to avoid the subshell or ensure the namespace variables are
> visible to `do_test`. The simplest approach is to remove the subshell
> wrapping and call `topo_setup`, `conf_delay`, and `do_test` in the same
> shell scope:
>
> topo_setup && conf_delay "$SERVER_NS" link0 2 || exit $?
> if ! do_test; then
> exit $ksft_fail
> fi
>
> topo_setup && conf_delay "$CLIENT_NS" link3 1 || exit $?
> if ! do_test; then
> exit $ksft_fail
> fi
>
> Please also note that `conf_delay` references `$ROUTER_NS` directly
> (not via a parameter), so it too requires that those variables be set
> in the same shell scope.