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