On 2/10/13 11:10 AM, "Mr Dash Four" <[email protected]> wrote:
>
>> I am trying to do that optimisation from the calling action (ELOG)
>> since I have access to all the parameters and can determine whether
>> the action to be executed will have signel or multiple statements. If
>> I see that there will be only one statement (as was with the case
>> posted previously) I call ALOG's inline equivalent - IALOG (both
>> action.ALOG and action.IALOG are the same - symlinked on the file
>> system), but I am struggling with two things:
>>
>> 1. How do I use arithmetic operations on variables? Doing the following:
>>
>> ?SET one 1
>> ?SET two 2
>> ?SET sum @{one} + @{two}
>>
>> doesn't get me anywhere (I get 'Argument "" isn't numeric in addition
>> (+)' message).
>>
>> 2. Similar to 1 above - how do I use logical operations on variables?
>> Doing the following:
>>
>> ?SET one 1
>> ?SET two
>> ?SET logical_or @{one} | @{two}
>>
>> is simply ignored by shorewall (same goes if I apply logical and -
>> "@{one} & @{two}").
>>From http://www.shorewall.net/configuration_file_basics.htm#Conditional:
>
>"Beginning with Shorewall 4.5.6, rather than a simple variable in ?IF
>directives, Perl-compatible expressions are allowed (after the Shorewall
>compiler expands all variables, the resulting expression is then
>evaluated by Perl). Variables in the expressions are as described
>above.". So, according to this, if I have something like:
>
>?SET c1 1
>?SET c2 1
>?IF @c1 + @c2 > 1
>[...]
>?ENDIF
>
>should work, but it doesn't (I get the same obnoxious 'Argument "" isn't
>numeric in addition (+)' message), unless addition between c1 and c2 is
>not specified with the plus sign (+) in perl or there is yet another bug
>in shorewall! Go figure...
Try the attached patch. There was a silly bug in processing expressions
consisting of a single number.
-Tom
You do not need a parachute to skydive. You only need a parachute to
skydive twice.
DIGITS.patch
Description: Binary data
------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________ Shorewall-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/shorewall-devel
