Skip to content

Commit fbacee4

Browse files
matttbegregkh
authored andcommitted
selftests: mptcp: join: check re-using ID of closed subflow
commit 65fb58a upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7669151 commit fbacee4

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
@@ -3572,10 +3573,10 @@ endpoint_tests()
35723573
mptcp_lib_kill_wait $tests_pid
35733574
fi
35743575

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

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

0 commit comments

Comments
 (0)