summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/pflog
blob: a0e6876b4350a3c6edf0ad93fe580f22ff04054d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: pflog
# REQUIRE: FILESYSTEMS netif FILESYSTEMS
# KEYWORD: nojail

. /etc/rc.subr

name="pflog"
rcvar="pflog_enable"
command="/sbin/pflogd"
pidfile="/var/run/pflogd.pid"
start_precmd="pflog_prestart"
stop_postcmd="pflog_poststop"
extra_commands="reload resync"

# for backward compatibility
resync_cmd="pflog_resync"

pflog_prestart()
{
	load_kld pflog || return 1

	# set pflog0 interface to up state
	if ! ifconfig pflog0 up; then
		warn 'could not bring up pflog0.'
		return 1
	fi

	# prepare the command line for pflogd
	rc_flags="-f $pflog_logfile $rc_flags"

	# report we're ready to run pflogd
	return 0
}

pflog_poststop()
{
	if ! ifconfig pflog0 down; then
		warn 'could not bring down pflog0.'
		return 1
	fi
	return 0
}

# for backward compatibility
pflog_resync()
{
	run_rc_command reload
}

load_rc_config $name
run_rc_command "$1"
OpenPOWER on IntegriCloud