We don't have lkm, use aftermountlkm instead.
[dragonfly.git] / etc / rc.d / ipsec
1 #!/bin/sh
2 #
3 # $NetBSD: ipsec,v 1.7 2002/03/22 04:33:58 thorpej Exp $
4 # $FreeBSD: src/etc/rc.d/ipsec,v 1.5 2003/02/16 20:46:08 mtm Exp $
5 # $DragonFly: src/etc/rc.d/ipsec,v 1.3 2004/01/26 17:21:15 rob Exp $
6 #
7
8 # PROVIDE: ipsec
9 # REQUIRE: root beforenetlkm mountcritlocal tty
10 # BEFORE:  DAEMON
11 # KEYWORD: DragonFly 
12
13 #       it does not really require beforenetlkm.
14
15 . /etc/rc.subr
16
17 name="ipsec"
18 rcvar=`set_rcvar`
19 start_precmd="ipsec_prestart"
20 start_cmd="ipsec_start"
21 stop_precmd="test -f /etc/ipsec.conf"
22 stop_cmd="ipsec_stop"
23 reload_cmd="ipsec_reload"
24 extra_commands="reload"
25 ipsec_program="/usr/sbin/setkey"
26 # ipsec_file is set by rc.conf
27
28 ipsec_prestart()
29 {
30         if [ ! -f "$ipsec_file" ]; then
31                 warn "$ipsec_file not readable; ipsec start aborted."
32                         #
33                         # If booting directly to multiuser, send SIGTERM to
34                         # the parent (/etc/rc) to abort the boot
35                         #
36                 if [ "$autoboot" = yes ]; then
37                         echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
38                         kill -TERM $$
39                         exit 1
40                 fi
41                 return 1
42         fi
43         return 0
44 }
45
46 ipsec_start()
47 {
48         echo "Installing ipsec manual keys/policies."
49         ${ipsec_program} -f $ipsec_file
50 }
51
52 ipsec_stop()
53 {
54         echo "Clearing ipsec manual keys/policies."
55
56         # still not 100% sure if we would like to do this.
57         # it is very questionable to do this during shutdown session, since
58         # it can hang any of remaining IPv4/v6 session.
59         #
60         ${ipsec_program} -F
61         ${ipsec_program} -FP
62 }
63
64 ipsec_reload()
65 {
66         echo "Reloading ipsec manual keys/policies."
67         ${ipsec_program} -F
68         ${ipsec_program} -FP
69         ${ipsec_program} -f "$ipsec_file"
70 }
71
72 load_rc_config $name
73 run_rc_command "$1"