ipsec revision 1.6
11.1Sitojun#!/bin/sh 21.1Sitojun# 31.6Slukem# $NetBSD: ipsec,v 1.6 2000/09/19 13:04:38 lukem Exp $ 41.1Sitojun# 51.1Sitojun 61.1Sitojun# PROVIDE: ipsec 71.1Sitojun# REQUIRE: root beforenetlkm mountcritlocal tty 81.1Sitojun 91.1Sitojun# it does not really require beforenetlkm. 101.1Sitojun 111.1Sitojun. /etc/rc.subr 121.1Sitojun 131.1Sitojunname="ipsec" 141.6Slukemrcvar=$name 151.4Slukemstart_precmd="ipsec_prestart" 161.1Sitojunstart_cmd="ipsec_start" 171.6Slukemstop_precmd="test -f /etc/ipsec.conf" 181.1Sitojunstop_cmd="ipsec_stop" 191.1Sitojunreload_cmd="ipsec_reload" 201.1Sitojunextra_commands="reload" 211.1Sitojun 221.5Slukemipsec_prestart() 231.1Sitojun{ 241.1Sitojun if [ ! -f /etc/ipsec.conf ]; then 251.4Slukem warn "/etc/ipsec.conf not readable; ipsec start aborted." 261.5Slukem # 271.5Slukem # If booting directly to multiuser, send SIGTERM to 281.5Slukem # the parent (/etc/rc) to abort the boot 291.5Slukem # 301.5Slukem if [ "$autoboot" = yes ]; then 311.5Slukem echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!" 321.5Slukem kill -TERM $$ 331.5Slukem exit 1 341.5Slukem fi 351.4Slukem return 1 361.1Sitojun fi 371.4Slukem return 0 381.4Slukem} 391.4Slukem 401.4Slukemipsec_start() 411.4Slukem{ 421.1Sitojun echo "Installing ipsec manual keys/policies." 431.1Sitojun /sbin/setkey -f /etc/ipsec.conf 441.1Sitojun} 451.1Sitojun 461.1Sitojunipsec_stop() 471.1Sitojun{ 481.3Sitojun echo "Clearing ipsec manual keys/policies." 491.1Sitojun 501.1Sitojun # still not 100% sure if we would like to do this. 511.1Sitojun # it is very questionable to do this during shutdown session, since 521.1Sitojun # it can hang any of remaining IPv4/v6 session. 531.1Sitojun # 541.1Sitojun /sbin/setkey -F 551.1Sitojun /sbin/setkey -FP 561.1Sitojun} 571.1Sitojun 581.1Sitojunipsec_reload() 591.1Sitojun{ 601.1Sitojun echo "Reloading ipsec manual keys/policies." 611.1Sitojun /sbin/setkey -F 621.1Sitojun /sbin/setkey -FP 631.1Sitojun /sbin/setkey -f /etc/ipsec.conf 641.1Sitojun} 651.1Sitojun 661.1Sitojunload_rc_config $name 671.1Sitojunrun_rc_command "$1" 68