freebsd-skq/etc/rc.d/ipmon
mtm a6c5ee3cc4 Make ipfilter, ipnat, ipmon, and ipfs behave more like the old rc.
o group them together so they run one right after another
	o use the NetBSD supplied ipfs script instead of tacking
	  it on to the end of ipnat
	o Load the ipl module in ipnat and ipfilter, if it's not already
	  loaded
	o In ipmon and ipnat show a warning if neither ipfilter nor
	  ipnat is enabled or the ipl module is not loaded, and exit

Approved by:	markm (mentor) (implicit)
Tested by:	leafy <leafy@leafy.idv.tw>
2003-04-24 08:20:47 +00:00

43 lines
771 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: ipmon,v 2002/04/18 05:02:01 lukem Exp $
# $FreeBSD$
#
# PROVIDE: ipmon
# REQUIRE: mountcritlocal hostname sysctl
# BEFORE: SERVERS
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="ipmon"
rcvar=`set_rcvar`
case ${OSTYPE} in
FreeBSD)
command="/sbin/ipmon"
start_precmd="ipmon_precmd"
;;
NetBSD)
command="/usr/sbin/${name}"
command_args="-D"
esac
ipmon_precmd()
{
# Continue only if ipfilter or ipnat is enabled and the
# ipfilter module is loaded.
#
if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
err 1 "${name} requires either ipfilter or ipnat enabled"
fi
if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
err 1 "ipfilter module is not loaded"
fi
return 0
}
load_rc_config $name
run_rc_command "$1"