On 2011/08/06 13:36, Andres Perera wrote:
> On Sat, Aug 6, 2011 at 7:11 AM, Stuart Henderson <[email protected]> wrote:
> > Since pflog interface creation was moved to rc.d/pflogd, you can
> > no longer run spamlogd without also running pflogd. This diff copies
> > the interface creation code from pflogd (it doesn't hurt to create
> > pflog0 twice).
> >
> > This doesn't handle the case with spamlogd -l where a non-default
> > interface is used (but neither does pflogd handle the case with -i),
> > but I think for non-default options it's reasonable to expect the
> > user to do a little more work (e.g. 'echo up > /etc/hostname.pflog1').
> >
> > Index: spamlogd
> > ===================================================================
> > RCS file: /cvs/src/etc/rc.d/spamlogd,v
> > retrieving revision 1.1
> > diff -u -p -r1.1 spamlogd
> > --- spamlogd B  B 8 Jul 2011 02:15:34 -0000 B  B  B  1.1
> > +++ spamlogd B  B 6 Aug 2011 11:32:39 -0000
> > @@ -10,6 +10,17 @@ rc_reload=NO
> >
> > B rc_pre() {
> > B  B  B  B [ B X"${spamd_flags}" != X"NO" -a X"${spamd_black}" = X"NO" ]
> 
> this check needs to return 1 if it fails
> 
> or you're assuming it's a set -e shell?

I was confused about this as I saw behaviour as if this was doing
something but couldn't find a set -e anywhere. Looking further,
actually this line can just be zapped, /etc/rc.conf handles it.

    123 [ -f ${local_rcconf} ] && . ${local_rcconf} # Do not edit this line
    124
    125 # special care needed for spamlogd to avoid starting it up and failing
    126 # all the time
    127 if [  X"${spamd_flags}" = X"NO" -o X"${spamd_black}" != X"NO" ]; then
    128         spamlogd_flags=NO
    129 fi


Index: spamlogd
===================================================================
RCS file: /cvs/src/etc/rc.d/spamlogd,v
retrieving revision 1.1
diff -u -p -r1.1 spamlogd
--- spamlogd    8 Jul 2011 02:15:34 -0000       1.1
+++ spamlogd    6 Aug 2011 19:07:57 -0000
@@ -9,7 +9,16 @@ daemon="/usr/libexec/spamlogd"
 rc_reload=NO
 
 rc_pre() {
-       [  X"${spamd_flags}" != X"NO" -a X"${spamd_black}" = X"NO" ]
+       if pfctl -si | grep -q Enabled; then
+               ifconfig pflog0 create
+               if ifconfig pflog0; then
+                       ifconfig pflog0 up
+               else
+                       return 1
+               fi
+       else
+               return 1
+       fi
 }
 
 rc_cmd $1

Reply via email to