7 # REQUIRE: FILESYSTEMS netif
13 desc="Packet filter logging interface"
15 command="/sbin/pflogd"
16 pidfile="/var/run/pflogd.pid"
17 start_precmd="pflog_prestart"
18 stop_postcmd="pflog_poststop"
19 extra_commands="reload resync"
21 # for backward compatibility
22 resync_cmd="pflog_resync"
26 load_kld pflog || return 1
28 # create pflog_dev interface if needed
29 if ! ifconfig $pflog_dev > /dev/null 2>&1; then
30 if ! ifconfig $pflog_dev create; then
31 warn "could not create $pflog_dev."
36 # set pflog_dev interface to up state
37 if ! ifconfig $pflog_dev up; then
38 warn "could not bring up $pflog_dev."
42 # -p flag requires stripping pidfile's leading /var/run and trailing .pid
43 pidfile=$(echo $pidfile | sed -e 's|/var/run/||' -e 's|.pid$||')
45 # prepare the command line for pflogd
46 rc_flags="-p $pidfile -f $pflog_logfile -i $pflog_dev $rc_flags"
48 # report we're ready to run pflogd
54 if ! ifconfig $pflog_dev down; then
55 warn "could not bring down $pflog_dev."
59 if [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then
66 # for backward compatibility
74 # Check if spawning multiple pflogd and told what to spawn
76 # Set required variables
77 eval pflog_dev=\$pflog_${2}_dev
78 eval pflog_logfile=\$pflog_${2}_logfile
79 eval pflog_flags=\$pflog_${2}_flags
80 # Check that required vars have non-zero length, warn if not.
81 if [ -z $pflog_dev ]; then
82 warn "pflog_dev not set"
85 if [ -z $pflog_logfile ]; then
86 warn "pflog_logfile not set"
90 # Provide a unique pidfile name for pflogd -p <pidfile> flag
91 pidfile="/var/run/pflogd.$2.pid"
93 # Override service name and execute command
96 # Check if spawning multiple pflogd and not told what to spawn
97 elif [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then
98 # Interate through requested instances.
99 for i in $pflog_instances; do
100 /etc/rc.d/pflog $1 $i
103 # Typical case, spawn single instance only.
104 pflog_dev=${pflog_dev:-"pflog0"}