2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $NetBSD: ipmon,v 2002/04/18 05:02:01 lukem Exp $
|
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: ipmon
|
2003-07-14 13:02:36 +00:00
|
|
|
# REQUIRE: mountcritlocal hostname sysctl cleanvar
|
2002-06-13 22:14:37 +00:00
|
|
|
# BEFORE: SERVERS
|
|
|
|
# KEYWORD: FreeBSD NetBSD
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="ipmon"
|
2002-06-13 22:14:37 +00:00
|
|
|
rcvar=`set_rcvar`
|
|
|
|
|
2002-09-06 16:18:05 +00:00
|
|
|
case ${OSTYPE} in
|
2002-06-13 22:14:37 +00:00
|
|
|
FreeBSD)
|
|
|
|
command="/sbin/ipmon"
|
|
|
|
start_precmd="ipmon_precmd"
|
|
|
|
;;
|
|
|
|
NetBSD)
|
|
|
|
command="/usr/sbin/${name}"
|
|
|
|
command_args="-D"
|
|
|
|
esac
|
|
|
|
|
|
|
|
ipmon_precmd()
|
|
|
|
{
|
2003-04-24 08:20:47 +00:00
|
|
|
# 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
|
2002-10-12 10:31:31 +00:00
|
|
|
if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
|
2003-04-24 08:20:47 +00:00
|
|
|
err 1 "ipfilter module is not loaded"
|
2002-10-12 10:31:31 +00:00
|
|
|
fi
|
2002-06-13 22:14:37 +00:00
|
|
|
return 0
|
|
|
|
}
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|