0001
0002
0003
0004
0005
0006 readonly SUFFIX="test_$(mktemp -u XXXX)"
0007 CONFIG="remote 127.0.0.2 local 127.0.0.1 dev lo"
0008
0009 setup() {
0010 ip link add "ipip_${SUFFIX}" type ipip ${CONFIG}
0011 ip link add "gre_${SUFFIX}" type gre ${CONFIG}
0012 ip link add "sit_${SUFFIX}" type sit ${CONFIG}
0013
0014 echo "tunnels before test:"
0015 ip tunnel show
0016
0017 ip link set "ipip_${SUFFIX}" up
0018 ip link set "gre_${SUFFIX}" up
0019 ip link set "sit_${SUFFIX}" up
0020 }
0021
0022
0023 cleanup() {
0024 ip tunnel del "ipip_${SUFFIX}"
0025 ip tunnel del "gre_${SUFFIX}"
0026 ip tunnel del "sit_${SUFFIX}"
0027
0028 echo "tunnels after test:"
0029 ip tunnel show
0030 }
0031
0032 trap cleanup EXIT
0033
0034 setup
0035 "$@"
0036 exit "$?"