Sync usage with man page.
[netbsd-mini2440.git] / etc / rc.d / ipsec
blob23130a234411ea6b902b04e98bdda86d45beb383
1 #!/bin/sh
3 # $NetBSD: ipsec,v 1.10 2008/11/12 12:35:52 ad Exp $
6 # PROVIDE: ipsec
7 # REQUIRE: root bootconf mountcritlocal tty
8 # BEFORE: DAEMON
10 $_rc_subr_loaded . /etc/rc.subr
12 name="ipsec"
13 rcvar=$name
14 start_precmd="ipsec_prestart"
15 start_cmd="ipsec_start"
16 stop_precmd="test -f /etc/ipsec.conf"
17 stop_cmd="ipsec_stop"
18 reload_cmd="ipsec_reload"
19 extra_commands="reload"
21 ipsec_prestart()
23 if [ ! -f /etc/ipsec.conf ]; then
24 warn "/etc/ipsec.conf not readable; ipsec start aborted."
26 stop_boot
27 return 1
29 return 0
32 ipsec_start()
34 echo "Installing ipsec manual keys/policies."
35 /sbin/setkey -f /etc/ipsec.conf
38 ipsec_stop()
40 echo "Clearing ipsec manual keys/policies."
42 # still not 100% sure if we would like to do this.
43 # it is very questionable to do this during shutdown session, since
44 # it can hang any of remaining IPv4/v6 session.
46 /sbin/setkey -F
47 /sbin/setkey -FP
50 ipsec_reload()
52 echo "Reloading ipsec manual keys/policies."
53 /sbin/setkey -F
54 /sbin/setkey -FP
55 /sbin/setkey -f /etc/ipsec.conf
58 load_rc_config $name
59 run_rc_command "$1"