Hi everyone,

I recently started running multiple pflogd instances and noticed that
/etc/rc.d/pflogd killed/restarted every running instance.
The same happened from newsyslog rotations as well.

After suggestions by brynet, sthen and ajacoutot (thank you guys)
I updated pexp to use a combination of `[running]` and `daemon_flags`

pexp="pflogd: \[running\]${daemon_flags:+ ${daemon_flags}}"

However, the default pflogd does not start with any flags set, so in
order to make this work I had to either set the flags for pflogd

rcctl set pflogd flags -s 160 -i pflog0 -f /var/log/pflog

or add something like this to /etc/rc.d/pflogd

: ${daemon_flags:="-s 160 -i pflog0 -f /var/log/pflog"}
pexp="pflogd: \[running\]${daemon_flags:+ ${daemon_flags}}"

It was suggested by stehn that a diff may worth submitting, but i dont
know which of the two options is preferred, if any

In the first case we have to set flags for pflogd which no other base
daemon does at the moment, other than maybe amd_master?

In the second case we set default flags inside the rc script and this
introduces an unnecessary dependency to update this script whenever the
default flags or their order changes.

These changes are only needed for when someone needs to run more than
one instance of pflogd, in which case they will have to copy the
default /etc/rc.d/pflogd and/or modify it anyways (e.g. for the interface
name in rc_pre).

The diff for the script follows, suggestions/ideas are more than welcome

diff --git etc/rc.d/pflogd etc/rc.d/pflogd
index 963616775..620d2daef 100644
--- etc/rc.d/pflogd
+++ etc/rc.d/pflogd
@@ -6,7 +6,9 @@ daemon="/sbin/pflogd"

 . /etc/rc.d/rc.subr

-pexp="pflogd: \[priv\]"
+: ${daemon_flags:="-s 160 -i pflog0 -f /var/log/pflog"}
+
+pexp="pflogd: \[running\]${daemon_flags:+ ${daemon_flags}}"

 rc_pre() {

        if pfctl -si | grep -q Enabled; then

Reply via email to