rtadvd revision 98184
1#!/bin/sh 2# 3# $NetBSD: rtadvd,v 1.5 2002/03/22 04:34:00 thorpej Exp $ 4# $FreeBSD: head/etc/rc.d/rtadvd 98184 2002-06-13 22:14:37Z gordon $ 5# 6 7# PROVIDE: rtadvd 8# REQUIRE: DAEMON 9# BEFORE: LOGIN 10# KEYWORD: FreeBSD NetBSD 11 12. /etc/rc.subr 13 14name="rtadvd" 15rcvar=`set_rcvar` 16command="/usr/sbin/${name}" 17start_precmd="rtadvd_precmd" 18 19case `${CMD_OSTYPE}` in 20FreeBSD) 21 IS_GATEWAY="checkyesno ipv6_gateway_enable" 22 ;; 23NetBSD) 24 IS_GATEWAY="eval [ \"$ip6mode\" = \"router\" ]" 25 ;; 26esac 27 28rtadvd_precmd() 29{ 30 if ! ${IS_GATEWAY} ; then 31 warn \ 32 "${name} cannot be used on IPv6 host, only on an IPv6 router." 33 return 1 34 fi 35 36 # This should be enabled with a great care. 37 # You may want to fine-tune /etc/rtadvd.conf. 38 # 39 # And if you wish your rtadvd to receive and process 40 # router renumbering messages, specify your Router Renumbering 41 # security policy by -R option. 42 # 43 # See `man 3 ipsec_set_policy` for IPsec policy specification 44 # details. 45 # (CAUTION: This enables your routers prefix renumbering 46 # from another machine, so if you enable this, do it with 47 # enough care.) 48 # 49 case `${CMD_OSTYPE}` in 50 FreeBSD) 51 # If specific interfaces haven't been specified, 52 # get a list of interfaces and enable it on them 53 # 54 case ${rtadvd_interfaces} in 55 '') 56 for i in `ifconfig -l` ; do 57 case $i in 58 lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*) 59 continue 60 ;; 61 *) 62 rtadvd_interfaces="${rtadvd_interfaces} ${i}" 63 ;; 64 esac 65 done 66 ;; 67 esac 68 command_args="${rtadvd_interfaces}" 69 70 # Enable Router Renumbering, unicast case 71 # (use correct src/dst addr) 72 # rtadvd -R "in ipsec ah/transport/fec0:0:0:1::1-fec0:0:0:10::1/require" ${ipv6_network_interfaces} 73 # Enable Router Renumbering, multicast case 74 # (use correct src addr) 75 # rtadvd -R "in ipsec ah/transport/ff05::2-fec0:0:0:10::1/require" ${ipv6_network_interfaces} 76 ;; 77 esac 78 return 0 79} 80 81load_rc_config $name 82run_rc_command "$1" 83