PF pf syntax for tables

big_girl

Active Member

Reaction score: 14
Messages: 115

After looking here, I'm getting some unexpected errors in a simple pf.conf while just trying to use tables correctly-

cat /etc/pf.conf
Code:
table <martians> const { 0.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8 }
table <martians_10> const { 10.0.0.0/8 }
table <martians_169> const { 169.254.0.0/16 }
pfctl -vnf /etc/pf.conf
Code:
/etc/pf.conf:1: syntax error
/etc/pf.conf:2: syntax error
/etc/pf.conf:3: syntax error
All I want to do is declare some constant tables...
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,696
Messages: 30,639

Don't look too hard at the OpenBSD PF man pages. FreeBSD's PF is based on a much older PF. That said, there's nothing wrong with your tables:
Code:
root@maelcum:~ # cat pf.test
table <martians> const { 0.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8 }
table <martians_10> const { 10.0.0.0/8 }
table <martians_169> const { 169.254.0.0/16 }
root@maelcum:~ # pfctl -nf pf.test
root@maelcum:~ #
 
OP
OP
big_girl

big_girl

Active Member

Reaction score: 14
Messages: 115

Thanks for checking that.

On a 11.0-RELEASE-p2, fresh install, I still get the same error, error, error when running pfctl -vnf on those three table declaration lines.

This is weird.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,696
Messages: 30,639

The lines may have some non-printable characters attached to them. I've seen this happen before.
 
Top