Commit 7028ba8a authored by Geliang Tang's avatar Geliang Tang Committed by David S. Miller

selftests: mptcp: add invert argument for chk_rm_nr

Some of the removing testcases used two zeros as arguments for chk_rm_nr
like this: chk_rm_nr 0 0. This doesn't mean that no RM_ADDR has been sent.
It only means that RM_ADDR had been sent in the opposite direction that
chk_rm_nr is checking.

This patch added a new argument invert for chk_rm_nr to allow it can
check the RM_ADDR from the opposite direction.
Signed-off-by: default avatarGeliang Tang <geliangtang@gmail.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0e4a3e68
...@@ -610,11 +610,22 @@ chk_rm_nr() ...@@ -610,11 +610,22 @@ chk_rm_nr()
{ {
local rm_addr_nr=$1 local rm_addr_nr=$1
local rm_subflow_nr=$2 local rm_subflow_nr=$2
local invert=${3:-""}
local count local count
local dump_stats local dump_stats
local addr_ns
local subflow_ns
if [ -z $invert ]; then
addr_ns=$ns1
subflow_ns=$ns2
elif [ $invert = "invert" ]; then
addr_ns=$ns2
subflow_ns=$ns1
fi
printf "%-39s %s" " " "rm " printf "%-39s %s" " " "rm "
count=`ip netns exec $ns1 nstat -as | grep MPTcpExtRmAddr | awk '{print $2}'` count=`ip netns exec $addr_ns nstat -as | grep MPTcpExtRmAddr | awk '{print $2}'`
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$rm_addr_nr" ]; then if [ "$count" != "$rm_addr_nr" ]; then
echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr" echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr"
...@@ -625,7 +636,7 @@ chk_rm_nr() ...@@ -625,7 +636,7 @@ chk_rm_nr()
fi fi
echo -n " - sf " echo -n " - sf "
count=`ip netns exec $ns2 nstat -as | grep MPTcpExtRmSubflow | awk '{print $2}'` count=`ip netns exec $subflow_ns nstat -as | grep MPTcpExtRmSubflow | awk '{print $2}'`
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$rm_subflow_nr" ]; then if [ "$count" != "$rm_subflow_nr" ]; then
echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr" echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr"
...@@ -833,7 +844,7 @@ remove_tests() ...@@ -833,7 +844,7 @@ remove_tests()
run_tests $ns1 $ns2 10.0.1.1 0 -1 0 slow run_tests $ns1 $ns2 10.0.1.1 0 -1 0 slow
chk_join_nr "remove single address" 1 1 1 chk_join_nr "remove single address" 1 1 1
chk_add_nr 1 1 chk_add_nr 1 1
chk_rm_nr 0 0 chk_rm_nr 1 1 invert
# subflow and signal, remove # subflow and signal, remove
reset reset
...@@ -945,7 +956,7 @@ ipv6_tests() ...@@ -945,7 +956,7 @@ ipv6_tests()
run_tests $ns1 $ns2 dead:beef:1::1 0 -1 0 slow run_tests $ns1 $ns2 dead:beef:1::1 0 -1 0 slow
chk_join_nr "remove single address IPv6" 1 1 1 chk_join_nr "remove single address IPv6" 1 1 1
chk_add_nr 1 1 chk_add_nr 1 1
chk_rm_nr 0 0 chk_rm_nr 1 1 invert
# subflow and signal IPv6, remove # subflow and signal IPv6, remove
reset reset
...@@ -1088,7 +1099,7 @@ add_addr_ports_tests() ...@@ -1088,7 +1099,7 @@ add_addr_ports_tests()
run_tests $ns1 $ns2 10.0.1.1 0 -1 0 slow run_tests $ns1 $ns2 10.0.1.1 0 -1 0 slow
chk_join_nr "remove single address with port" 1 1 1 chk_join_nr "remove single address with port" 1 1 1
chk_add_nr 1 1 1 chk_add_nr 1 1 1
chk_rm_nr 0 0 chk_rm_nr 1 1 invert
# subflow and signal with port, remove # subflow and signal with port, remove
reset reset
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment