On Wed, Oct 12, 2016 at 09:50:41AM -0400, Russell Sutherland wrote:
> Is it possible to use a macro variable with a network CIDR value and then
> reference it later in a list?
>
> E.g. This first example is fine:
>
>
> a = “1.2.3.4”
> b = “2.3.4.5”
>
> c = “{“ $a $b “}”
>
> works as expected, that is c ends up as a list with host values:
>
> c = "{ 1.2.3.4 2.3.4.5 }”
>
> But if one uses the CIDR network format for any one of the variables, a syntax
> error is created:
>
> an = “1.2.3.0/24”
> bn = “2.3.0.0/16”
>
> cn = “{“ $an $bn “}”
>
> Output from pfctl -nvf /etc/pf.conf:
>
> a = "1.2.3.4"
> b = "2.3.4.5"
> c = "{ 1.2.3.4 2.3.4.5 }"
> an = "1.2.3.0/24"
> bn = "2.3.0.0/16"
> /etc/pf.conf:36: syntax error
>
>
> —
> Russell Sutherland
> Supervisor, Network Development | Enterprise Infrastructure Solutions
> Information Technology Services | University of Toronto
> 4 Bancroft Ave., Rm. 102 | Toronto, ON M5S 1C1
>
> russell.sutherl...@utoronto.ca
> +1.416.978.0470 ~ tel
> +1.416.978.6620 ~ fax
Often it is better to use a table to hold addresses:
table { $an $bn }
works,
Roughly speaking, in the macro it doesn't work since / cannot be part
of an unquoted string.
-Otto