ipmon revision 113959
1#!/bin/sh
2#
3# $NetBSD: ipmon,v 2002/04/18 05:02:01 lukem Exp $
4# $FreeBSD: head/etc/rc.d/ipmon 113959 2003-04-24 08:20:47Z mtm $
5#
6
7# PROVIDE: ipmon
8# REQUIRE: mountcritlocal hostname sysctl
9# BEFORE:  SERVERS
10# KEYWORD: FreeBSD NetBSD
11
12. /etc/rc.subr
13
14name="ipmon"
15rcvar=`set_rcvar`
16
17case ${OSTYPE} in
18FreeBSD)
19	command="/sbin/ipmon"
20	start_precmd="ipmon_precmd"
21	;;
22NetBSD)
23	command="/usr/sbin/${name}"
24	command_args="-D"
25esac
26
27ipmon_precmd()
28{
29	# Continue only if ipfilter or ipnat is enabled and the
30	# ipfilter module is loaded.
31	#
32	if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
33		err 1  "${name} requires either ipfilter or ipnat enabled"
34	fi
35	if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
36		err 1 "ipfilter module is not loaded"
37	fi
38	return 0
39}
40
41load_rc_config $name
42run_rc_command "$1"
43