freebsd-dev/etc/rc.d/pflog
Yaroslav Tykhiy 932d1eb384 Use rc.subr(8) appropriately:
- utilize default methods instead of rolling local ones;
- avoid to specify BEFORE conditions we don't really need
  (pflog will be REQUIRE'd by pf);
- omit extra decoration from warning messages, warn() will
  decorate them sufficiently.
2005-10-02 15:54:26 +00:00

65 lines
1.0 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: pflog
# REQUIRE: root mountcritlocal netif cleanvar
# KEYWORD: nojail
. /etc/rc.subr
name="pflog"
rcvar=`set_rcvar`
command="/sbin/pflogd"
pidfile="/var/run/pflogd.pid"
start_precmd="pflog_prestart"
stop_postcmd="pflog_poststop"
extra_commands="reload resync"
# for backward compatibility
resync_cmd="pflog_resync"
pflog_prestart()
{
# load pflog kernel module if needed
if ! kldstat -q -m pflog; then
if kldload pf; then
info 'pf module loaded.'
else
warn 'pf module failed to load.'
return 1
fi
fi
# set pflog0 interface to up state
if ! ifconfig pflog0 up; then
warn 'could not not bring up pflog0.'
return 1
fi
# prepare the command line for pflogd
rc_flags="-f $pflog_logfile $rc_flags"
# report we're ready to run pflogd
return 0
}
pflog_poststop()
{
if ! ifconfig pflog0 down; then
warn 'could not bring down pflog0.'
return 1
fi
return 0
}
# for backward compatibility
pflog_resync()
{
run_rc_command reload
}
load_rc_config $name
run_rc_command "$1"