That's pretty basic stuff. What I want to do is create a list of macros. The pf faq says:

"
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 "}"
"
(http://www.openbsd.org/faq/pf/macros.html)

That works.  But try this:

host1 = "192"
host2 = "192.168.1.2"
all_hosts = "{" $host1 $host2 "}"

You'll get:

/etc/pf.conf:linenum: syntax error
pfctl: Syntax error in config file: pf rules not loaded

Now try this:

host1 = "192.1"
host2 = "192.168.1.2"
all_hosts = "{" $host1 $host2 "}"

That'll work too.  Can't use macros for port numbers if dots are required.

Thanks,
Jose.


phoenixcomm wrote:
Jose Quinteiro-5 wrote:
The pf.conf man page sez:

Macros are not expanded inside quotes.

      For example,

            ext_if = "kue0"
            all_ifs = "{" $ext_if lo0 "}"


However, that following fails with a syntax error on 4.3. On 4.2 something like this worked:

foo = 123
bar = 456

fubar_ports = "{ $foo $bar }"

However, that does not work on 4.3 either.

Thanks,
Jose.





the book is alway right
Macro names must start with a letter and may contain letters, digits, and
underscores. Macro names cannot be reserved words such as pass, out, or
queue.

    ext_if = "fxp0"

    block in on $ext_if from any to any

This creates a macro named ext_if. When a macro is referred to after it's
been created, its name is preceded with a $ character.

Macros can also expand to lists, such as:

friends = "{ 192.168.1.1, 10.0.2.5, 192.168.43.53 }"
good luck

Reply via email to