Skip to content

Commit 9168ea0

Browse files
geliangtangkuba-moo
authored andcommitted
selftests: mptcp: fix wait_rm_addr/sf parameters
The second input parameter of 'wait_rm_addr/sf $1 1' is misused. If it's 1, wait_rm_addr/sf will never break, and will loop ten times, then 'wait_rm_addr/sf' equals to 'sleep 1'. This delay time is too long, which can sometimes make the tests fail. A better way to use wait_rm_addr/sf is to use rm_addr/sf_count to obtain the current value, and then pass into wait_rm_addr/sf. Fixes: 4369c19 ("selftests: mptcp: test userspace pm out of transfer") Cc: stable@vger.kernel.org Suggested-by: Matthieu Baerts <matttbe@kernel.org> Reviewed-by: Matthieu Baerts <matttbe@kernel.org> Signed-off-by: Geliang Tang <geliang.tang@suse.com> Signed-off-by: Mat Martineau <martineau@kernel.org> Link: https://lore.kernel.org/r/20231025-send-net-next-20231025-v1-2-db8f25f798eb@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent f4a75e9 commit 9168ea0

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3289,6 +3289,7 @@ userspace_pm_rm_sf_addr_ns1()
32893289
local addr=$1
32903290
local id=$2
32913291
local tk sp da dp
3292+
local cnt_addr cnt_sf
32923293

32933294
tk=$(grep "type:1," "$evts_ns1" |
32943295
sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q')
@@ -3298,11 +3299,13 @@ userspace_pm_rm_sf_addr_ns1()
32983299
sed -n 's/.*\(daddr6:\)\([0-9a-f:.]*\).*$/\2/p;q')
32993300
dp=$(grep "type:10" "$evts_ns1" |
33003301
sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q')
3302+
cnt_addr=$(rm_addr_count ${ns1})
3303+
cnt_sf=$(rm_sf_count ${ns1})
33013304
ip netns exec $ns1 ./pm_nl_ctl rem token $tk id $id
33023305
ip netns exec $ns1 ./pm_nl_ctl dsf lip "::ffff:$addr" \
33033306
lport $sp rip $da rport $dp token $tk
3304-
wait_rm_addr $ns1 1
3305-
wait_rm_sf $ns1 1
3307+
wait_rm_addr $ns1 "${cnt_addr}"
3308+
wait_rm_sf $ns1 "${cnt_sf}"
33063309
}
33073310

33083311
userspace_pm_add_sf()
@@ -3324,17 +3327,20 @@ userspace_pm_rm_sf_addr_ns2()
33243327
local addr=$1
33253328
local id=$2
33263329
local tk da dp sp
3330+
local cnt_addr cnt_sf
33273331

33283332
tk=$(sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2")
33293333
da=$(sed -n 's/.*\(daddr4:\)\([0-9.]*\).*$/\2/p;q' "$evts_ns2")
33303334
dp=$(sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2")
33313335
sp=$(grep "type:10" "$evts_ns2" |
33323336
sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
3337+
cnt_addr=$(rm_addr_count ${ns2})
3338+
cnt_sf=$(rm_sf_count ${ns2})
33333339
ip netns exec $ns2 ./pm_nl_ctl rem token $tk id $id
33343340
ip netns exec $ns2 ./pm_nl_ctl dsf lip $addr lport $sp \
33353341
rip $da rport $dp token $tk
3336-
wait_rm_addr $ns2 1
3337-
wait_rm_sf $ns2 1
3342+
wait_rm_addr $ns2 "${cnt_addr}"
3343+
wait_rm_sf $ns2 "${cnt_sf}"
33383344
}
33393345

33403346
userspace_tests()

0 commit comments

Comments
 (0)