freebsd-src/etc/rc.d/auto_linklocal
Mike Makonnen d9fcd86c3a The sysctl(8) program exits on some errors and only emits warnings on
others. In the case where it displayed warnings it would still return
succesfully. Modify it so that it returns the number of sysctls that
it was not able to set.

Make use of this in rc.d to display only *unsuccessfull* attempts to
set sysctls.
2008-06-23 22:06:28 +00:00

34 lines
591 B
Bash

#!/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"