xref: /freebsd/libexec/rc/rc.d/ipmon (revision f99f0ee14e3af81c23150a6a340259ca8a33d01a)
10696600cSBjoern A. Zeeb#!/bin/sh
20696600cSBjoern A. Zeeb#
30696600cSBjoern A. Zeeb#
40696600cSBjoern A. Zeeb
50696600cSBjoern A. Zeeb# PROVIDE: ipmon
651da4b19SCy Schubert# REQUIRE: FILESYSTEMS hostname sysctl
70696600cSBjoern A. Zeeb# BEFORE:  SERVERS
8795be686SCy Schubert# KEYWORD: nojailvnet
90696600cSBjoern A. Zeeb
100696600cSBjoern A. Zeeb. /etc/rc.subr
110696600cSBjoern A. Zeeb
120696600cSBjoern A. Zeebname="ipmon"
130696600cSBjoern A. Zeebdesc="Monitors /dev/ipl for logged packets"
140696600cSBjoern A. Zeebrcvar="ipmon_enable"
150696600cSBjoern A. Zeebcommand="/sbin/${name}"
160696600cSBjoern A. Zeebstart_precmd="ipmon_precmd"
170696600cSBjoern A. Zeeb
18*f99f0ee1SAlexander Leidinger# no svcj options needed
19*f99f0ee1SAlexander Leidinger: ${ipmon_svcj_options:=""}
20*f99f0ee1SAlexander Leidinger
210696600cSBjoern A. Zeebipmon_precmd()
220696600cSBjoern A. Zeeb{
230696600cSBjoern A. Zeeb	# Continue only if ipfilter or ipnat is enabled and the
240696600cSBjoern A. Zeeb	# ipfilter module is loaded.
250696600cSBjoern A. Zeeb	#
26d19c1c8eSCy Schubert	if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable && ! checkyesno rc_force ; then
270696600cSBjoern A. Zeeb		err 1  "${name} requires either ipfilter or ipnat enabled"
280696600cSBjoern A. Zeeb	fi
290696600cSBjoern A. Zeeb	if ! ${ipfilter_program:-/sbin/ipf} -V | grep -q 'Running: yes' >/dev/null 2>&1; then
300696600cSBjoern A. Zeeb		err 1 "ipfilter module is not loaded"
310696600cSBjoern A. Zeeb	fi
320696600cSBjoern A. Zeeb	return 0
330696600cSBjoern A. Zeeb}
340696600cSBjoern A. Zeeb
350696600cSBjoern A. Zeebload_rc_config $name
360696600cSBjoern A. Zeebrun_rc_command "$1"
37