2 # SPDX-License-Identifier: GPL-2.0
4 rndh=$(printf %x $sec)-$(mktemp -u XXXXXX)
9 timeout_test=$((timeout_poll * 2 + 1))
14 # mptcp_connect in join mode will sleep a bit before completing,
18 ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null
23 ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGKILL &>/dev/null
28 ip -Version > /dev/null 2>&1
30 echo "SKIP: Could not run test without ip tool"
35 echo "SKIP: ss tool does not support MPTCP"
47 nr=$(ss -inmHMN $ns | $condition)
50 if [ $nr != $expected ]; then
51 echo "[ fail ] expected $expected found $nr"
56 test_cnt=$((test_cnt+1))
61 __chk_nr "grep -c token:" $*
66 __chk_nr "grep -c fallback" $*
69 chk_msk_remote_key_nr()
71 __chk_nr "grep -c remote_key" $*
77 ip -n $ns link set dev lo up
80 timeout ${timeout_test} \
82 ./mptcp_connect -p 10000 -l -t ${timeout_poll} \
85 chk_msk_nr 0 "no msk on netns creation"
88 timeout ${timeout_test} \
90 ./mptcp_connect -p 10000 -j -t ${timeout_poll} \
91 127.0.0.1 >/dev/null &
93 chk_msk_nr 2 "after MPC handshake "
94 chk_msk_remote_key_nr 2 "....chk remote_key"
95 chk_msk_fallback_nr 0 "....chk no fallback"
100 timeout ${timeout_test} \
102 ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} \
106 timeout ${timeout_test} \
108 ./mptcp_connect -p 10001 -j -t ${timeout_poll} \
109 127.0.0.1 >/dev/null &
111 chk_msk_fallback_nr 1 "check fallback"
115 for I in `seq 1 $NR_CLIENTS`; do
117 timeout ${timeout_test} \
119 ./mptcp_connect -p $((I+10001)) -l -w 10 \
120 -t ${timeout_poll} 0.0.0.0 >/dev/null &
124 for I in `seq 1 $NR_CLIENTS`; do
126 timeout ${timeout_test} \
128 ./mptcp_connect -p $((I+10001)) -w 10 \
129 -t ${timeout_poll} 127.0.0.1 >/dev/null &
133 chk_msk_nr $((NR_CLIENTS*2)) "many msk socket present"