Skip to content

Commit 65fb58a

Browse files
matttbekuba-moo
authored andcommitted
selftests: mptcp: join: check re-using ID of closed subflow
This test extends "delete and re-add" to validate the previous commit. A new 'subflow' endpoint is added, but the subflow request will be rejected. The result is that no subflow will be established from this address. Later, the endpoint is removed and re-added after having cleared the firewall rule. Before the previous commit, the client would not have been able to create this new subflow. While at it, extra checks have been added to validate the expected numbers of MPJ and RM_ADDR. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: b6c0838 ("mptcp: remove addr and subflow in PM netlink") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20240819-net-mptcp-pm-reusing-id-v1-4-38035d40de5b@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent edd8b5d commit 65fb58a

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,10 @@ reset_with_tcp_filter()
436436
local ns="${!1}"
437437
local src="${2}"
438438
local target="${3}"
439+
local chain="${4:-INPUT}"
439440

440441
if ! ip netns exec "${ns}" ${iptables} \
441-
-A INPUT \
442+
-A "${chain}" \
442443
-s "${src}" \
443444
-p tcp \
444445
-j "${target}"; then
@@ -3571,10 +3572,10 @@ endpoint_tests()
35713572
mptcp_lib_kill_wait $tests_pid
35723573
fi
35733574

3574-
if reset "delete and re-add" &&
3575+
if reset_with_tcp_filter "delete and re-add" ns2 10.0.3.2 REJECT OUTPUT &&
35753576
mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
3576-
pm_nl_set_limits $ns1 1 1
3577-
pm_nl_set_limits $ns2 1 1
3577+
pm_nl_set_limits $ns1 0 2
3578+
pm_nl_set_limits $ns2 0 2
35783579
pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow
35793580
test_linkfail=4 speed=20 \
35803581
run_tests $ns1 $ns2 10.0.1.1 &
@@ -3591,11 +3592,27 @@ endpoint_tests()
35913592
chk_subflow_nr "after delete" 1
35923593
chk_mptcp_info subflows 0 subflows 0
35933594

3594-
pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow
3595+
pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow
35953596
wait_mpj $ns2
35963597
chk_subflow_nr "after re-add" 2
35973598
chk_mptcp_info subflows 1 subflows 1
3599+
3600+
pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow
3601+
wait_attempt_fail $ns2
3602+
chk_subflow_nr "after new reject" 2
3603+
chk_mptcp_info subflows 1 subflows 1
3604+
3605+
ip netns exec "${ns2}" ${iptables} -D OUTPUT -s "10.0.3.2" -p tcp -j REJECT
3606+
pm_nl_del_endpoint $ns2 3 10.0.3.2
3607+
pm_nl_add_endpoint $ns2 10.0.3.2 id 3 flags subflow
3608+
wait_mpj $ns2
3609+
chk_subflow_nr "after no reject" 3
3610+
chk_mptcp_info subflows 2 subflows 2
3611+
35983612
mptcp_lib_kill_wait $tests_pid
3613+
3614+
chk_join_nr 3 3 3
3615+
chk_rm_nr 1 1
35993616
fi
36003617

36013618
# remove and re-add

0 commit comments

Comments
 (0)