aboutsummaryrefslogblamecommitdiffstats
path: root/main/tunnel/tunnel
blob: a710f6b64454e0376bf916c51bfeb285f8ca15a9 (plain) (tree)

























                                                                
#!/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