From 6ce3d0180e371a112991ef42dd94eeae7bece445 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 7 Jul 2012 09:47:10 -0700 Subject: [PATCH] Ensure a defined value for __IPV[46] Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Config.pm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index fd07e1081..a7f619b34 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -1675,13 +1675,12 @@ sub cond_error( $$$ ) { # sub evaluate_expression( $$$ ) { my ( $expression , $filename , $linenumber ) = @_; - + my $val; my $count = 0; # $1 $2 $3 - $4 while ( $expression =~ m( ^(.*?) \$({)? (\w+) (?(2)}) (.*)$ )x ) { my ( $first, $var, $rest ) = ( $1, $3, $4); - my $val; $val = ( exists $ENV{$var} ? $ENV{$var} : exists $params{$var} ? $params{$var} : @@ -1696,20 +1695,18 @@ sub evaluate_expression( $$$ ) { # $1 $2 $3 - $4 while ( $expression =~ m( ^(.*?) __({)? (\w+) (?(2)}) (.*)$ )x ) { my ( $first, $cap, $rest ) = ( $1, $3, $4); - my $val; + if ( exists $capdesc{$cap} ) { - $val = have_capability( $cap ); + $val = have_capability( $cap ) } elsif ( $cap =~ /^IPV([46])$/ ) { - $val = ( $family == $1 ) + $val = ( $family == $1 ); } else { cond_error "Unknown capability ($cap)", $filename, $linenumber; } - $expression = join( '', $first, $val, $rest ); + $expression = join( '', $first, $val || 0, $rest ); } - my $val; - if ( $expression =~ /^\s*(\d+)\s*$/ || $expression =~ /\s*'(.*?)'\s*$/ ) { # # Simple one-term expression -- don't compile it