xref: /freebsd/libexec/rc/rc.d/rtadvd (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
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
21rtadvd_precmd()
22{
23	# This should be enabled with a great care.
24	# You may want to fine-tune /etc/rtadvd.conf.
25	#
26	# And if you wish your rtadvd to receive and process
27	# router renumbering messages, specify your Router Renumbering
28	# security policy by -R option.
29	#
30	# See `man 3 ipsec_set_policy` for IPsec policy specification
31	# details.
32	# (CAUTION: This enables your routers prefix renumbering
33	# from another machine, so if you enable this, do it with
34	# enough care.)
35	#
36	# If specific interfaces haven't been specified,
37	# get a list of interfaces and enable it on them
38	#
39	case ${rtadvd_interfaces} in
40	[Aa][Uu][Tt][Oo]|'')
41		command_args=
42		for i in `list_net_interfaces`; do
43			case $i in
44			lo0)	continue ;;
45			esac
46			if ipv6if $i; then
47				command_args="${command_args} ${i}"
48			fi
49		done
50		;;
51	[Nn][Oo][Nn][Ee])
52		;;
53	*)
54		command_args="${rtadvd_interfaces}"
55		;;
56	esac
57
58	# Enable Router Renumbering, unicast case
59	# (use correct src/dst addr)
60	# rtadvd -R "in ipsec ah/transport/fec0:0:0:1::1-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
61	# Enable Router Renumbering, multicast case
62	# (use correct src addr)
63	# rtadvd -R "in ipsec ah/transport/ff05::2-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
64	return 0
65}
66
67rtadvd_reload() {
68	/usr/sbin/rtadvctl reload
69}
70
71load_rc_config $name
72run_rc_command "$1"
73