freebsd-dev/etc/rc.d/auto_linklocal
Hiroki Sato 6027060830 Add a link-local address to the lo0 even when ipv6_enable="NO".
A kernel with INET6 always has ::1 on lo0, so in the case of
ipv6_enable="NO" the lo0 can have ::1 with no link-local address.
This is a violation of the IPv6 specification.  As a workaround for
this situation, fe80::1 is added in rc.d/auto_linklocal when lo0 has
no link-local address.  This should not be harmful for IPv4-only users.
2006-12-08 06:34:06 +00:00

30 lines
495 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: auto_linklocal
# REQUIRE: root
# BEFORE: sysctl
. /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
${SYSCTL_W} net.inet6.ip6.auto_linklocal=0
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"