aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tunnel/tunnel
blob: a710f6b64454e0376bf916c51bfeb285f8ca15a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

# Tunnel interface configuration script
# Copyright (c) 2017 Kaarle Ritvanen

PARAMS=$(set | sed -E '
	s/^IF_TUNNEL_([A-Z0-9_]+)=(.+)/\1\n\2/
	ta
	d
	:a
	h
	y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
	P
	g
	s/.*\n//
	')

[ "$PARAMS" ] || exit 0

if [ $MODE = start ]; then
	eval ip tunnel add $IFACE $PARAMS
elif [ $MODE = stop ]; then
	ip tunnel del $IFACE
else
	exit 1
fi