xref: /freebsd/libexec/rc/rc.d/ipmon (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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