mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-30 03:23:47 +01:00
Rename %special -> %opttype
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
bfd63dcace
commit
1d24f28c83
@ -434,7 +434,7 @@ use constant { UNIQUE => 1,
|
|||||||
MATCH => 8,
|
MATCH => 8,
|
||||||
CONTROL => 16 };
|
CONTROL => 16 };
|
||||||
|
|
||||||
my %special = ( rule => CONTROL,
|
my %opttype = ( rule => CONTROL,
|
||||||
cmd => CONTROL,
|
cmd => CONTROL,
|
||||||
|
|
||||||
dhcp => UNIQUE,
|
dhcp => UNIQUE,
|
||||||
@ -615,18 +615,18 @@ sub set_rule_option( $$$ ) {
|
|||||||
|
|
||||||
$ruleref->{simple} = 0;
|
$ruleref->{simple} = 0;
|
||||||
|
|
||||||
my $special = $special{$option} || MATCH;
|
my $opttype = $opttype{$option} || MATCH;
|
||||||
|
|
||||||
if ( exists $ruleref->{$option} ) {
|
if ( exists $ruleref->{$option} ) {
|
||||||
assert( defined $ruleref->{$option} );
|
assert( defined $ruleref->{$option} );
|
||||||
|
|
||||||
if ( $special == MATCH ) {
|
if ( $opttype == MATCH ) {
|
||||||
assert( $globals{KLUDGEFREE} );
|
assert( $globals{KLUDGEFREE} );
|
||||||
$ruleref->{$option} = [ $ruleref->{$option} ] unless reftype $ruleref->{$option};
|
$ruleref->{$option} = [ $ruleref->{$option} ] unless reftype $ruleref->{$option};
|
||||||
push @{$ruleref->{$option}}, ( reftype $value ? @$value : $value );
|
push @{$ruleref->{$option}}, ( reftype $value ? @$value : $value );
|
||||||
} elsif ( $special == EXCLUSIVE ) {
|
} elsif ( $opttype == EXCLUSIVE ) {
|
||||||
$ruleref->{$option} .= ",$value";
|
$ruleref->{$option} .= ",$value";
|
||||||
} elsif ( $special == UNIQUE ) {
|
} elsif ( $opttype == UNIQUE ) {
|
||||||
fatal_error "Multiple $option settings in one rule is prohibited";
|
fatal_error "Multiple $option settings in one rule is prohibited";
|
||||||
} else {
|
} else {
|
||||||
assert(0);
|
assert(0);
|
||||||
@ -773,7 +773,7 @@ sub format_rule( $$;$ ) {
|
|||||||
$rule .= format_option( 'state', $ruleref->{state} ) if defined $ruleref->{state};
|
$rule .= format_option( 'state', $ruleref->{state} ) if defined $ruleref->{state};
|
||||||
$rule .= format_option( 'policy', $ruleref->{policy} ) if defined $ruleref->{policy};
|
$rule .= format_option( 'policy', $ruleref->{policy} ) if defined $ruleref->{policy};
|
||||||
|
|
||||||
$rule .= format_option( $_, $ruleref->{$_} ) for sort ( grep ! $special{$_}, keys %{$ruleref} );
|
$rule .= format_option( $_, $ruleref->{$_} ) for sort ( grep ! $opttype{$_}, keys %{$ruleref} );
|
||||||
|
|
||||||
if ( $ruleref->{target} ) {
|
if ( $ruleref->{target} ) {
|
||||||
$rule .= join( ' ', " -$ruleref->{jump}", $ruleref->{target} );
|
$rule .= join( ' ', " -$ruleref->{jump}", $ruleref->{target} );
|
||||||
@ -801,7 +801,7 @@ sub merge_rules( $$$ ) {
|
|||||||
$toref->{$option} = $fromref->{$option} if exists $fromref->{$option};
|
$toref->{$option} = $fromref->{$option} if exists $fromref->{$option};
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $option ( grep ! $special{$_}, keys %$fromref ) {
|
for my $option ( grep ! $opttype{$_}, keys %$fromref ) {
|
||||||
set_rule_option( $toref, $option, $fromref->{$option} );
|
set_rule_option( $toref, $option, $fromref->{$option} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user