HAMMER commit - MFC ref count related panics when a HAMMER mount fails, etc.
[dragonfly.git] / etc / rc.d / pflog
bloba9d4575b387357a74395c132d9cc22af21a8fda0
1 #!/bin/sh
3 # $FreeBSD: src/etc/rc.d/pflog,v 1.2 2004/08/31 14:23:51 mlaier Exp $
4 # $DragonFly: src/etc/rc.d/pflog,v 1.6 2008/02/21 22:42:10 hasso Exp $
7 # PROVIDE: pflog
8 # REQUIRE: root mountcritlocal netif
9 # BEFORE: DAEMON LOGIN
10 # KEYWORD: nojail
12 . /etc/rc.subr
14 name="pflog"
15 rcvar=`set_rcvar`
16 load_rc_config $name
17 stop_precmd="test -x ${pflog_program}"
18 start_precmd="pflog_prestart"
19 start_cmd="pflog_start"
20 stop_cmd="pflog_stop"
21 resync_precmd="$stop_precmd"
22 resync_cmd="pflog_resync"
23 status_precmd="$stop_precmd"
24 status_cmd="pflog_status"
25 extra_commands="resync status"
27 pflog_prestart()
29 # load pflog kernel module if needed
30 if ! kldstat -q -m "pflog"; then
31 if kldload pf; then
32 info 'pflog module loaded.'
33 else
34 err 1 'pflog module failed to load.'
38 # set pflog0 interface to up state
39 if ! ifconfig pflog0 up; then
40 warn 'pflog: COULD NOT SET UP pflog0'
43 # check for pflogd binary
44 if [ ! -x "${pflog_program:-/sbin/pflogd}" ]
45 then
46 warn 'pflog: NO PFLOGD BINARY FOUND'
47 return 1
51 pflog_start()
53 echo -n "Enabling pflogd"
54 if ! ${pflog_program:-/sbin/pflogd} ${pflog_flags} \
55 -f ${pflog_logfile:-/var/log/pflog}; then
56 echo " failed!"
57 else
58 echo "."
62 pflog_stop()
64 if [ -r /var/run/pflogd.pid ]; then
65 echo "Stopping pflogd."
66 kill `cat /var/run/pflogd.pid`
70 pflog_resync()
72 if [ -r /var/run/pflogd.pid ]; then
73 kill -SIGHUP `cat /var/run/pflogd.pid`
77 pflog_status()
79 if [ -r /var/run/pflogd.pid ]; then
80 ps -p `cat /var/run/pflogd.pid` | tail -n 1
81 else
82 echo 'pflogd not running.'
86 run_rc_command "$1"