freebsd-dev/etc/rc.d/auto_linklocal

34 lines
591 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: auto_linklocal
# REQUIRE: root
# BEFORE: sysctl
# KEYWORD: nojail
. /etc/rc.subr
. /etc/network.subr
name="auto_linklocal"
start_cmd="auto_linklocal_start"
stop_cmd=":"
auto_linklocal_start()
{
if ! checkyesno ipv6_enable && ${SYSCTL} net.inet6 > /dev/null 2>&1; then
if ! ${SYSCTL_W} net.inet6.ip6.auto_linklocal=0 >/dev/null 2>&1; then
warn "failed to set sysctl(8)"
return 1
fi
laddr=`network6_getladdr lo0`
if [ -z "${laddr}" ]; then
ifconfig lo0 inet6 fe80::1 prefixlen 64
fi
fi
}
load_rc_config $name
run_rc_command "$1"