apply tinc settings on startup

This commit is contained in:
Jörg Thalheim 2015-01-26 13:53:10 +01:00
parent 73ecff4f92
commit d86f343716
1 changed files with 14 additions and 7 deletions

21
tinc-up
View File

@ -114,8 +114,11 @@ TINCRC="${DIR}/tincrc"
MAC_ADDRESS=""
SUBNET=""
DHCP="YES"
IPV6_PRIVACY="YES"
DHCP="yes"
IPV6_PRIVACY="yes"
TINC_AUTOCONNECT="yes"
TINC_TIMEOUT="300"
source "${TINCRC}" || true
@ -128,18 +131,22 @@ fi
set_mac "$INTERFACE" "$MAC_ADDRESS"
if [ -n "$SUBNET" ]; then
IFS=' ' read IP NETMASK <<< "$SUBNET"
[ -z "$IP" ] && die "no ip set in SUBNET"
[ -z "$NETMASK" ] && die "no netmask set in SUBNET"
IFS=' ' read ip netmask <<< "$SUBNET"
[ -z "$ip" ] && die "no ip set in SUBNET"
[ -z "$netmask" ] && die "no netmask set in SUBNET"
set_ip "$INTERFACE" "$IP" "$NETMASK"
fi
if [ "$DHCP" = "YES" ]; then
if [ "${DHCP,,}" = "yes" ]; then
start_dhcp "$INTERFACE"
fi
if [[ "$IPV6_PRIVACY" != "YES" ]]; then
if [[ "${IPV6_PRIVACY,,}" != "yes" ]]; then
disable_ipv6_privacy "$INTERFACE"
fi
tinc -c "$DIR" set AutoConnect "$TINC_AUTOCONNECT"
tinc -c "$DIR" set MaxTimeout "$TINC_TIMEOUT"
tinc -c "$DIR" set Mode switch
[ -x "$LOCAL_HOOK_FILE" ] && "$LOCAL_HOOK_FILE" || true