Skip to content

Commit 46e967d

Browse files
Paolo Abenidavem330
authored andcommitted
selftests: mptcp: add tests for subflow creation failure
Verify that, when multiple endpoints are available, subflows creation proceed even when the first additional subflow creation fails - due to packet drop on the relevant link Co-developed-by: Geliang Tang <[email protected]> Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a88c9e4 commit 46e967d

File tree

2 files changed

+78
-1
lines changed

2 files changed

+78
-1
lines changed

tools/testing/selftests/net/mptcp/config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ CONFIG_NFT_TPROXY=m
1717
CONFIG_NFT_SOCKET=m
1818
CONFIG_IP_ADVANCED_ROUTER=y
1919
CONFIG_IP_MULTIPLE_TABLES=y
20+
CONFIG_IP_NF_TARGET_REJECT=m
2021
CONFIG_IPV6_MULTIPLE_TABLES=y

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

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,22 @@ chk_link_usage()
937937
fi
938938
}
939939

940+
wait_for_tw()
941+
{
942+
local timeout_ms=$((timeout_poll * 1000))
943+
local time=0
944+
local ns=$1
945+
946+
while [ $time -lt $timeout_ms ]; do
947+
local cnt=$(ip netns exec $ns ss -t state time-wait |wc -l)
948+
949+
[ "$cnt" = 1 ] && return 1
950+
time=$((time + 100))
951+
sleep 0.1
952+
done
953+
return 1
954+
}
955+
940956
subflows_tests()
941957
{
942958
reset
@@ -994,6 +1010,61 @@ subflows_tests()
9941010
chk_join_nr "single subflow, dev" 1 1 1
9951011
}
9961012

1013+
subflows_error_tests()
1014+
{
1015+
# If a single subflow is configured, and matches the MPC src
1016+
# address, no additional subflow should be created
1017+
reset
1018+
ip netns exec $ns1 ./pm_nl_ctl limits 0 1
1019+
ip netns exec $ns2 ./pm_nl_ctl limits 0 1
1020+
ip netns exec $ns2 ./pm_nl_ctl add 10.0.1.2 flags subflow
1021+
run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
1022+
chk_join_nr "no MPC reuse with single endpoint" 0 0 0
1023+
1024+
# multiple subflows, with subflow creation error
1025+
reset
1026+
ip netns exec $ns1 ./pm_nl_ctl limits 0 2
1027+
ip netns exec $ns2 ./pm_nl_ctl limits 0 2
1028+
ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
1029+
ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow
1030+
ip netns exec $ns1 iptables -A INPUT -s 10.0.3.2 -p tcp -j REJECT
1031+
run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
1032+
chk_join_nr "multi subflows, with failing subflow" 1 1 1
1033+
1034+
# multiple subflows, with subflow timeout on MPJ
1035+
reset
1036+
ip netns exec $ns1 ./pm_nl_ctl limits 0 2
1037+
ip netns exec $ns2 ./pm_nl_ctl limits 0 2
1038+
ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
1039+
ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow
1040+
ip netns exec $ns1 iptables -A INPUT -s 10.0.3.2 -p tcp -j DROP
1041+
run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
1042+
chk_join_nr "multi subflows, with subflow timeout" 1 1 1
1043+
1044+
# multiple subflows, check that the endpoint corresponding to
1045+
# closed subflow (due to reset) is not reused if additional
1046+
# subflows are added later
1047+
reset
1048+
ip netns exec $ns1 ./pm_nl_ctl limits 0 1
1049+
ip netns exec $ns2 ./pm_nl_ctl limits 0 1
1050+
ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
1051+
ip netns exec $ns1 iptables -A INPUT -s 10.0.3.2 -p tcp -j REJECT
1052+
run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow &
1053+
1054+
# updates in the child shell do not have any effect here, we
1055+
# need to bump the test counter for the above case
1056+
TEST_COUNT=$((TEST_COUNT+1))
1057+
1058+
# mpj subflow will be in TW after the reset
1059+
wait_for_tw $ns2
1060+
ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow
1061+
wait
1062+
1063+
# additional subflow could be created only if the PM select
1064+
# the later endpoint, skipping the already used one
1065+
chk_join_nr "multi subflows, fair usage on close" 1 1 1
1066+
}
1067+
9971068
signal_address_tests()
9981069
{
9991070
# add_address, unused
@@ -1805,6 +1876,7 @@ fullmesh_tests()
18051876
all_tests()
18061877
{
18071878
subflows_tests
1879+
subflows_error_tests
18081880
signal_address_tests
18091881
link_failure_tests
18101882
add_addr_timeout_tests
@@ -1824,6 +1896,7 @@ usage()
18241896
{
18251897
echo "mptcp_join usage:"
18261898
echo " -f subflows_tests"
1899+
echo " -e subflows_error_tests"
18271900
echo " -s signal_address_tests"
18281901
echo " -l link_failure_tests"
18291902
echo " -t add_addr_timeout_tests"
@@ -1872,11 +1945,14 @@ if [ $do_all_tests -eq 1 ]; then
18721945
exit $ret
18731946
fi
18741947

1875-
while getopts 'fsltra64bpkdmchCS' opt; do
1948+
while getopts 'fesltra64bpkdmchCS' opt; do
18761949
case $opt in
18771950
f)
18781951
subflows_tests
18791952
;;
1953+
e)
1954+
subflows_error_tests
1955+
;;
18801956
s)
18811957
signal_address_tests
18821958
;;

0 commit comments

Comments
 (0)