Skip to content

Commit 8d019b1

Browse files
vladimirolteandavem330
authored andcommitted
selftests: net: local_termination: refactor macvlan creation/deletion
This will be used in other subtests as well; make new macvlan_create() and macvlan_destroy() functions. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b153b3c commit 8d019b1

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

tools/testing/selftests/net/forwarding/local_termination.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,29 @@ bridge_destroy()
247247
ip link del br0
248248
}
249249

250-
standalone()
250+
macvlan_create()
251251
{
252-
h1_create
253-
h2_create
252+
local lower=$1
254253

255-
ip link add link $h2 name macvlan0 type macvlan mode private
254+
ip link add link $lower name macvlan0 type macvlan mode private
256255
ip link set macvlan0 address $MACVLAN_ADDR
257256
ip link set macvlan0 up
257+
}
258258

259-
run_test $h2
260-
259+
macvlan_destroy()
260+
{
261261
ip link del macvlan0
262+
}
263+
264+
standalone()
265+
{
266+
h1_create
267+
h2_create
268+
macvlan_create $h2
269+
270+
run_test $h2
262271

272+
macvlan_destroy
263273
h2_destroy
264274
h1_destroy
265275
}
@@ -268,15 +278,11 @@ bridge()
268278
{
269279
h1_create
270280
bridge_create
271-
272-
ip link add link br0 name macvlan0 type macvlan mode private
273-
ip link set macvlan0 address $MACVLAN_ADDR
274-
ip link set macvlan0 up
281+
macvlan_create br0
275282

276283
run_test br0
277284

278-
ip link del macvlan0
279-
285+
macvlan_destroy
280286
bridge_destroy
281287
h1_destroy
282288
}

0 commit comments

Comments
 (0)