[Ferm] How to do things without global variables

Marc Haber mh+ferm at zugschlus.de
Wed Dec 9 01:03:14 CET 2009


Hi,

if ferm would have global variables, I'd want to write this:

(file globalvars)
@def $client_networks="";


(file int104)
# these are the rules for internal network 104
# this is a client network
@def $client_networks=($client_networks 10.1.104.0/24);

<other rules applying to this network snipped)


(file int108)
# these are the rules for internal network 108
# this is a client network
@def $client_networks=($client_networks 10.1.108.0/24);

<other rules applying to this network snipped)


(file client-networks)
# these are the rules for all client networks

saddr $client_networks subchain {
  (long list of client rules snipped)
}


Sadly, this doesn't work, as the $client_networks variable seems to be
local to the files and thus the $client_networks interpolated inside
the client-networks file is empty.

Is there a way to write this elegantly without having to resort to
writing a temporary file and including it inside the client-networks
file?

Any hints would be appreciated.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 3221 2323190


More information about the Ferm mailing list