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