Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I’m trying to expand a macro that contains an address with a subnet mask into a list with PF like so:

subnet1 = ""
subnet2 = ""
subnets = "{" $subnet1 $subnet2 "}"

But this results in a syntax error on the last line:

/etc/pf.conf:3: syntax error

It works fine with non-subnet mask addresses:

ip1 = ""
ip2 = ""
ips = "{" $ip1 $ip2 "}"

I’m using PF from FreeBSD 10.0 (≈ PF from OpenBSD 4.5). How can I get this to work?

share|improve this question
up vote 2 down vote accepted

You have to quote the subnet mask addresses again (with single quotes) when defining:

subnet1 = "''"
subnet2 = "''"
subnets = "{" $subnet1 $subnet2 "}"

Sadly this doesn’t appear to be documented anywhere.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.