xref: /freebsd/libexec/rc/rc.d/rtadvd (revision f99f0ee14e3af81c23150a6a340259ca8a33d01a)
10696600cSBjoern A. Zeeb#!/bin/sh
20696600cSBjoern A. Zeeb#
30696600cSBjoern A. Zeeb#
40696600cSBjoern A. Zeeb
50696600cSBjoern A. Zeeb# PROVIDE: rtadvd
60696600cSBjoern A. Zeeb# REQUIRE: DAEMON
70696600cSBjoern A. Zeeb# BEFORE:  LOGIN
80696600cSBjoern A. Zeeb# KEYWORD: nojailvnet shutdown
90696600cSBjoern A. Zeeb
100696600cSBjoern A. Zeeb. /etc/rc.subr
110696600cSBjoern A. Zeeb. /etc/network.subr
120696600cSBjoern A. Zeeb
130696600cSBjoern A. Zeebname="rtadvd"
140696600cSBjoern A. Zeebdesc="Router advertisement daemon"
150696600cSBjoern A. Zeebrcvar="rtadvd_enable"
160696600cSBjoern A. Zeebcommand="/usr/sbin/${name}"
170696600cSBjoern A. Zeebextra_commands="reload"
180696600cSBjoern A. Zeebreload_cmd="rtadvd_reload"
190696600cSBjoern A. Zeebstart_precmd="rtadvd_precmd"
200696600cSBjoern A. Zeeb
21*f99f0ee1SAlexander Leidinger: ${rtadvd_svcj_options:="net_basic"}
22*f99f0ee1SAlexander Leidinger
230696600cSBjoern A. Zeebrtadvd_precmd()
240696600cSBjoern A. Zeeb{
250696600cSBjoern A. Zeeb	# This should be enabled with a great care.
260696600cSBjoern A. Zeeb	# You may want to fine-tune /etc/rtadvd.conf.
270696600cSBjoern A. Zeeb	#
280696600cSBjoern A. Zeeb	# And if you wish your rtadvd to receive and process
290696600cSBjoern A. Zeeb	# router renumbering messages, specify your Router Renumbering
300696600cSBjoern A. Zeeb	# security policy by -R option.
310696600cSBjoern A. Zeeb	#
320696600cSBjoern A. Zeeb	# See `man 3 ipsec_set_policy` for IPsec policy specification
330696600cSBjoern A. Zeeb	# details.
340696600cSBjoern A. Zeeb	# (CAUTION: This enables your routers prefix renumbering
350696600cSBjoern A. Zeeb	# from another machine, so if you enable this, do it with
360696600cSBjoern A. Zeeb	# enough care.)
370696600cSBjoern A. Zeeb	#
380696600cSBjoern A. Zeeb	# If specific interfaces haven't been specified,
390696600cSBjoern A. Zeeb	# get a list of interfaces and enable it on them
400696600cSBjoern A. Zeeb	#
410696600cSBjoern A. Zeeb	case ${rtadvd_interfaces} in
420696600cSBjoern A. Zeeb	[Aa][Uu][Tt][Oo]|'')
430696600cSBjoern A. Zeeb		command_args=
440696600cSBjoern A. Zeeb		for i in `list_net_interfaces`; do
450696600cSBjoern A. Zeeb			case $i in
460696600cSBjoern A. Zeeb			lo0)	continue ;;
470696600cSBjoern A. Zeeb			esac
480696600cSBjoern A. Zeeb			if ipv6if $i; then
490696600cSBjoern A. Zeeb				command_args="${command_args} ${i}"
500696600cSBjoern A. Zeeb			fi
510696600cSBjoern A. Zeeb		done
520696600cSBjoern A. Zeeb		;;
530696600cSBjoern A. Zeeb	[Nn][Oo][Nn][Ee])
540696600cSBjoern A. Zeeb		;;
550696600cSBjoern A. Zeeb	*)
560696600cSBjoern A. Zeeb		command_args="${rtadvd_interfaces}"
570696600cSBjoern A. Zeeb		;;
580696600cSBjoern A. Zeeb	esac
590696600cSBjoern A. Zeeb
600696600cSBjoern A. Zeeb	# Enable Router Renumbering, unicast case
610696600cSBjoern A. Zeeb	# (use correct src/dst addr)
620696600cSBjoern A. Zeeb	# rtadvd -R "in ipsec ah/transport/fec0:0:0:1::1-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
630696600cSBjoern A. Zeeb	# Enable Router Renumbering, multicast case
640696600cSBjoern A. Zeeb	# (use correct src addr)
650696600cSBjoern A. Zeeb	# rtadvd -R "in ipsec ah/transport/ff05::2-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
660696600cSBjoern A. Zeeb	return 0
670696600cSBjoern A. Zeeb}
680696600cSBjoern A. Zeeb
690696600cSBjoern A. Zeebrtadvd_reload() {
700696600cSBjoern A. Zeeb	/usr/sbin/rtadvctl reload
710696600cSBjoern A. Zeeb}
720696600cSBjoern A. Zeeb
730696600cSBjoern A. Zeebload_rc_config $name
74*f99f0ee1SAlexander Leidinger
75*f99f0ee1SAlexander Leidinger# precmd is not compatible with svcj
76*f99f0ee1SAlexander Leidingerrtadvd_svcj="NO"
770696600cSBjoern A. Zeebrun_rc_command "$1"
78