rtadvd revision 262557
150472Speter#!/bin/sh
238738Sbrian#
337Srgrimes# $FreeBSD: stable/10/etc/rc.d/rtadvd 262557 2014-02-27 13:19:17Z des $
437Srgrimes#
537Srgrimes
637Srgrimes# PROVIDE: rtadvd
737Srgrimes# REQUIRE: DAEMON
837Srgrimes# BEFORE:  LOGIN
937Srgrimes# KEYWORD: nojail shutdown
1037Srgrimes
11476Srgrimes. /etc/rc.subr
1237Srgrimes. /etc/network.subr
1337Srgrimes
1437Srgrimesname="rtadvd"
1537Srgrimesrcvar="rtadvd_enable"
1637Srgrimescommand="/usr/sbin/${name}"
1737Srgrimesextra_commands="reload"
1837Srgrimesreload_cmd="rtadvd_reload"
1937Srgrimesstart_precmd="rtadvd_precmd"
2037Srgrimes
2137Srgrimesrtadvd_precmd()
2237Srgrimes{
2337Srgrimes	# This should be enabled with a great care.
2437Srgrimes	# You may want to fine-tune /etc/rtadvd.conf.
2537Srgrimes	#
2637Srgrimes	# And if you wish your rtadvd to receive and process
2737Srgrimes	# router renumbering messages, specify your Router Renumbering
2837Srgrimes	# security policy by -R option.
2937Srgrimes	#
3037Srgrimes	# See `man 3 ipsec_set_policy` for IPsec policy specification
3137Srgrimes	# details.
321141Sache	# (CAUTION: This enables your routers prefix renumbering
331141Sache	# from another machine, so if you enable this, do it with
341141Sache	# enough care.)
351141Sache	#
361141Sache	# If specific interfaces haven't been specified,
377708Srgrimes	# get a list of interfaces and enable it on them
3811137Sjoerg	#
3911137Sjoerg	case ${rtadvd_interfaces} in
401141Sache	[Aa][Uu][Tt][Oo]|'')
4111137Sjoerg		command_args=
4211137Sjoerg		for i in `list_net_interfaces`; do
4311137Sjoerg			case $i in
4411137Sjoerg			lo0)	continue ;;
4511137Sjoerg			esac
4611137Sjoerg			if ipv6if $i; then
4711137Sjoerg				command_args="${command_args} ${i}"
4811137Sjoerg			fi
4911137Sjoerg		done
501141Sache		;;
511141Sache	[Nn][Oo][Nn][Ee])
521141Sache		;;
531141Sache	*)
541141Sache		command_args="${rtadvd_interfaces}"
551141Sache		;;
561141Sache	esac
571141Sache
581141Sache	# Enable Router Renumbering, unicast case
591141Sache	# (use correct src/dst addr)
601141Sache	# rtadvd -R "in ipsec ah/transport/fec0:0:0:1::1-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
611141Sache	# Enable Router Renumbering, multicast case
621141Sache	# (use correct src addr)
631182Srgrimes	# rtadvd -R "in ipsec ah/transport/ff05::2-fec0:0:0:10::1/require" ${ipv6_network_interfaces}
641144Sache	return 0
651141Sache}
661141Sache
671141Sachertadvd_reload() {
681141Sache	/usr/sbin/rtadvctl reload
691182Srgrimes}
701141Sache
711141Sacheload_rc_config $name
721141Sacherun_rc_command "$1"
731141Sache