Subject: Re: [PATCH net v2] selftests: netfilter: conntrack_sctp_collision.sh: Introduce SCTP INIT collision test

From: Jakub Kicinski <[email-masked]>
Date: Mon, 20 Apr 2026 08:23:34 -0700

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 $?
  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.