@@ -86,6 +86,36 @@ change_address() {
8686 fi
8787}
8888
89+ set_limits ()
90+ {
91+ mptcp_lib_pm_nl_set_limits " ${ns1} " " ${@ } "
92+ }
93+
94+ add_endpoint ()
95+ {
96+ mptcp_lib_pm_nl_add_endpoint " ${ns1} " " ${@ } "
97+ }
98+
99+ del_endpoint ()
100+ {
101+ mptcp_lib_pm_nl_del_endpoint " ${ns1} " " ${@ } "
102+ }
103+
104+ flush_endpoint ()
105+ {
106+ mptcp_lib_pm_nl_flush_endpoint " ${ns1} "
107+ }
108+
109+ show_endpoints ()
110+ {
111+ mptcp_lib_pm_nl_show_endpoints " ${ns1} "
112+ }
113+
114+ change_endpoint ()
115+ {
116+ mptcp_lib_pm_nl_change_endpoint " ${ns1} " " ${@ } "
117+ }
118+
89119check ()
90120{
91121 local cmd=" $1 "
@@ -107,47 +137,47 @@ check()
107137 fi
108138}
109139
110- check " ip netns exec $ns1 ./pm_nl_ctl dump " " " " defaults addr list"
140+ check " show_endpoints " " " " defaults addr list"
111141
112142default_limits=" $( get_limits) "
113143if mptcp_lib_expect_all_features; then
114144 check " get_limits" " $( format_limits 0 2) " " defaults limits"
115145fi
116146
117- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1
118- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.2 flags subflow dev lo
119- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.3 flags signal,backup
147+ add_endpoint 10.0.1.1
148+ add_endpoint 10.0.1.2 flags subflow dev lo
149+ add_endpoint 10.0.1.3 flags signal,backup
120150check " get_endpoint 1" " $( format_endpoints " 1,10.0.1.1" ) " " simple add/get addr"
121151
122- check " ip netns exec $ns1 ./pm_nl_ctl dump " \
152+ check " show_endpoints " \
123153 " $( format_endpoints " 1,10.0.1.1" \
124154 " 2,10.0.1.2,subflow,lo" \
125155 " 3,10.0.1.3,signal backup" ) " " dump addrs"
126156
127- ip netns exec $ns1 ./pm_nl_ctl del 2
157+ del_endpoint 2
128158check " get_endpoint 2" " " " simple del addr"
129- check " ip netns exec $ns1 ./pm_nl_ctl dump " \
159+ check " show_endpoints " \
130160 " $( format_endpoints " 1,10.0.1.1" \
131161 " 3,10.0.1.3,signal backup" ) " " dump addrs after del"
132162
133- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.3 2> /dev/null
163+ add_endpoint 10.0.1.3 2> /dev/null
134164check " get_endpoint 4" " " " duplicate addr"
135165
136- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.4 flags signal
166+ add_endpoint 10.0.1.4 flags signal
137167check " get_endpoint 4" " $( format_endpoints " 4,10.0.1.4,signal" ) " " id addr increment"
138168
139169for i in $( seq 5 9) ; do
140- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.$i flags signal > /dev/null 2>&1
170+ add_endpoint " 10.0.1.${i} " flags signal > /dev/null 2>&1
141171done
142172check " get_endpoint 9" " $( format_endpoints " 9,10.0.1.9,signal" ) " " hard addr limit"
143173check " get_endpoint 10" " " " above hard addr limit"
144174
145- ip netns exec $ns1 ./pm_nl_ctl del 9
175+ del_endpoint 9
146176for i in $( seq 10 255) ; do
147- ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.9 id $i
148- ip netns exec $ns1 ./pm_nl_ctl del $i
177+ add_endpoint 10.0.0.9 id " ${i} "
178+ del_endpoint " ${i} "
149179done
150- check " ip netns exec $ns1 ./pm_nl_ctl dump " \
180+ check " show_endpoints " \
151181 " $( format_endpoints " 1,10.0.1.1" \
152182 " 3,10.0.1.3,signal backup" \
153183 " 4,10.0.1.4,signal" \
@@ -156,28 +186,28 @@ check "ip netns exec $ns1 ./pm_nl_ctl dump" \
156186 " 7,10.0.1.7,signal" \
157187 " 8,10.0.1.8,signal" ) " " id limit"
158188
159- ip netns exec $ns1 ./pm_nl_ctl flush
160- check " ip netns exec $ns1 ./pm_nl_ctl dump " " " " flush addrs"
189+ flush_endpoint
190+ check " show_endpoints " " " " flush addrs"
161191
162- ip netns exec $ns1 ./pm_nl_ctl limits 9 1 2> /dev/null
192+ set_limits 9 1 2> /dev/null
163193check " get_limits" " ${default_limits} " " rcv addrs above hard limit"
164194
165- ip netns exec $ns1 ./pm_nl_ctl limits 1 9 2> /dev/null
195+ set_limits 1 9 2> /dev/null
166196check " get_limits" " ${default_limits} " " subflows above hard limit"
167197
168- ip netns exec $ns1 ./pm_nl_ctl limits 8 8
198+ set_limits 8 8
169199check " get_limits" " $( format_limits 8 8) " " set limits"
170200
171- ip netns exec $ns1 ./pm_nl_ctl flush
172- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1
173- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.2
174- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.3 id 100
175- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.4
176- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.5 id 254
177- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.6
178- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.7
179- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.8
180- check " ip netns exec $ns1 ./pm_nl_ctl dump " \
201+ flush_endpoint
202+ add_endpoint 10.0.1.1
203+ add_endpoint 10.0.1.2
204+ add_endpoint 10.0.1.3 id 100
205+ add_endpoint 10.0.1.4
206+ add_endpoint 10.0.1.5 id 254
207+ add_endpoint 10.0.1.6
208+ add_endpoint 10.0.1.7
209+ add_endpoint 10.0.1.8
210+ check " show_endpoints " \
181211 " $( format_endpoints " 1,10.0.1.1" \
182212 " 2,10.0.1.2" \
183213 " 3,10.0.1.7" \
@@ -187,16 +217,16 @@ check "ip netns exec $ns1 ./pm_nl_ctl dump" \
187217 " 254,10.0.1.5" \
188218 " 255,10.0.1.6" ) " " set ids"
189219
190- ip netns exec $ns1 ./pm_nl_ctl flush
191- ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.1
192- ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.2 id 254
193- ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.3
194- ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.4
195- ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.5 id 253
196- ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.6
197- ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.7
198- ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.8
199- check " ip netns exec $ns1 ./pm_nl_ctl dump " \
220+ flush_endpoint
221+ add_endpoint 10.0.0.1
222+ add_endpoint 10.0.0.2 id 254
223+ add_endpoint 10.0.0.3
224+ add_endpoint 10.0.0.4
225+ add_endpoint 10.0.0.5 id 253
226+ add_endpoint 10.0.0.6
227+ add_endpoint 10.0.0.7
228+ add_endpoint 10.0.0.8
229+ check " show_endpoints " \
200230 " $( format_endpoints " 1,10.0.0.1" \
201231 " 2,10.0.0.4" \
202232 " 3,10.0.0.6" \
@@ -206,28 +236,26 @@ check "ip netns exec $ns1 ./pm_nl_ctl dump" \
206236 " 254,10.0.0.2" \
207237 " 255,10.0.0.3" ) " " wrap-around ids"
208238
209- ip netns exec $ns1 ./pm_nl_ctl flush
210- ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1 flags subflow
239+ flush_endpoint
240+ add_endpoint 10.0.1.1 flags subflow
211241change_address 10.0.1.1 backup
212- check " ip netns exec $ns1 ./pm_nl_ctl dump " " $( format_endpoints " 1,10.0.1.1,subflow backup" ) " \
242+ check " show_endpoints " " $( format_endpoints " 1,10.0.1.1,subflow backup" ) " \
213243 " set flags (backup)"
214244change_address 10.0.1.1 nobackup
215- check " ip netns exec $ns1 ./pm_nl_ctl dump " " $( format_endpoints " 1,10.0.1.1,subflow" ) " \
245+ check " show_endpoints " " $( format_endpoints " 1,10.0.1.1,subflow" ) " \
216246 " (nobackup)"
217247
218248# fullmesh support has been added later
219- ip netns exec $ns1 ./pm_nl_ctl set id 1 flags fullmesh 2> /dev/null
220- if ip netns exec $ns1 ./pm_nl_ctl dump | grep -q " fullmesh" ||
249+ change_endpoint 1 fullmesh 2> /dev/null
250+ if show_endpoints | grep -q " fullmesh" ||
221251 mptcp_lib_expect_all_features; then
222- check " ip netns exec $ns1 ./pm_nl_ctl dump" \
223- " $( format_endpoints " 1,10.0.1.1,subflow fullmesh" ) " \
252+ check " show_endpoints" " $( format_endpoints " 1,10.0.1.1,subflow fullmesh" ) " \
224253 " (fullmesh)"
225- ip netns exec $ns1 ./pm_nl_ctl set id 1 flags nofullmesh
226- check " ip netns exec $ns1 ./pm_nl_ctl dump " " $( format_endpoints " 1,10.0.1.1,subflow" ) " \
254+ change_endpoint 1 nofullmesh
255+ check " show_endpoints " " $( format_endpoints " 1,10.0.1.1,subflow" ) " \
227256 " (nofullmesh)"
228- ip netns exec $ns1 ./pm_nl_ctl set id 1 flags backup,fullmesh
229- check " ip netns exec $ns1 ./pm_nl_ctl dump" \
230- " $( format_endpoints " 1,10.0.1.1,subflow backup fullmesh" ) " \
257+ change_endpoint 1 backup,fullmesh
258+ check " show_endpoints" " $( format_endpoints " 1,10.0.1.1,subflow backup fullmesh" ) " \
231259 " (backup,fullmesh)"
232260else
233261 for st in fullmesh nofullmesh backup,fullmesh; do
0 commit comments