aboutsummaryrefslogtreecommitdiff
path: root/libexec/rc/rc.d/ipmon
blob: 3ef0c895ad16b61caa8f1b39a54c526272ad214a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
#
#

# PROVIDE: ipmon
# REQUIRE: FILESYSTEMS hostname sysctl
# BEFORE:  SERVERS
# KEYWORD: nojailvnet

. /etc/rc.subr

name="ipmon"
desc="Monitors /dev/ipl for logged packets"
rcvar="ipmon_enable"
command="/sbin/${name}"
start_precmd="ipmon_precmd"

# no svcj options needed
: ${ipmon_svcj_options:=""}

ipmon_precmd()
{
	# Continue only if ipfilter or ipnat is enabled and the
	# ipfilter module is loaded.
	#
	if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable && ! checkyesno rc_force ; then
		err 1  "${name} requires either ipfilter or ipnat enabled"
	fi
	if ! ${ipfilter_program:-/sbin/ipf} -V | grep -q 'Running: yes' >/dev/null 2>&1; then
		err 1 "ipfilter module is not loaded"
	fi
	return 0
}

load_rc_config $name
run_rc_command "$1"