git: 9e8c1f9576e7 - main - /etc/rc.d/pf: Fix for multi-line pf_fallback_rules
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 15 Jul 2025 13:06:59 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=9e8c1f9576e75fcd34007c6e8a4a6da0b1b2f1e2
commit 9e8c1f9576e75fcd34007c6e8a4a6da0b1b2f1e2
Author: Michael Proto <mike@jellydonut.org>
AuthorDate: 2025-07-13 21:30:28 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-07-15 13:06:27 +0000
/etc/rc.d/pf: Fix for multi-line pf_fallback_rules
Setting multiple pf_fallback_rules in /etc/rc.conf as per the
documentation produces invalid pf syntax due to the lack of echo
quoting $pf_fallback_rules in /etc/rc.d/pf. Adding quotes around
the $pf_fallback_rules echo maintains newlines needed for valid
pfctl syntax. Provided patch resolves the issue
Also updating rc.conf(5) to reflect that multi-line pf_fallback_rules
should not include a trailing backslash (\) as line breaks are
needed when passing rules to pfctl via stdin.
PR: 288197
Reviewed by: kp
MFC after: 2 weeks
---
libexec/rc/rc.d/pf | 2 +-
share/man/man5/rc.conf.5 | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libexec/rc/rc.d/pf b/libexec/rc/rc.d/pf
index 0b4c086db22b..46fb085e5175 100755
--- a/libexec/rc/rc.d/pf
+++ b/libexec/rc/rc.d/pf
@@ -38,7 +38,7 @@ pf_fallback()
$pf_program -f "$pf_fallback_rules_file" $pf_flags
else
warn "Loading fallback rules: $pf_fallback_rules"
- echo $pf_fallback_rules | $pf_program -f - $pf_flags
+ echo "$pf_fallback_rules" | $pf_program -f - $pf_flags
fi
}
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 2fd63e4f743d..de2181d638d1 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd May 21, 2025
+.Dd July 15, 2025
.Dt RC.CONF 5
.Os
.Sh NAME
@@ -1164,8 +1164,8 @@ and
is not found.
Multiple rules can be set as follows:
.Bd -literal
-pf_fallback_rules="\\
- block drop log all\\
+pf_fallback_rules="
+ block drop log all
pass in quick on em0"
.Pp
.Ed