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