[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pf macro syntax problems



* Francis A. Vidal ([email protected]) [29 Jun 2004 21:47]:
> I think you're missing a comma in between $host1 and $host2. It should
> be:
> 
> 	all_hosts = "{ $host1, $host2 }"
> 
The commas do not seem to matter. The issue is that when
the variables $host1 and $host2 are of the format:
        a.b.c.d/N
the list syntax given above (with or without the commas) gives
a syntax error.
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of
> Russell Sutherland
> Sent: Wednesday, June 30, 2004 2:00 AM
> To: [email protected]
> Subject: pf macro syntax problems
> 
> According to the pf FAQ:
> 
>         Macros can be defined recursively. Since macros are not expanded
> within
>         quotes the following syntax must be used:
> 
>                 host1 = "192.168.1.1"
>                 host2 = "192.168.1.2"
>                 all_hosts = "{" $host1 $host2 "}"
> 
> However when one tries to use this syntax to create a list of networks
> a syntax error occurs when checking the rule set using pfctl:
> 
>         # cat nets.conf
> 
>         netA = "18.100.0.0/16"
>         netB = "12.150.0.0/16"
>         netC = "12.151.0.0/16"
>         nets = "{" $netA $netB $netC "}"
> 
>         # pfctl -nvf ./nets.conf
>         netA = "18.100.0.0/16"
>         netB = "12.150.0.0/16"
>         netC = "12.151.0.0/16"
>         ./nets.conf:5: syntax error
> 
> How does one create a macro to expand to a list of networks?
-- 
Russell P. Sutherland      	Email: russ @ madhaus.cns.utoronto.ca
4 Bancroft Ave., Rm. 102	Voice: +1.416.978.0470
University of Toronto		Fax:   +1.416.978.6620
Toronto, ON  M5S 1C1 		WWW:   http://madhaus.cns.utoronto.ca/~russ
CANADA