aboutsummaryrefslogtreecommitdiff
path: root/etc/rc.d/rtadvd
blob: 99b700d2c8261c64f16f26ca8f8b93ebf6d5f7f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: rtadvd
# REQUIRE: DAEMON
# BEFORE:  LOGIN
# KEYWORD: nojail shutdown

. /etc/rc.subr
. /etc/network.subr

name="rtadvd"
rcvar=`set_rcvar`
command="/usr/sbin/${name}"
start_precmd="rtadvd_precmd"

rtadvd_precmd()
{
	if ! checkyesno ipv6_gateway_enable ; then
		warn \
		  "${name} cannot be used on IPv6 host, only on an IPv6 router."
		return 1
	fi

	# 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.)
	#
	# If specific interfaces haven't been specified,
	# get a list of interfaces and enable it on them
	#
	case ${rtadvd_interfaces} in
	[Aa][Uu][Tt][Oo]|'')
		for i in `ifconfig -l` ; do
			case $i in
			lo0)	continue ;;
			esac
			if ipv6if $i; then
				rtadvd_interfaces="${rtadvd_interfaces} ${i}"
			fi
		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}
	return 0
}

load_rc_config $name
run_rc_command "$1"