[BACK]Return to spamlogd CVS log [TXT][DIR] Up to [local] / src / etc / rc.d

File: [local] / src / etc / rc.d / spamlogd (download)

Revision 1.6, Thu Apr 21 09:31:28 2022 UTC (2 years, 1 month ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, HEAD
Changes since 1.5: +7 -5 lines

Fix previous rc.d/spamlogd commit, the check in rc_pre is not needed
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@

#!/bin/ksh
#
# $OpenBSD: spamlogd,v 1.6 2022/04/21 09:31:28 sthen Exp $

daemon="/usr/libexec/spamlogd"

. /etc/rc.d/rc.subr

rc_reload=NO

rc_pre() {
	pflog=$(echo $daemon_flags | sed -En 's/.*-l *(pflog[0-9]+).*/\1/p')
	pflog=${pflog:-pflog0}

	if pfctl -si | grep -q Enabled; then
		ifconfig $pflog create
		if ifconfig $pflog; then
			ifconfig $pflog up
		else
			return 1
		fi
	else
		return 1
	fi
}

rc_cmd $1