Ensure a defined value for __IPV[46]

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-07-07 09:47:10 -07:00
parent aa652fda1b
commit 6ce3d0180e

View File

@ -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