]>
Commit | Line | Data |
---|---|---|
50b3ed57 PP |
1 | #!/bin/bash |
2 | # SPDX-License-Identifier: GPL-2.0 | |
3 | # | |
4 | # setup tunnels for flow dissection test | |
5 | ||
6 | readonly SUFFIX="test_$(mktemp -u XXXX)" | |
7 | CONFIG="remote 127.0.0.2 local 127.0.0.1 dev lo" | |
8 | ||
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} | |
13 | ||
14 | echo "tunnels before test:" | |
15 | ip tunnel show | |
16 | ||
17 | ip link set "ipip_${SUFFIX}" up | |
18 | ip link set "gre_${SUFFIX}" up | |
19 | ip link set "sit_${SUFFIX}" up | |
20 | } | |
21 | ||
22 | ||
23 | cleanup() { | |
24 | ip tunnel del "ipip_${SUFFIX}" | |
25 | ip tunnel del "gre_${SUFFIX}" | |
26 | ip tunnel del "sit_${SUFFIX}" | |
27 | ||
28 | echo "tunnels after test:" | |
29 | ip tunnel show | |
30 | } | |
31 | ||
32 | trap cleanup EXIT | |
33 | ||
34 | setup | |
35 | "$@" | |
36 | exit "$?" |