Commit 5e986ec4 authored by Geliang Tang's avatar Geliang Tang Committed by David S. Miller

selftests: mptcp: userspace pm subflow tests

This patch adds userspace pm subflow tests support for mptcp_join.sh
script. Add userspace pm create subflow and destroy test cases in
userspace_tests().
Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarGeliang Tang <geliang.tang@suse.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 97040cf9
...@@ -663,6 +663,8 @@ do_transfer() ...@@ -663,6 +663,8 @@ do_transfer()
local userspace_pm=0 local userspace_pm=0
local evts_ns1 local evts_ns1
local evts_ns1_pid local evts_ns1_pid
local evts_ns2
local evts_ns2_pid
:> "$cout" :> "$cout"
:> "$sout" :> "$sout"
...@@ -708,13 +710,20 @@ do_transfer() ...@@ -708,13 +710,20 @@ do_transfer()
# disconnect # disconnect
extra_args="$extra_args -I ${addr_nr_ns2:10}" extra_args="$extra_args -I ${addr_nr_ns2:10}"
addr_nr_ns2=0 addr_nr_ns2=0
elif [[ "${addr_nr_ns2}" = "userspace_"* ]]; then
userspace_pm=1
addr_nr_ns2=${addr_nr_ns2:10}
fi fi
if [ $userspace_pm -eq 1 ]; then if [ $userspace_pm -eq 1 ]; then
evts_ns1=$(mktemp) evts_ns1=$(mktemp)
evts_ns2=$(mktemp)
:> "$evts_ns1" :> "$evts_ns1"
:> "$evts_ns2"
ip netns exec ${listener_ns} ./pm_nl_ctl events >> "$evts_ns1" 2>&1 & ip netns exec ${listener_ns} ./pm_nl_ctl events >> "$evts_ns1" 2>&1 &
evts_ns1_pid=$! evts_ns1_pid=$!
ip netns exec ${connector_ns} ./pm_nl_ctl events >> "$evts_ns2" 2>&1 &
evts_ns2_pid=$!
fi fi
local local_addr local local_addr
...@@ -836,6 +845,8 @@ do_transfer() ...@@ -836,6 +845,8 @@ do_transfer()
if [ $addr_nr_ns2 -gt 0 ]; then if [ $addr_nr_ns2 -gt 0 ]; then
local add_nr_ns2=${addr_nr_ns2} local add_nr_ns2=${addr_nr_ns2}
local counter=3 local counter=3
local id=20
local tk da dp sp
while [ $add_nr_ns2 -gt 0 ]; do while [ $add_nr_ns2 -gt 0 ]; do
local addr local addr
if is_v6 "${connect_addr}"; then if is_v6 "${connect_addr}"; then
...@@ -843,9 +854,23 @@ do_transfer() ...@@ -843,9 +854,23 @@ do_transfer()
else else
addr="10.0.$counter.2" addr="10.0.$counter.2"
fi fi
pm_nl_add_endpoint $ns2 $addr flags $flags if [ $userspace_pm -eq 0 ]; then
pm_nl_add_endpoint $ns2 $addr flags $flags
else
tk=$(sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2")
da=$(sed -n 's/.*\(daddr4:\)\([0-9.]*\).*$/\2/p;q' "$evts_ns2")
dp=$(sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2")
ip netns exec ${connector_ns} ./pm_nl_ctl csf lip $addr lid $id \
rip $da rport $dp token $tk
sleep 1
sp=$(grep "type:10" "$evts_ns2" |
sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
ip netns exec ${connector_ns} ./pm_nl_ctl dsf lip $addr lport $sp \
rip $da rport $dp token $tk
fi
counter=$((counter + 1)) counter=$((counter + 1))
add_nr_ns2=$((add_nr_ns2 - 1)) add_nr_ns2=$((add_nr_ns2 - 1))
id=$((id + 1))
done done
elif [ $addr_nr_ns2 -lt 0 ]; then elif [ $addr_nr_ns2 -lt 0 ]; then
local rm_nr_ns2=$((-addr_nr_ns2)) local rm_nr_ns2=$((-addr_nr_ns2))
...@@ -924,7 +949,8 @@ do_transfer() ...@@ -924,7 +949,8 @@ do_transfer()
if [ $userspace_pm -eq 1 ]; then if [ $userspace_pm -eq 1 ]; then
kill_wait $evts_ns1_pid kill_wait $evts_ns1_pid
rm -rf $evts_ns1 kill_wait $evts_ns2_pid
rm -rf $evts_ns1 $evts_ns2
fi fi
NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \
...@@ -2857,6 +2883,15 @@ userspace_tests() ...@@ -2857,6 +2883,15 @@ userspace_tests()
chk_add_nr 1 1 chk_add_nr 1 1
chk_rm_nr 1 1 invert chk_rm_nr 1 1 invert
fi fi
# userspace pm create destroy subflow
if reset "userspace pm create destroy subflow"; then
set_userspace_pm $ns2
pm_nl_set_limits $ns1 0 1
run_tests $ns1 $ns2 10.0.1.1 0 0 userspace_1 slow
chk_join_nr 1 1 1
chk_rm_nr 0 1
fi
} }
endpoint_tests() endpoint_tests()
......
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