Rename %logactionchains -> %usedactions

This commit is contained in:
Tom Eastep 2010-12-20 10:32:04 -08:00
parent 8c8e4d1654
commit ebbf381e27
3 changed files with 10 additions and 20 deletions

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
process_actions2
%actions
%logactionchains
%usedactions
%default_actions
);
our @EXPORT_OK = qw( initialize );
@ -66,7 +66,7 @@ our %actions;
#
# Contains an entry for each used <action>:<level>[:<tag>] that maps to the associated chain.
#
our %logactionchains;
our %usedactions;
our $family;
@ -88,7 +88,7 @@ sub initialize( $ ) {
ACCEPT => 'none' ,
QUEUE => 'none' );
%actions = ();
%logactionchains = ();
%usedactions = ();
}
#
@ -188,7 +188,7 @@ sub createlogactionchain( $$$$$ ) {
$chain = substr( $chain, 0, 27 ), redo CHECKDUP if ( $actionref->{actchain} || 0 ) >= 10 and length $chain == 28;
}
$logactionchains{$normalized} = $chainref = new_standard_chain '%' . $chain . $actionref->{actchain}++;
$usedactions{$normalized} = $chainref = new_standard_chain '%' . $chain . $actionref->{actchain}++;
fatal_error "Too many invocations of Action $action" if $actionref->{actchain} > 99;
@ -218,7 +218,7 @@ sub createsimpleactionchain( $ ) {
my $action = shift;
my $chainref = new_standard_chain $action;
$logactionchains{"$action:none::"} = $chainref;
$usedactions{"$action:none::"} = $chainref;
unless ( $targets{$action} & BUILTIN ) {
@ -268,7 +268,7 @@ sub createactionchain( $ ) {
sub use_action( $ ) {
my $normalized = shift;
if ( $logactionchains{$normalized} ) {
if ( $usedactions{$normalized} ) {
0;
} else {
createactionchain $normalized;
@ -307,7 +307,7 @@ sub process_actions2 () {
while ( $changed ) {
$changed = 0;
for my $target (keys %logactionchains) {
for my $target (keys %usedactions) {
my ( $action, $level, $tag, $param ) = split ':', $target;
my $actionref = $actions{$action};
assert( $actionref );

View File

@ -275,7 +275,7 @@ sub add_a_provider( ) {
require_capability 'REALM_MATCH', "Configuring multiple providers through one interface", "s";
}
fatal_error "Unknown Interface ($interface)" unless known_interface( $interface, 1 );
fatal_error "Unknown Interface ($interface)" unless known_interface( $interface );
fatal_error "A bridge port ($interface) may not be configured as a provider interface" if port_to_bridge $interface;
my $physical = get_physical $interface;

View File

@ -240,16 +240,6 @@ sub map_old_actions( $ ) {
}
}
#
# Find the chain that handles the passed action. If the chain cannot be found,
# a fatal error is generated and the function does not return.
#
sub find_logactionchain( $ ) {
my $fullaction = $_[0];
fatal_error "Fatal error in find_logactionchain" unless $logactionchains{$fullaction};
}
#
# The functions process_actions1-3() implement the three phases of action processing.
#
@ -553,7 +543,7 @@ sub process_actions3 () {
'forwardUPnP' => \&forwardUPnP,
'Limit' => \&Limit, );
while ( my ( $wholeaction, $chainref ) = each %logactionchains ) {
while ( my ( $wholeaction, $chainref ) = each %usedactions ) {
my ( $action, $level, $tag, $param ) = split /:/, $wholeaction;
if ( $targets{$action} & BUILTIN ) {
@ -1228,7 +1218,7 @@ sub process_rule_common ( $$$$$$$$$$$$$$$$ ) {
unless ( $actiontype & NATONLY ) {
if ( $actiontype & ACTION ) {
$action = (find_logactionchain $normalized_target)->{name};
$action = $usedactions{$normalized_target}{name};
$loglevel = '';
}