xref: /freebsd/libexec/rc/rc.d/rtadvd (revision 96190b4fef3b4a0cc3ca0606b0c4e3e69a5e6717)
1#!/bin/sh
2#
3#
4
5# PROVIDE: rtadvd
6# REQUIRE: DAEMON
7# BEFORE:  LOGIN
8# KEYWORD: nojailvnet shutdown
9
10. /etc/rc.subr
11. /etc/network.subr
12
13name="rtadvd"
14desc="Router advertisement daemon"
15rcvar="rtadvd_enable"
16command="/usr/sbin/${name}"
17extra_commands="reload"
18reload_cmd="rtadvd_reload"
19start_precmd="rtadvd_precmd"
20
21: ${rtadvd_svcj_options:="net_basic"}
22
23rtadvd_precmd()
24{
25	# This should be enabled with a great care.
26	# You may want to fine-tune /etc/rtadvd.conf.
27	#
28	# And if you wish your rtadvd to receive and process
29	# router renumbering messages, specify your Router Renumbering
30	# security policy by -R option.
31	#
32	# See `man 3 ipsec_set_policy` for IPsec policy specification
33	# details.
34	# (CAUTION: This enables your routers prefix renumbering
35	# from another machine, so if you enable this, do it with
36	# enough care.)
37	#
38	# If specific interfaces haven't been specified,
39	# get a list of interfaces and enable it on them
40	#
41	case ${rtadvd_interfaces} in
42	[Aa][Uu][Tt][Oo]|'')
43		command_args=
44		for i in `list_net_interfaces`; do
45			case $i in
46			lo0)	continue ;;
47			esac
48			if ipv6if $i; then
49				command_args="${command_args} ${i}"
50			fi
51		done
52		;;
53	[Nn][Oo][Nn][Ee])
54		;;
55	*)
56		command_args="${rtadvd_interfaces}"
57		;;
58	esac
59
60	# Enable Router Renumbering, unicast case
61	# (use correct src/dst addr)
62	# rtadvd -R "in ipsec ah/transport/fec0:0:0:1::1-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
63	# Enable Router Renumbering, multicast case
64	# (use correct src addr)
65	# rtadvd -R "in ipsec ah/transport/ff05::2-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
66	return 0
67}
68
69rtadvd_reload() {
70	/usr/sbin/rtadvctl reload
71}
72
73load_rc_config $name
74
75# precmd is not compatible with svcj
76rtadvd_svcj="NO"
77run_rc_command "$1"
78