Skip to content

Commit ce72fea

Browse files
Geliang Tangkuba-moo
authored andcommitted
selftests: mptcp: diag: use mptcp_lib_get_info_value
When running diag.sh in a loop, chk_dump_one will report the following "grep: write error": 13 ....chk 2 cestab [ OK ] grep: write error 14 ....chk dump_one [ OK ] 15 ....chk 2->0 msk in use after flush [ OK ] 16 ....chk 2->0 cestab after flush [ OK ] This error is caused by a broken pipe. When the output of 'ss' is processed by grep, 'head -n 1' will exit immediately after getting the first line, causing the subsequent pipe to close. At this time, if 'grep' is still trying to write data to the closed pipe, it will trigger a SIGPIPE signal, causing a write error. One solution is not to use this problematic "head -n 1" command, but to use mptcp_lib_get_info_value() helper defined in mptcp_lib.sh to get the value of 'token'. Fixes: ba24001 ("selftests: mptcp: add a test for mptcp_diag_dump_one") Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Tested-by: Gang Yan <yangang@kylinos.cn> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20250421-net-mptcp-pm-defer-freeing-v1-2-e731dc6e86b9@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 13b4ece commit ce72fea

File tree

1 file changed

+2
-3
lines changed
  • tools/testing/selftests/net/mptcp

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,8 @@ chk_dump_one()
206206
local token
207207
local msg
208208

209-
ss_token="$(ss -inmHMN $ns | grep 'token:' |\
210-
head -n 1 |\
211-
sed 's/.*token:\([0-9a-f]*\).*/\1/')"
209+
ss_token="$(ss -inmHMN $ns |
210+
mptcp_lib_get_info_value "token" "token")"
212211

213212
token="$(ip netns exec $ns ./mptcp_diag -t $ss_token |\
214213
awk -F':[ \t]+' '/^token/ {print $2}')"

0 commit comments

Comments
 (0)