On Fri, Jan 19, 2007 at 07:20:11PM +0100, Xavier ROUX wrote:

> int_lan = "172.16.1.0/24"
> rel_int_lan = "172.16.2.0/24"
> rel_ext_lan = "172.16.3.0/24"
> 
> lans = "{" $int_lan $rel_int_lan $rel_ext_lan "}"
> 
> I obtain this error:
> 
> # pfctl -nf /etc/pf.conf 
> /etc/pf.conf:48: syntax error
> /etc/pf.conf:83: macro 'lans' not defined
> 
> Could you give me the correct syntax?

Basically, it can't be done, due to the way the parser deals with macros
and strings.

I wonder if we should make a difference between double quotes "" and
single quotes '', like shells do. Right now, both are the same, there's
no difference between using "" or '' for strings.

We could try to make them behave differently, so that macros get expanded
inside "" but not inside '', similar to

  $ echo "$SHELL"
  /bin/ksh
  $ echo '$SHELL'
  $SHELL

Then you could simply write

  lans = "{ $int_lan $rel_int_lan $rel_ext_lan }"

No idea how many rulesets that breaks, nor how much effort it takes to
implement it. But this question pops up regularly, and it's frustrating
not to be able to provide a good explanation.

Daniel

Reply via email to