@@ -937,6 +937,22 @@ chk_link_usage()
937
937
fi
938
938
}
939
939
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
+
940
956
subflows_tests ()
941
957
{
942
958
reset
@@ -994,6 +1010,61 @@ subflows_tests()
994
1010
chk_join_nr " single subflow, dev" 1 1 1
995
1011
}
996
1012
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
+
997
1068
signal_address_tests ()
998
1069
{
999
1070
# add_address, unused
@@ -1805,6 +1876,7 @@ fullmesh_tests()
1805
1876
all_tests ()
1806
1877
{
1807
1878
subflows_tests
1879
+ subflows_error_tests
1808
1880
signal_address_tests
1809
1881
link_failure_tests
1810
1882
add_addr_timeout_tests
@@ -1824,6 +1896,7 @@ usage()
1824
1896
{
1825
1897
echo " mptcp_join usage:"
1826
1898
echo " -f subflows_tests"
1899
+ echo " -e subflows_error_tests"
1827
1900
echo " -s signal_address_tests"
1828
1901
echo " -l link_failure_tests"
1829
1902
echo " -t add_addr_timeout_tests"
@@ -1872,11 +1945,14 @@ if [ $do_all_tests -eq 1 ]; then
1872
1945
exit $ret
1873
1946
fi
1874
1947
1875
- while getopts ' fsltra64bpkdmchCS ' opt; do
1948
+ while getopts ' fesltra64bpkdmchCS ' opt; do
1876
1949
case $opt in
1877
1950
f)
1878
1951
subflows_tests
1879
1952
;;
1953
+ e)
1954
+ subflows_error_tests
1955
+ ;;
1880
1956
s)
1881
1957
signal_address_tests
1882
1958
;;
0 commit comments