Fix previous rc.d/spamlogd commit, the check in rc_pre is not needed
authorsthen <sthen@openbsd.org>
Thu, 21 Apr 2022 09:31:28 +0000 (09:31 +0000)
committersthen <sthen@openbsd.org>
Thu, 21 Apr 2022 09:31:28 +0000 (09:31 +0000)
because rc.subr has special-casing for spamd/spamlogd.

Teach the script to detect the pflog interface from spamlogd flags and
create the correct interface if needed.

ok jturner@

etc/rc.d/spamlogd

index 45e62ce..5076e87 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/ksh
 #
-# $OpenBSD: spamlogd,v 1.5 2022/04/11 09:32:20 sthen Exp $
+# $OpenBSD: spamlogd,v 1.6 2022/04/21 09:31:28 sthen Exp $
 
 daemon="/usr/libexec/spamlogd"
 
@@ -9,11 +9,13 @@ daemon="/usr/libexec/spamlogd"
 rc_reload=NO
 
 rc_pre() {
-       [[ ${spamd_flags} != NO && ${spamd_black} == NO ]] && return 1
+       pflog=$(echo $daemon_flags | sed -En 's/.*-l *(pflog[0-9]+).*/\1/p')
+       pflog=${pflog:-pflog0}
+
        if pfctl -si | grep -q Enabled; then
-               ifconfig pflog0 create
-               if ifconfig pflog0; then
-                       ifconfig pflog0 up
+               ifconfig $pflog create
+               if ifconfig $pflog; then
+                       ifconfig $pflog up
                else
                        return 1
                fi