[Ferm] adding to a list
Marc Haber
mh+ferm at zugschlus.de
Thu Mar 3 22:19:36 CET 2011
I am talking to myself:
> something like
>
> @def $l_backexec_clients=($l_backexec_clients $host);
>
> is becoming a rather common idiom in my ferm rules, when I add a
> host's IP address to a list of hosts that is processed in a later rule.
>
> How would I write a function that would allow me to write
>
> @add_to_backexec_clients($host);
>
> or
>
> @add_to_list($l_backexec_clients,$host);
1 @def $l=();
2 @def $l=($l 192.0.2.1);
3 @def $l=($l 192.0.2.10.);
4
5 @def &add_l($ip) = {
6 @def $l=($l $ip);
7 }
8
9 @add_l(192.0.2.20);
10
11 @def &add_to_list($list,$ip) = {
12 @def $list=($list $ip);
13 }
14
15 &add_to_list($l,192.0.2.30);
16
17 chain OUTPUT daddr $l ACCEPT;
The first variant starting at line 5 simply doesn't work. I guess that
the @def on line 6 defines a new $l that is only valid inside the
function.
The second variant, starting at line 11, gives a syntax error once
line 15 is present.
Is it possible to do what I want to do?
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