xref: /freebsd/libexec/rc/rc.d/ipmon (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
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
18# no svcj options needed
19: ${ipmon_svcj_options:=""}
20
21ipmon_precmd()
22{
23	# Continue only if ipfilter or ipnat is enabled and the
24	# ipfilter module is loaded.
25	#
26	if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable && ! checkyesno rc_force ; then
27		err 1  "${name} requires either ipfilter or ipnat enabled"
28	fi
29	if ! ${ipfilter_program:-/sbin/ipf} -V | grep -q 'Running: yes' >/dev/null 2>&1; then
30		err 1 "ipfilter module is not loaded"
31	fi
32	return 0
33}
34
35load_rc_config $name
36run_rc_command "$1"
37