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