Skip to content

Commit

Permalink
Squash-to: "mptcp: more careful RM_ADDR generation"
Browse files Browse the repository at this point in the history
When the self-tests flushed the subflows on both sides of
the MPTCP connections, the number of subflows actually deleted
on each side is unreliable.

The test code always flushes  first the client side, but the
actual delete operations is performed asynchronously, and one
on more subflows could be processed after that the other end
already deleted it.

The grand total of the deleted subflows is expected to be
in the [nr_subflows: 2* nr_subflows] range.

Address the issue checking the total number of deleted subflows
in the simult flush cases and enforcing the above constraint

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Tested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
  • Loading branch information
Paolo Abeni authored and matttbe committed Feb 22, 2022
1 parent 83c7f56 commit 939b82e
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 @@ -1060,16 +1060,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 @@ -1088,6 +1096,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 @@ -1576,7 +1603,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 @@ -1587,7 +1614,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 @@ -1599,7 +1626,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 @@ -1883,7 +1910,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 939b82e

Please sign in to comment.