ipsec revision 1.9
1#!/bin/sh 2# 3# $NetBSD: ipsec,v 1.9 2007/04/06 14:20:17 apb Exp $ 4# 5 6# PROVIDE: ipsec 7# REQUIRE: root beforenetlkm mountcritlocal tty 8# BEFORE: DAEMON 9 10# it does not really require beforenetlkm. 11 12$_rc_subr_loaded . /etc/rc.subr 13 14name="ipsec" 15rcvar=$name 16start_precmd="ipsec_prestart" 17start_cmd="ipsec_start" 18stop_precmd="test -f /etc/ipsec.conf" 19stop_cmd="ipsec_stop" 20reload_cmd="ipsec_reload" 21extra_commands="reload" 22 23ipsec_prestart() 24{ 25 if [ ! -f /etc/ipsec.conf ]; then 26 warn "/etc/ipsec.conf not readable; ipsec start aborted." 27 28 stop_boot 29 return 1 30 fi 31 return 0 32} 33 34ipsec_start() 35{ 36 echo "Installing ipsec manual keys/policies." 37 /sbin/setkey -f /etc/ipsec.conf 38} 39 40ipsec_stop() 41{ 42 echo "Clearing ipsec manual keys/policies." 43 44 # still not 100% sure if we would like to do this. 45 # it is very questionable to do this during shutdown session, since 46 # it can hang any of remaining IPv4/v6 session. 47 # 48 /sbin/setkey -F 49 /sbin/setkey -FP 50} 51 52ipsec_reload() 53{ 54 echo "Reloading ipsec manual keys/policies." 55 /sbin/setkey -F 56 /sbin/setkey -FP 57 /sbin/setkey -f /etc/ipsec.conf 58} 59 60load_rc_config $name 61run_rc_command "$1" 62