Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

subnet1 = "192.168.1.0/24"
subnet2 = "10.0.0.0/8"
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 = "192.168.1.0"
ip2 = "10.0.0.0"
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

1 Answer 1

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

subnet1 = "'192.168.1.0/24'"
subnet2 = "'10.0.0.0/8'"
subnets = "{" $subnet1 $subnet2 "}"

Sadly this doesn’t appear to be documented anywhere.

share|improve this answer

Your Answer

 
discard

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.