Revision ec57dfe2b5ee6a21fd1aa290d93b0109bfa6148a authored by Hans Petter Selasky on 18 June 2017, 18:09:31 UTC, committed by Hans Petter Selasky on 18 June 2017, 18:09:31 UTC
Minor code optimisation.
Avoid locking the global CUSE lock when the polling flags are zero.

Approved by:	re (kib)
1 parent 1bfabcb
Raw File
ipmon
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: ipmon
# REQUIRE: FILESYSTEMS hostname sysctl ipfilter
# BEFORE:  SERVERS
# KEYWORD: nojail

. /etc/rc.subr

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

ipmon_precmd()
{
	# Continue only if ipfilter or ipnat is enabled and the
	# ipfilter module is loaded.
	#
	if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; 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"
back to top