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