2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $NetBSD: rtadvd,v 1.5 2002/03/22 04:34:00 thorpej Exp $
|
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: rtadvd
|
|
|
|
# REQUIRE: DAEMON
|
2002-06-13 22:14:37 +00:00
|
|
|
# BEFORE: LOGIN
|
|
|
|
# KEYWORD: FreeBSD NetBSD
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="rtadvd"
|
2002-06-13 22:14:37 +00:00
|
|
|
rcvar=`set_rcvar`
|
2001-06-16 07:16:14 +00:00
|
|
|
command="/usr/sbin/${name}"
|
|
|
|
start_precmd="rtadvd_precmd"
|
|
|
|
|
2002-06-13 22:14:37 +00:00
|
|
|
case `${CMD_OSTYPE}` in
|
|
|
|
FreeBSD)
|
|
|
|
IS_GATEWAY="checkyesno ipv6_gateway_enable"
|
|
|
|
;;
|
|
|
|
NetBSD)
|
|
|
|
IS_GATEWAY="eval [ \"$ip6mode\" = \"router\" ]"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
rtadvd_precmd()
|
|
|
|
{
|
2002-06-13 22:14:37 +00:00
|
|
|
if ! ${IS_GATEWAY} ; then
|
2001-06-16 07:16:14 +00:00
|
|
|
warn \
|
2002-06-13 22:14:37 +00:00
|
|
|
"${name} cannot be used on IPv6 host, only on an IPv6 router."
|
2001-06-16 07:16:14 +00:00
|
|
|
return 1
|
|
|
|
fi
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
# This should be enabled with a great care.
|
|
|
|
# You may want to fine-tune /etc/rtadvd.conf.
|
|
|
|
#
|
|
|
|
# And if you wish your rtadvd to receive and process
|
|
|
|
# router renumbering messages, specify your Router Renumbering
|
|
|
|
# security policy by -R option.
|
|
|
|
#
|
|
|
|
# See `man 3 ipsec_set_policy` for IPsec policy specification
|
|
|
|
# details.
|
|
|
|
# (CAUTION: This enables your routers prefix renumbering
|
|
|
|
# from another machine, so if you enable this, do it with
|
|
|
|
# enough care.)
|
|
|
|
#
|
|
|
|
case `${CMD_OSTYPE}` in
|
|
|
|
FreeBSD)
|
|
|
|
# If specific interfaces haven't been specified,
|
|
|
|
# get a list of interfaces and enable it on them
|
|
|
|
#
|
|
|
|
case ${rtadvd_interfaces} in
|
|
|
|
'')
|
|
|
|
for i in `ifconfig -l` ; do
|
|
|
|
case $i in
|
|
|
|
lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
rtadvd_interfaces="${rtadvd_interfaces} ${i}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
command_args="${rtadvd_interfaces}"
|
|
|
|
|
|
|
|
# Enable Router Renumbering, unicast case
|
|
|
|
# (use correct src/dst addr)
|
|
|
|
# rtadvd -R "in ipsec ah/transport/fec0:0:0:1::1-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
|
|
|
|
# Enable Router Renumbering, multicast case
|
|
|
|
# (use correct src addr)
|
|
|
|
# rtadvd -R "in ipsec ah/transport/ff05::2-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return 0
|
2001-06-16 07:16:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|