vpn_load () {
CFG="$TCONF/$1/tinc.conf"
- [ -f $CFG ] || { echo "**tinc: $CFG does not exist!" >&2 ; return 1 }
+ [ -f $CFG ] || { echo "**tinc: $CFG does not exist!" >&2; return 1; }
# load TINCD config
DEV=`grep -i -e '^[[:space:]]*TapDevice' $CFG | sed 's/[[:space:]]//g; s/^.*=//g'`
# discourage empty and multiple entries
[ -z "$DEV" ] && \
- { echo "**tinc: TapDevice required!" >&2 ; return 2 }
+ { echo "**tinc: TapDevice required!" >&2; return 2; }
echo $DEV | grep -q '^/dev/tap' ||
- { echo "**tinc: TapDevice should be in form /dev/tapX" >&2 ; return 2 }
+ { echo "**tinc: TapDevice should be in form /dev/tapX" >&2; return 2; }
[ `echo $DEV | wc -l` -gt 1 ] && \
- { echo "**tinc: multiple TapDevice entries not allowed!" >&2 ; return 3 }
+ { echo "**tinc: multiple TapDevice entries not allowed!" >&2; return 3; }
[ -z "$VPN" ] && \
- { echo "**tinc: MyOwnVPNIP/MyVirtualIP required!" >&2 ; return 2 }
+ { echo "**tinc: MyOwnVPNIP/MyVirtualIP required!" >&2; return 2; }
[ `echo $VPN | wc -l` -gt 1 ] && \
- { echo "**tinc: multiple MyOwnVPNIP/MyVirtualIP entries not allowed!" >&2 ; return 3 }
+ { echo "**tinc: multiple MyOwnVPNIP/MyVirtualIP entries not allowed!" >&2; return 3; }
echo $VPN | grep -q -x \
'\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\}/[[:digit:]]\{1,2\}' || \
- { echo "**tinc: badly formed MyOwnVPNIP/MyVirtualIP address $VPN!" ; return 3 }
+ { echo "**tinc: badly formed MyOwnVPNIP/MyVirtualIP address $VPN!"; return 3; }
# network device
TAP=`echo $DEV | cut -d"/" -f3`
vpn_start () {
- vpn_load $1 || { echo "**tinc: could not vpn_load $1" >&2 ; return 1 }
+ vpn_load $1 || { echo "**tinc: could not vpn_load $1" >&2; return 1; }
# create device file
if [ ! -c $DEV ]; then
# load device module
{ insmod ethertap --name="ethertap$NUM" unit="$NUM" 2>&1 || \
- { echo "**tinc: cannot insmod ethertap$NUM" >&2 ; return 2 }
+ { echo "**tinc: cannot insmod ethertap$NUM" >&2; return 2; }
} | grep -v '^Us'
# configure the interface
# start tincd
$TINCD --net="$1" $DEBUG || \
- { echo "**tinc: could not start $TINCD" >&2; return 3 }
+ { echo "**tinc: could not start $TINCD" >&2; return 3; }
# default interface route
# ip route add $NET/$LEN dev $TAP