]>
git.ipfire.org Git - thirdparty/linux.git/blob - tools/testing/selftests/net/mptcp/pm_netlink.sh
2 # SPDX-License-Identifier: GPL-2.0
8 echo "Usage: $0 [ -h ]"
12 while getopts "$optstring" option
;do
26 rndh
=$
(printf %x
$sec)-$
(mktemp
-u XXXXXX
)
37 ip
-Version > /dev
/null
2>&1
39 echo "SKIP: Could not run test without ip tool"
45 ip netns add
$ns1 ||
exit $ksft_skip
46 ip
-net $ns1 link
set lo up
47 ip netns
exec $ns1 sysctl
-q net.mptcp.enabled
=1
54 local out
=`$cmd 2>$err`
57 printf "%-50s %s" "$msg"
58 if [ $cmd_ret -ne 0 ]; then
59 echo "[FAIL] command execution '$cmd' stderr "
62 elif [ "$out" = "$expected" ]; then
66 echo "expected '$expected' got '$out'"
71 check
"ip netns exec $ns1 ./pm_nl_ctl dump" "" "defaults addr list"
72 check
"ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0
73 subflows 0" "defaults limits"
75 ip netns
exec $ns1 .
/pm_nl_ctl add
10.0.1.1
76 ip netns
exec $ns1 .
/pm_nl_ctl add
10.0.1.2 flags subflow dev lo
77 ip netns
exec $ns1 .
/pm_nl_ctl add
10.0.1.3 flags signal
,backup
78 check
"ip netns exec $ns1 ./pm_nl_ctl get 1" "id 1 flags 10.0.1.1" "simple add/get addr"
80 check
"ip netns exec $ns1 ./pm_nl_ctl dump" \
82 id 2 flags subflow dev lo 10.0.1.2
83 id 3 flags signal,backup 10.0.1.3" "dump addrs"
85 ip netns
exec $ns1 .
/pm_nl_ctl del
2
86 check
"ip netns exec $ns1 ./pm_nl_ctl get 2" "" "simple del addr"
87 check
"ip netns exec $ns1 ./pm_nl_ctl dump" \
89 id 3 flags signal,backup 10.0.1.3" "dump addrs after del"
91 ip netns
exec $ns1 .
/pm_nl_ctl add
10.0.1.3
92 check
"ip netns exec $ns1 ./pm_nl_ctl get 4" "" "duplicate addr"
94 ip netns
exec $ns1 .
/pm_nl_ctl add
10.0.1.4 id
10 flags signal
95 check
"ip netns exec $ns1 ./pm_nl_ctl get 4" "id 4 flags signal 10.0.1.4" "id addr increment"
97 for i
in `seq 5 9`; do
98 ip netns
exec $ns1 .
/pm_nl_ctl add
10.0.1.
$i flags signal
>/dev
/null
2>&1
100 check
"ip netns exec $ns1 ./pm_nl_ctl get 9" "id 9 flags signal 10.0.1.9" "hard addr limit"
101 check
"ip netns exec $ns1 ./pm_nl_ctl get 10" "" "above hard addr limit"
103 for i
in `seq 9 256`; do
104 ip netns
exec $ns1 .
/pm_nl_ctl del
$i
105 ip netns
exec $ns1 .
/pm_nl_ctl add
10.0.0.9
107 check
"ip netns exec $ns1 ./pm_nl_ctl dump" "id 1 flags 10.0.1.1
108 id 3 flags signal,backup 10.0.1.3
109 id 4 flags signal 10.0.1.4
110 id 5 flags signal 10.0.1.5
111 id 6 flags signal 10.0.1.6
112 id 7 flags signal 10.0.1.7
113 id 8 flags signal 10.0.1.8" "id limit"
115 ip netns
exec $ns1 .
/pm_nl_ctl flush
116 check
"ip netns exec $ns1 ./pm_nl_ctl dump" "" "flush addrs"
118 ip netns
exec $ns1 .
/pm_nl_ctl limits
9 1
119 check
"ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0
120 subflows 0" "rcv addrs above hard limit"
122 ip netns
exec $ns1 .
/pm_nl_ctl limits
1 9
123 check
"ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0
124 subflows 0" "subflows above hard limit"
126 ip netns
exec $ns1 .
/pm_nl_ctl limits
8 8
127 check
"ip netns exec $ns1 ./pm_nl_ctl limits" "accept 8
128 subflows 8" "set limits"