1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# PROVIDE: pflog
7# REQUIRE: FILESYSTEMS netif FILESYSTEMS
8# KEYWORD: nojail
9
10. /etc/rc.subr
11
12name="pflog"
13rcvar="pflog_enable"
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_kld pflog || return 1
26
27	# set pflog0 interface to up state
28	if ! ifconfig pflog0 up; then
29		warn 'could not bring up pflog0.'
30		return 1
31	fi
32
33	# prepare the command line for pflogd
34	rc_flags="-f $pflog_logfile $rc_flags"
35
36	# report we're ready to run pflogd
37	return 0
38}
39
40pflog_poststop()
41{
42	if ! ifconfig pflog0 down; then
43		warn 'could not bring down pflog0.'
44		return 1
45	fi
46	return 0
47}
48
49# for backward compatibility
50pflog_resync()
51{
52	run_rc_command reload
53}
54
55load_rc_config $name
56run_rc_command "$1"
57