Skip to content

Commit

Permalink
tgupdate: merge t/DO-NOT-MERGE-mptcp-enabled-by-default into t/upstre…
Browse files Browse the repository at this point in the history
…am base
  • Loading branch information
matttbe committed Feb 22, 2022
2 parents dc54d02 + 604b2e0 commit e44e353
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1130,16 +1130,24 @@ chk_rm_nr()
{
local rm_addr_nr=$1
local rm_subflow_nr=$2
local invert=${3:-""}
local invert
local simult
local count
local dump_stats
local addr_ns
local subflow_ns

shift 2
while [ -n "$1" ]; do
[ "$1" = "invert" ] && invert=true
[ "$1" = "simult" ] && simult=true
shift
done

if [ -z $invert ]; then
addr_ns=$ns1
subflow_ns=$ns2
elif [ $invert = "invert" ]; then
elif [ $invert = "true" ]; then
addr_ns=$ns2
subflow_ns=$ns1
fi
Expand All @@ -1158,6 +1166,25 @@ chk_rm_nr()
echo -n " - sf "
count=`ip netns exec $subflow_ns nstat -as | grep MPTcpExtRmSubflow | awk '{print $2}'`
[ -z "$count" ] && count=0
if [ -n "$simult" ]; then
local cnt=$(ip netns exec $addr_ns nstat -as | grep MPTcpExtRmSubflow | awk '{print $2}')
local suffix

# in case of simult flush, the subflow removal count on each side is
# unreliable
[ -z "$cnt" ] && cnt=0
count=$((count + cnt))
[ "$count" != "$rm_subflow_nr" ] && suffix="$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]"
if [ $count -ge "$rm_subflow_nr" ] && \
[ "$count" -le "$((rm_subflow_nr *2 ))" ]; then
echo "[ ok ] $suffix"
else
echo "[fail] got $count RM_SUBFLOW[s] expected in range [$rm_subflow_nr:$((rm_subflow_nr*2))]"
ret=1
dump_stats=1
fi
return
fi
if [ "$count" != "$rm_subflow_nr" ]; then
echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr"
ret=1
Expand Down Expand Up @@ -1646,7 +1673,7 @@ remove_tests()
run_tests $ns1 $ns2 10.0.1.1 0 -8 -8 slow
chk_join_nr "flush subflows and signal" 3 3 3
chk_add_nr 1 1
chk_rm_nr 1 1 invert
chk_rm_nr 1 3 invert simult

# subflows flush
reset
Expand All @@ -1657,7 +1684,7 @@ remove_tests()
pm_nl_add_endpoint $ns2 10.0.4.2 flags subflow
run_tests $ns1 $ns2 10.0.1.1 0 -8 -8 slow
chk_join_nr "flush subflows" 3 3 3
chk_rm_nr 0 3
chk_rm_nr 0 3 simult

# addresses flush
reset
Expand All @@ -1669,7 +1696,7 @@ remove_tests()
run_tests $ns1 $ns2 10.0.1.1 0 -8 -8 slow
chk_join_nr "flush addresses" 3 3 3
chk_add_nr 3 3
chk_rm_nr 3 3 invert
chk_rm_nr 3 3 invert simult

# invalid addresses flush
reset
Expand Down Expand Up @@ -1953,7 +1980,7 @@ add_addr_ports_tests()
run_tests $ns1 $ns2 10.0.1.1 0 -8 -2 slow
chk_join_nr "flush subflows and signal with port" 3 3 3
chk_add_nr 1 1
chk_rm_nr 1 1 invert
chk_rm_nr 1 3 invert simult

# multiple addresses with port
reset
Expand Down

0 comments on commit e44e353

Please sign in to comment.