mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-18 03:29:12 +01:00
Simplify handling of __IPVn in conditional directives.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
65d8341c6c
commit
e9d8228b6f
@ -1674,15 +1674,7 @@ sub cond_error( $$$ ) {
|
||||
# Evaluate an expression in an ?IF or ?ELSIF directive
|
||||
#
|
||||
sub evaluate_expression( $$$ ) {
|
||||
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 ( $expression , $filename , $linenumber ) = @_;
|
||||
|
||||
my $count = 0;
|
||||
|
||||
@ -1707,6 +1699,8 @@ sub evaluate_expression( $$$ ) {
|
||||
my $val;
|
||||
if ( exists $capdesc{$cap} ) {
|
||||
$val = have_capability( $cap );
|
||||
} elsif ( $cap =~ /^IPV([46])$/ ) {
|
||||
$val = ( $family == $1 )
|
||||
} else {
|
||||
cond_error "Unknown capability ($cap)", $filename, $linenumber;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user