mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-18 11:38:14 +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
|
# 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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user