git: 0bb490bdbff4 - stable/13 - /etc/rc.d/pf: Fix for multi-line pf_fallback_rules
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 29 Jul 2025 07:49:26 UTC
The branch stable/13 has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=0bb490bdbff4bb39e7a3429ee2176bd123b627ca
commit 0bb490bdbff4bb39e7a3429ee2176bd123b627ca
Author: Michael Proto <mike@jellydonut.org>
AuthorDate: 2025-07-13 21:30:28 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-07-29 07:48:51 +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
(cherry picked from commit 9e8c1f9576e75fcd34007c6e8a4a6da0b1b2f1e2)
---
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 f227782e640c..f5871c367c6a 100755
--- a/libexec/rc/rc.d/pf
+++ b/libexec/rc/rc.d/pf
@@ -35,7 +35,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 f588f12eee59..8dd871d7c779 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 7, 2025
+.Dd July 15, 2025
.Dt RC.CONF 5
.Os
.Sh NAME
@@ -1101,8 +1101,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