rtadvd revision 197146
1#!/bin/sh
2#
3# $FreeBSD: head/etc/rc.d/rtadvd 197146 2009-09-12 23:00:01Z hrs $
4#
5
6# PROVIDE: rtadvd
7# REQUIRE: DAEMON
8# BEFORE:  LOGIN
9# KEYWORD: nojail shutdown
10
11. /etc/rc.subr
12. /etc/network.subr
13
14name="rtadvd"
15rcvar=`set_rcvar`
16command="/usr/sbin/${name}"
17start_precmd="rtadvd_precmd"
18
19rtadvd_precmd()
20{
21	if ! checkyesno ipv6_gateway_enable ; then
22		warn \
23		  "${name} cannot be used on IPv6 host, only on an IPv6 router."
24		return 1
25	fi
26
27	# This should be enabled with a great care.
28	# You may want to fine-tune /etc/rtadvd.conf.
29	#
30	# And if you wish your rtadvd to receive and process
31	# router renumbering messages, specify your Router Renumbering
32	# security policy by -R option.
33	#
34	# See `man 3 ipsec_set_policy` for IPsec policy specification
35	# details.
36	# (CAUTION: This enables your routers prefix renumbering
37	# from another machine, so if you enable this, do it with
38	# enough care.)
39	#
40	# If specific interfaces haven't been specified,
41	# get a list of interfaces and enable it on them
42	#
43	case ${rtadvd_interfaces} in
44	[Aa][Uu][Tt][Oo]|'')
45		for i in `ifconfig -l` ; do
46			if is_wired_interface $1; then
47				rtadvd_interfaces="${rtadvd_interfaces} ${i}"
48			fi
49		done
50		;;
51	esac
52	command_args="${rtadvd_interfaces}"
53
54	# Enable Router Renumbering, unicast case
55	# (use correct src/dst addr)
56	# rtadvd -R "in ipsec ah/transport/fec0:0:0:1::1-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
57	# Enable Router Renumbering, multicast case
58	# (use correct src addr)
59	# rtadvd -R "in ipsec ah/transport/ff05::2-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
60	return 0
61}
62
63load_rc_config $name
64run_rc_command "$1"
65