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 # create pflog_dev interface if needed
28 if ! ifconfig $pflog_dev > /dev/null 2>&1; then
29 if ! ifconfig $pflog_dev create; then
30 warn "could not create $pflog_dev."
35 # set pflog_dev interface to up state
36 if ! ifconfig $pflog_dev up; then
37 warn "could not bring up $pflog_dev."
41 # -p flag requires stripping pidfile's leading /var/run and trailing .pid
42 pidfile=$(echo $pidfile | sed -e 's|/var/run/||' -e 's|.pid$||')
44 # prepare the command line for pflogd
45 rc_flags="-p $pidfile -f $pflog_logfile -i $pflog_dev $rc_flags"
47 # report we're ready to run pflogd
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 and told what to spawn
75 # Set required variables
76 eval pflog_dev=\$pflog_${2}_dev
77 eval pflog_logfile=\$pflog_${2}_logfile
78 eval pflog_flags=\$pflog_${2}_flags
79 # Check that required vars have non-zero length, warn if not.
80 if [ -z $pflog_dev ]; then
81 warn "pflog_dev not set"
84 if [ -z $pflog_logfile ]; then
85 warn "pflog_logfile not set"
89 # Provide a unique pidfile name for pflogd -p <pidfile> flag
90 pidfile="/var/run/pflogd.$2.pid"
92 # Override service name and execute command
95 # Check if spawning multiple pflogd and not told what to spawn
96 elif [ "$pflog_instances" ] && [ -n "$pflog_instances" ]; then
97 # Interate through requested instances.
98 for i in $pflog_instances; do
102 # Typical case, spawn single instance only.
103 pflog_dev=${pflog_dev:-"pflog0"}