7 # REQUIRE: FILESYSTEMS netif
14 command="/sbin/pflogd"
15 pidfile="/var/run/pflogd.pid"
16 start_precmd="pflog_prestart"
17 stop_postcmd="pflog_poststop"
18 extra_commands="reload resync"
20 # for backward compatibility
21 resync_cmd="pflog_resync"
25 load_kld pflog || return 1
27 # set pflog_dev interface to up state
28 if ! ifconfig $pflog_dev up; then
29 warn "could not bring up $pflog_dev."
33 # prepare the command line for pflogd
34 rc_flags="-f $pflog_logfile -i $pflog_dev $rc_flags"
36 # report we're ready to run pflogd
41 # Allow child pflogd to settle
43 # More elegant(?) method for getting a unique pid
44 if [ -f /var/run/pflogd.pid ]; then
45 mv /var/run/pflogd.pid $pidfile
47 warn "/var/run/pflogd.pid does not exist. Too fast."
53 if ! ifconfig $pflog_dev down; then
54 warn "could not bring down $pflog_dev."
58 if [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then
65 # for backward compatibility
73 # Check if spawning multiple pflogd
74 echo "Starting pflogd: $pflog_instances"
75 if [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then
76 start_postcmd="pflog_poststart"
77 # Interate through requested instances.
78 for i in $pflog_instances; do
79 # Set required variables
80 eval pflog_dev=\$pflog_${i}_dev
81 eval pflog_logfile=\$pflog_${i}_logfile
82 eval pflog_flags=\$pflog_${i}_flags
83 # Check that required vars have non-zero length, warn if not.
84 if [ -z $pflog_dev ]; then
85 warn "pflog_dev not set"
88 if [ -z $pflog_logfile ]; then
89 warn "pflog_logfile not set"
92 # pflogd sets a pidfile, but the name is hardcoded. Concoct a
93 # unique pidfile name.
94 pidfile="/var/run/pflogd.$i.pid"
98 # Typical case, spawn single instance only.
99 pflog_dev=${pflog_dev:-"pflog0"}