diff --git a/tinc-down b/tinc-down old mode 100644 new mode 100755 index 476cc72..beed7b0 --- a/tinc-down +++ b/tinc-down @@ -8,7 +8,7 @@ stop_dhclient() { local pid_file="/var/run/dhclient.${interface}.pid" if [[ "$OSTYPE" == "linux-gnu" ]]; then dhclient -r -x - elif [[ -f "$pid_file" ] + elif [[ -f "$pid_file" ]]; then kill "$(< $pid_file)" fi } diff --git a/tinc-up b/tinc-up index eb170fd..763fa6e 100755 --- a/tinc-up +++ b/tinc-up @@ -89,6 +89,17 @@ start_dhcp() { fi } +disable_ipv6_privacy() { + local interface=$1 + if [[ "$OSTYPE" == "linux-gnu" ]]; then + sysctl -w "net.ipv6.conf.${interface}.use_tempaddr=0" + elif [[ "$OSTYPE" == "openbsd"* ]]; then + ifconfig "${interface}" -autoconfprivacy + elif has sysctl; then + sysctl -w net.inet6.ip6.use_tempaddr=0 + fi +} + [ -z "${INTERFACE:-}" ] && die "no INTERFACE environment variable set" DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) @@ -113,4 +124,7 @@ if [ -e $SUBNET_FILE ]; then else start_dhcp "$INTERFACE" fi -[ -x "$LOCAL_HOOK_FILE" ] && "$LOCAL_HOOK_FILE" + +disable_ipv6_privacy "$INTERFACE" + +[ -x "$LOCAL_HOOK_FILE" ] && "$LOCAL_HOOK_FILE" || true