aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Thébault <quentin.thebault@defenso.fr>2024-11-07 06:13:05 +0000
committerWarner Losh <imp@FreeBSD.org>2025-07-07 13:57:01 +0000
commit0077daf9cdc45cf36e7cc2ca3b65252194221400 (patch)
tree38b6f2f379eb5aff385f9ac26212a41faa05bee7
parent1a55bc50656bd46639dd1fbde2cc0ab8a85d1e7c (diff)
pf.conf.5: additional quoting for ranges in lists
When defining network address ranges in macros that will later be used as items in list macro, these ranges must be quoted with additiona simple quotes. For instance, the following does not work and is rejected as a syntax error: usr = "192.168.1.0/24" srv = "192.168.2.10 - 192.168.29" nat_ranges = "{" $usr $srv "}" Defining ranges as the following instead will work: usr = "'192.168.1.0/24'" srv = "'192.168.2.10 - 192.168.29'" MFC after: 3 days Reviewed by: imp, ziaee Pull Request: https://github.com/freebsd/freebsd-src/pull/1516 (cherry picked from commit 54f278caf37f9ab578ee58fc70c7b66446ea7e84)
-rw-r--r--share/man/man5/pf.conf.57
1 files changed, 7 insertions, 0 deletions
diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5
index 0b73ba6b5e02..697711a8306c 100644
--- a/share/man/man5/pf.conf.5
+++ b/share/man/man5/pf.conf.5
@@ -100,6 +100,8 @@ Macro names may not be reserved words (for example
.Ar in ,
.Ar out ) .
Macros are not expanded inside quotes.
+Ranges of network addresses used in macros that will be expanded in lists
+later on must be quoted with additional simple quotes.
.Pp
For example,
.Bd -literal -offset indent
@@ -107,6 +109,11 @@ ext_if = \&"kue0\&"
all_ifs = \&"{\&" $ext_if lo0 \&"}\&"
pass out on $ext_if from any to any
pass in on $ext_if proto tcp from any to any port 25
+
+usr_lan_range = "'192.0.2.0/24'"
+srv_lan_range = "'198.51.100.0 - 198.51.100.255'"
+nat_ranges = \&"{\&" $usr_lan_range $srv_lan_range \&"}\&"
+nat on $ext_if from $nat_ranges to any -> ($ext_if)
.Ed
.Sh TABLES
Tables are named structures which can hold a collection of addresses and