ipv6 privacy extensions

This commit is contained in:
Jörg Thalheim 2015-01-21 15:58:13 +01:00
parent ab8c64bab8
commit c92dd8f0b0
2 changed files with 16 additions and 2 deletions

2
tinc-down Normal file → Executable file
View File

@ -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
}

16
tinc-up
View File

@ -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