[PATCH 6.1.y 1/3] selftests: mptcp: fix backport issues

Matthieu Baerts (NGI0)
2024-09-05T14:44:22Z

By accident, some patches modifying the MPTCP selftests have been
applied twice, using different versions of the patch [1].

These patches have been dropped, but it looks like quilt incorrectly
handled that by placing the new subtests at the wrong place: in
userspace_tests() instead of endpoint_tests(). That caused a few other
patches not to apply properly.

Not to have to revert and re-apply patches, this issue can be fixed by
moving some code around.

Link: https://lore.kernel.org/fc21db4a-508d-41db-aa45-e3bc06d18ce7@kernel.org [1]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
.../testing/selftests/net/mptcp/mptcp_join.sh | 138 +++++++++---------
1 file changed, 69 insertions(+), 69 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 33c002c26604..11585510695e 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -3236,75 +3236,6 @@ userspace_tests()
chk_join_nr 1 1 1
chk_rm_nr 0 1
fi
-
- # remove and re-add
- if reset "delete re-add signal" &&
- mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
- pm_nl_set_limits $ns1 0 3
- pm_nl_set_limits $ns2 3 3
- pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
- # broadcast IP: no packet for this address will be received on ns1
- pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
- pm_nl_add_endpoint $ns1 10.0.1.1 id 42 flags signal
- run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 2>/dev/null &
- local tests_pid=$!
-
- wait_mpj $ns2
- chk_subflow_nr needtitle "before delete" 2
-
- pm_nl_del_endpoint $ns1 1 10.0.2.1
- pm_nl_del_endpoint $ns1 2 224.0.0.1
- sleep 0.5
- chk_subflow_nr "" "after delete" 1
-
- pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
- pm_nl_add_endpoint $ns1 10.0.3.1 id 2 flags signal
- wait_mpj $ns2
- chk_subflow_nr "" "after re-add" 3
-
- pm_nl_del_endpoint $ns1 42 10.0.1.1
- sleep 0.5
- chk_subflow_nr "" "after delete ID 0" 2
-
- pm_nl_add_endpoint $ns1 10.0.1.1 id 99 flags signal
- wait_mpj $ns2
- chk_subflow_nr "" "after re-add" 3
- kill_tests_wait
-
- chk_join_nr 4 4 4
- chk_add_nr 5 5
- chk_rm_nr 3 2 invert
- fi
-
- # flush and re-add
- if reset_with_tcp_filter "flush re-add" ns2 10.0.3.2 REJECT OUTPUT &&
- mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
- pm_nl_set_limits $ns1 0 2
- pm_nl_set_limits $ns2 1 2
- # broadcast IP: no packet for this address will be received on ns1
- pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
- pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow
- run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 2>/dev/null &
- local tests_pid=$!
-
- wait_attempt_fail $ns2
- chk_subflow_nr needtitle "before flush" 1
-
- pm_nl_flush_endpoint $ns2
- pm_nl_flush_endpoint $ns1
- wait_rm_addr $ns2 0
- ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJECT
- pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow
- wait_mpj $ns2
- pm_nl_add_endpoint $ns1 10.0.3.1 id 2 flags signal
- wait_mpj $ns2
- kill_wait "${tests_pid}"
- kill_tests_wait
-
- chk_join_nr 2 2 2
- chk_add_nr 2 2
- chk_rm_nr 1 0 invert
- fi
}

endpoint_tests()
@@ -3375,6 +3306,75 @@ endpoint_tests()
chk_join_nr 6 6 6
chk_rm_nr 4 4
fi
+
+ # remove and re-add
+ if reset "delete re-add signal" &&
+ mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
+ pm_nl_set_limits $ns1 0 3
+ pm_nl_set_limits $ns2 3 3
+ pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
+ # broadcast IP: no packet for this address will be received on ns1
+ pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
+ pm_nl_add_endpoint $ns1 10.0.1.1 id 42 flags signal
+ run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 2>/dev/null &
+ local tests_pid=$!
+
+ wait_mpj $ns2
+ chk_subflow_nr needtitle "before delete" 2
+
+ pm_nl_del_endpoint $ns1 1 10.0.2.1
+ pm_nl_del_endpoint $ns1 2 224.0.0.1
+ sleep 0.5
+ chk_subflow_nr "" "after delete" 1
+
+ pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
+ pm_nl_add_endpoint $ns1 10.0.3.1 id 2 flags signal
+ wait_mpj $ns2
+ chk_subflow_nr "" "after re-add" 3
+
+ pm_nl_del_endpoint $ns1 42 10.0.1.1
+ sleep 0.5
+ chk_subflow_nr "" "after delete ID 0" 2
+
+ pm_nl_add_endpoint $ns1 10.0.1.1 id 99 flags signal
+ wait_mpj $ns2
+ chk_subflow_nr "" "after re-add" 3
+ kill_tests_wait
+
+ chk_join_nr 4 4 4
+ chk_add_nr 5 5
+ chk_rm_nr 3 2 invert
+ fi
+
+ # flush and re-add
+ if reset_with_tcp_filter "flush re-add" ns2 10.0.3.2 REJECT OUTPUT &&
+ mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
+ pm_nl_set_limits $ns1 0 2
+ pm_nl_set_limits $ns2 1 2
+ # broadcast IP: no packet for this address will be received on ns1
+ pm_nl_add_endpoint $ns1 224.0.0.1 id 2 flags signal
+ pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow
+ run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 2>/dev/null &
+ local tests_pid=$!
+
+ wait_attempt_fail $ns2
+ chk_subflow_nr needtitle "before flush" 1
+
+ pm_nl_flush_endpoint $ns2
+ pm_nl_flush_endpoint $ns1
+ wait_rm_addr $ns2 0
+ ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJECT
+ pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow
+ wait_mpj $ns2
+ pm_nl_add_endpoint $ns1 10.0.3.1 id 2 flags signal
+ wait_mpj $ns2
+ kill_wait "${tests_pid}"
+ kill_tests_wait
+
+ chk_join_nr 2 2 2
+ chk_add_nr 2 2
+ chk_rm_nr 1 0 invert
+ fi
}

# [$1: error message]
--
2.45.2