Simplify handling of __IPVn in conditional directives.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-07-06 06:43:15 -07:00
parent 65d8341c6c
commit e9d8228b6f

View File

@ -1674,15 +1674,7 @@ sub cond_error( $$$ ) {
# Evaluate an expression in an ?IF or ?ELSIF directive # Evaluate an expression in an ?IF or ?ELSIF directive
# #
sub evaluate_expression( $$$ ) { sub evaluate_expression( $$$ ) {
my ( $expression , $filename, $linenumber ) = @_; my ( $expression , $filename , $linenumber ) = @_;
if ( $family == F_IPV4 ) {
$expression =~ s/__IPV6/0/g;
$expression =~ s/__IPV4/1/g;
} else {
$expression =~ s/__IPV6/1/g;
$expression =~ s/__IPV4/0/g;
}
my $count = 0; my $count = 0;
@ -1707,6 +1699,8 @@ sub evaluate_expression( $$$ ) {
my $val; my $val;
if ( exists $capdesc{$cap} ) { if ( exists $capdesc{$cap} ) {
$val = have_capability( $cap ); $val = have_capability( $cap );
} elsif ( $cap =~ /^IPV([46])$/ ) {
$val = ( $family == $1 )
} else { } else {
cond_error "Unknown capability ($cap)", $filename, $linenumber; cond_error "Unknown capability ($cap)", $filename, $linenumber;
} }