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-04-02 19:25:27 +00:00
|
|
|
# BEFORE: DAEMON LOGIN
|
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`
|
|
|
|
load_rc_config $name
|
|
|
|
stop_precmd="test -x ${pflog_program}"
|
|
|
|
start_precmd="pflog_prestart"
|
|
|
|
start_cmd="pflog_start"
|
|
|
|
stop_cmd="pflog_stop"
|
|
|
|
resync_precmd="$stop_precmd"
|
|
|
|
resync_cmd="pflog_resync"
|
|
|
|
status_precmd="$stop_precmd"
|
|
|
|
status_cmd="pflog_status"
|
|
|
|
extra_commands="resync status"
|
|
|
|
|
|
|
|
pflog_prestart()
|
|
|
|
{
|
|
|
|
# load pflog kernel module if needed
|
2005-09-24 15:57:17 +00:00
|
|
|
if ! kldstat -q -m pflog; then
|
2004-08-31 14:23:51 +00:00
|
|
|
if kldload pf; then
|
2004-04-02 19:25:27 +00:00
|
|
|
info 'pflog module loaded.'
|
|
|
|
else
|
|
|
|
err 1 'pflog module failed to load.'
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# set pflog0 interface to up state
|
|
|
|
if ! ifconfig pflog0 up; then
|
|
|
|
warn 'pflog: COULD NOT SET UP pflog0'
|
|
|
|
fi
|
|
|
|
|
2004-08-31 14:23:51 +00:00
|
|
|
# check for pflogd binary
|
2004-04-02 19:25:27 +00:00
|
|
|
if [ ! -x "${pflog_program:-/sbin/pflogd}" ]
|
|
|
|
then
|
|
|
|
warn 'pflog: NO PFLOGD BINARY FOUND'
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
pflog_start()
|
|
|
|
{
|
|
|
|
echo -n "Enabling pflogd"
|
|
|
|
if ! ${pflog_program:-/sbin/pflogd} ${pflog_flags} \
|
|
|
|
-f ${pflog_logfile:-/var/log/pflog}; then
|
|
|
|
echo " failed!"
|
|
|
|
else
|
|
|
|
echo "."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
pflog_stop()
|
|
|
|
{
|
|
|
|
if [ -r /var/run/pflogd.pid ]; then
|
|
|
|
echo "Stopping pflogd."
|
|
|
|
kill `cat /var/run/pflogd.pid`
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
pflog_resync()
|
|
|
|
{
|
|
|
|
if [ -r /var/run/pflogd.pid ]; then
|
|
|
|
kill -SIGHUP `cat /var/run/pflogd.pid`
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
pflog_status()
|
|
|
|
{
|
|
|
|
if [ -r /var/run/pflogd.pid ]; then
|
|
|
|
ps -p `cat /var/run/pflogd.pid` | tail -n 1
|
|
|
|
else
|
|
|
|
echo 'pflogd not running.'
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
run_rc_command "$1"
|