xref: /freebsd/libexec/rc/rc.d/ipmon (revision 02e9120893770924227138ba49df1edb3896112a)
1#!/bin/sh
2#
3#
4
5# PROVIDE: ipmon
6# REQUIRE: FILESYSTEMS hostname sysctl
7# BEFORE:  SERVERS
8# KEYWORD: nojailvnet
9
10. /etc/rc.subr
11
12name="ipmon"
13desc="Monitors /dev/ipl for logged packets"
14rcvar="ipmon_enable"
15command="/sbin/${name}"
16start_precmd="ipmon_precmd"
17
18ipmon_precmd()
19{
20	# Continue only if ipfilter or ipnat is enabled and the
21	# ipfilter module is loaded.
22	#
23	if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable && ! checkyesno rc_force ; then
24		err 1  "${name} requires either ipfilter or ipnat enabled"
25	fi
26	if ! ${ipfilter_program:-/sbin/ipf} -V | grep -q 'Running: yes' >/dev/null 2>&1; then
27		err 1 "ipfilter module is not loaded"
28	fi
29	return 0
30}
31
32load_rc_config $name
33run_rc_command "$1"
34