[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-pf
Subject:    Re: pf macro syntax problems
From:       Russell Sutherland <russ () madhaus ! cns ! utoronto ! ca>
Date:       2004-06-30 11:52:39
Message-ID: 20040630115239.GA1166 () madhaus ! cns ! utoronto ! ca
[Download RAW message or body]

* Francis A. Vidal (francisv@dagupan.com) [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: owner-pf@benzedrine.cx [mailto:owner-pf@benzedrine.cx] On Behalf Of
> Russell Sutherland
> Sent: Wednesday, June 30, 2004 2:00 AM
> To: pf@benzedrine.cx
> 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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic