2004-04-02 19:25:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: pflog
|
2005-01-16 03:12:03 +00:00
|
|
|
# REQUIRE: root mountcritlocal netif cleanvar
|
2004-10-07 13:55:26 +00:00
|
|
|
# KEYWORD: nojail
|
2004-04-02 19:25:27 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="pflog"
|
|
|
|
rcvar=`set_rcvar`
|
2005-10-02 15:54:26 +00:00
|
|
|
command="/sbin/pflogd"
|
|
|
|
pidfile="/var/run/pflogd.pid"
|
2004-04-02 19:25:27 +00:00
|
|
|
start_precmd="pflog_prestart"
|
2005-10-02 15:54:26 +00:00
|
|
|
stop_postcmd="pflog_poststop"
|
|
|
|
extra_commands="reload resync"
|
|
|
|
|
|
|
|
# for backward compatibility
|
2004-04-02 19:25:27 +00:00
|
|
|
resync_cmd="pflog_resync"
|
|
|
|
|
|
|
|
pflog_prestart()
|
|
|
|
{
|
|
|
|
# load pflog kernel module if needed
|
2005-09-24 15:57:17 +00:00
|
|
|
if ! kldstat -q -m pflog; then
|
2006-02-05 22:38:08 +00:00
|
|
|
if kldload pflog; then
|
|
|
|
info 'pflog module loaded.'
|
2004-04-02 19:25:27 +00:00
|
|
|
else
|
2006-02-05 22:38:08 +00:00
|
|
|
warn 'pflog module failed to load.'
|
2005-10-02 15:54:26 +00:00
|
|
|
return 1
|
2004-04-02 19:25:27 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# set pflog0 interface to up state
|
|
|
|
if ! ifconfig pflog0 up; then
|
2006-12-31 10:12:53 +00:00
|
|
|
warn 'could not bring up pflog0.'
|
2004-04-02 19:25:27 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2005-10-02 15:54:26 +00:00
|
|
|
# prepare the command line for pflogd
|
|
|
|
rc_flags="-f $pflog_logfile $rc_flags"
|
2004-04-02 19:25:27 +00:00
|
|
|
|
2005-10-02 15:54:26 +00:00
|
|
|
# report we're ready to run pflogd
|
|
|
|
return 0
|
2004-04-02 19:25:27 +00:00
|
|
|
}
|
|
|
|
|
2005-10-02 15:54:26 +00:00
|
|
|
pflog_poststop()
|
2004-04-02 19:25:27 +00:00
|
|
|
{
|
2005-10-02 15:54:26 +00:00
|
|
|
if ! ifconfig pflog0 down; then
|
|
|
|
warn 'could not bring down pflog0.'
|
|
|
|
return 1
|
2004-04-02 19:25:27 +00:00
|
|
|
fi
|
2005-10-02 15:54:26 +00:00
|
|
|
return 0
|
2004-04-02 19:25:27 +00:00
|
|
|
}
|
|
|
|
|
2005-10-02 15:54:26 +00:00
|
|
|
# for backward compatibility
|
|
|
|
pflog_resync()
|
2004-04-02 19:25:27 +00:00
|
|
|
{
|
2005-10-02 15:54:26 +00:00
|
|
|
run_rc_command reload
|
2004-04-02 19:25:27 +00:00
|
|
|
}
|
|
|
|
|
2005-10-02 15:54:26 +00:00
|
|
|
load_rc_config $name
|
2004-04-02 19:25:27 +00:00
|
|
|
run_rc_command "$1"
|