FreeBSD-5.3/etc/rc.d/ipmon

#!/bin/sh
#
# $NetBSD: ipmon,v 2002/04/18 05:02:01 lukem Exp $
# $FreeBSD: src/etc/rc.d/ipmon,v 1.11.2.1 2004/10/10 09:50:53 mtm Exp $
#

# PROVIDE: ipmon
# REQUIRE: mountcritlocal hostname sysctl cleanvar ipfilter
# BEFORE:  SERVERS
# KEYWORD: nojail

. /etc/rc.subr

name="ipmon"
rcvar=`set_rcvar`
command="/sbin/ipmon"
start_precmd="ipmon_precmd"

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"