Re: [Shorewall-users] Macro files bug

Tom Eastep
Fri, 26 Oct 2007 21:36:20 -0000

Andrew Suffield wrote:
> On Fri, Oct 26, 2007 at 11:11:53AM -0700, Tom Eastep wrote:
>> I''ll have to think about this proposal. I don''t
believe that I can just
>> suddenly de-implement Macros in Shorewall-perl so I would need to add
the
>> ''function'' capability in an upwardly-compatible way.
>
> It should be fairly simple to accomplish that - but I really
haven''t
> thought about the problem for any longer than it took to write that
> mail, it''s just a sketch of one possible approach. The basic goal
is
> straightforward: there''s no good reason for the limitations of the
> macro system, and tossing a Turing-complete language in there pretty
> much eliminates them with a minimum of effort.
>
> I''d be happy with anything that I can (ab)use to implement:
>
> foreach i in x,y,z: ACCEPT fw $i tcp ssh

How about something so simple as:

SHELL for z in x y z; do echo ACCEPT fw $z tcp ssh; done

Line continuation can be used for more complex scripts.

And it took me less that 1/2 hour to get that working :-) And it''s
available
in any file.