pflog revision 165682
1#!/bin/sh
2#
3# $FreeBSD: head/etc/rc.d/pflog 165682 2006-12-31 10:12:53Z yar $
4#
5
6# PROVIDE: pflog
7# REQUIRE: root mountcritlocal netif cleanvar
8# KEYWORD: nojail
9
10. /etc/rc.subr
11
12name="pflog"
13rcvar=`set_rcvar`
14command="/sbin/pflogd"
15pidfile="/var/run/pflogd.pid"
16start_precmd="pflog_prestart"
17stop_postcmd="pflog_poststop"
18extra_commands="reload resync"
19
20# for backward compatibility
21resync_cmd="pflog_resync"
22
23pflog_prestart()
24{
25	# load pflog kernel module if needed
26	if ! kldstat -q -m pflog; then
27		if kldload pflog; then
28			info 'pflog module loaded.'
29		else
30			warn 'pflog module failed to load.'
31			return 1
32		fi
33	fi
34
35	# set pflog0 interface to up state
36	if ! ifconfig pflog0 up; then
37		warn 'could not bring up pflog0.'
38		return 1
39	fi
40
41	# prepare the command line for pflogd
42	rc_flags="-f $pflog_logfile $rc_flags"
43
44	# report we're ready to run pflogd
45	return 0
46}
47
48pflog_poststop()
49{
50	if ! ifconfig pflog0 down; then
51		warn 'could not bring down pflog0.'
52		return 1
53	fi
54	return 0
55}
56
57# for backward compatibility
58pflog_resync()
59{
60	run_rc_command reload
61}
62
63load_rc_config $name
64run_rc_command "$1"
65