ipsec revision 1.5
11.1Sitojun#!/bin/sh 21.1Sitojun# 31.5Slukem# $NetBSD: ipsec,v 1.5 2000/07/21 01:16:07 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.4Slukemstart_precmd="ipsec_prestart" 151.1Sitojunstart_cmd="ipsec_start" 161.1Sitojunstop_precmd="checkyesno ipsec && [ -f /etc/ipsec.conf ]" 171.1Sitojunstop_cmd="ipsec_stop" 181.1Sitojunreload_precmd="$stop_precmd" 191.1Sitojunreload_cmd="ipsec_reload" 201.1Sitojunextra_commands="reload" 211.1Sitojun 221.5Slukemipsec_prestart() 231.1Sitojun{ 241.1Sitojun if ! checkyesno ipsec; then 251.4Slukem return 1 261.1Sitojun fi 271.1Sitojun if [ ! -f /etc/ipsec.conf ]; then 281.4Slukem warn "/etc/ipsec.conf not readable; ipsec start aborted." 291.5Slukem # 301.5Slukem # If booting directly to multiuser, send SIGTERM to 311.5Slukem # the parent (/etc/rc) to abort the boot 321.5Slukem # 331.5Slukem if [ "$autoboot" = yes ]; then 341.5Slukem echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!" 351.5Slukem kill -TERM $$ 361.5Slukem exit 1 371.5Slukem fi 381.4Slukem return 1 391.1Sitojun fi 401.4Slukem return 0 411.4Slukem} 421.4Slukem 431.4Slukemipsec_start() 441.4Slukem{ 451.1Sitojun echo "Installing ipsec manual keys/policies." 461.1Sitojun /sbin/setkey -f /etc/ipsec.conf 471.1Sitojun} 481.1Sitojun 491.1Sitojunipsec_stop() 501.1Sitojun{ 511.3Sitojun echo "Clearing ipsec manual keys/policies." 521.1Sitojun 531.1Sitojun # still not 100% sure if we would like to do this. 541.1Sitojun # it is very questionable to do this during shutdown session, since 551.1Sitojun # it can hang any of remaining IPv4/v6 session. 561.1Sitojun # 571.1Sitojun /sbin/setkey -F 581.1Sitojun /sbin/setkey -FP 591.1Sitojun} 601.1Sitojun 611.1Sitojunipsec_reload() 621.1Sitojun{ 631.1Sitojun echo "Reloading ipsec manual keys/policies." 641.1Sitojun /sbin/setkey -F 651.1Sitojun /sbin/setkey -FP 661.1Sitojun /sbin/setkey -f /etc/ipsec.conf 671.1Sitojun} 681.1Sitojun 691.1Sitojunload_rc_config $name 701.1Sitojunrun_rc_command "$1" 71