1#!/bin/sh 2#
| 1#!/bin/sh 2#
|
3# $NetBSD: rtadvd,v 1.3 2000/05/13 08:45:09 lukem Exp $
| 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 $
|
4# 5 6# PROVIDE: rtadvd 7# REQUIRE: DAEMON
| 5# 6 7# PROVIDE: rtadvd 8# REQUIRE: DAEMON
|
| 9# BEFORE: LOGIN 10# KEYWORD: FreeBSD NetBSD
|
8 9. /etc/rc.subr 10 11name="rtadvd"
| 11 12. /etc/rc.subr 13 14name="rtadvd"
|
12rcvar=$name
| 15rcvar=`set_rcvar`
|
13command="/usr/sbin/${name}" 14start_precmd="rtadvd_precmd" 15
| 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
|
16rtadvd_precmd() 17{
| 28rtadvd_precmd() 29{
|
18 if [ "$ip6mode" != "router" ]; then
| 30 if ! ${IS_GATEWAY} ; then
|
19 warn \
| 31 warn \
|
20 "${name} cannot be used on IPv6 host, only on an IPv6 router."
| 32 "${name} cannot be used on IPv6 host, only on an IPv6 router."
|
21 return 1 22 fi
| 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
|
23} 24 25load_rc_config $name 26run_rc_command "$1"
| 79} 80 81load_rc_config $name 82run_rc_command "$1"
|