WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / with_tunnels.sh
blobe24949ed3a20813e34bd69bdd634b0f32b7a26e9
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 # setup tunnels for flow dissection test
6 readonly SUFFIX="test_$(mktemp -u XXXX)"
7 CONFIG="remote 127.0.0.2 local 127.0.0.1 dev lo"
9 setup() {
10 ip link add "ipip_${SUFFIX}" type ipip ${CONFIG}
11 ip link add "gre_${SUFFIX}" type gre ${CONFIG}
12 ip link add "sit_${SUFFIX}" type sit ${CONFIG}
14 echo "tunnels before test:"
15 ip tunnel show
17 ip link set "ipip_${SUFFIX}" up
18 ip link set "gre_${SUFFIX}" up
19 ip link set "sit_${SUFFIX}" up
23 cleanup() {
24 ip tunnel del "ipip_${SUFFIX}"
25 ip tunnel del "gre_${SUFFIX}"
26 ip tunnel del "sit_${SUFFIX}"
28 echo "tunnels after test:"
29 ip tunnel show
32 trap cleanup EXIT
34 setup
35 "$@"
36 exit "$?"