mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-23 14:08:45 +01:00
Clean up mangle actions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
1add0487f6
commit
301bce5d34
@ -4322,23 +4322,19 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
|||||||
minparams => 0 ,
|
minparams => 0 ,
|
||||||
maxparams => 16 ,
|
maxparams => 16 ,
|
||||||
function => sub() {
|
function => sub() {
|
||||||
|
fatal_error( qq(Action $cmd may not be used in the mangle file) ) unless $actiontype & MANGLE_TABLE;
|
||||||
fatal_error q('$FW' may not be specified within an action body) if $chainref;
|
fatal_error q('$FW' may not be specified within an action body) if $chainref;
|
||||||
#
|
#
|
||||||
# Create the action:level:tag:param tuple.
|
# Create the action:level:tag:param tuple.
|
||||||
#
|
#
|
||||||
my $normalized_target = normalize_action( $cmd, '', $params );
|
my $normalized_target = normalize_action( $cmd, '', $params );
|
||||||
|
|
||||||
fatal_error( "Action $cmd invoked Recursively (" . join( '->', map( external_name( $_ ), @actionstack , $normalized_target ) ) . ')' ) if $active{$cmd};
|
fatal_error( "Action $cmd invoked Recursively (" . join( '->', map( external_name( $_ ), @actionstack , $normalized_target ) ) . ')' ) if $active{$cmd};
|
||||||
|
|
||||||
my $ref = use_action( 'mangle', $normalized_target );
|
my $ref = use_action( 'mangle', $normalized_target );
|
||||||
|
|
||||||
if ( $ref ) {
|
if ( $ref ) {
|
||||||
#
|
#
|
||||||
# First reference to this tuple
|
# First reference to this tuple - process_action may modify both $normalized_target and $ref!!!
|
||||||
#
|
|
||||||
my $savestatematch = $statematch;
|
|
||||||
#
|
|
||||||
# process_action may modify both $normalized_target and $ref!!!
|
|
||||||
#
|
#
|
||||||
process_action( $normalized_target, $ref, $chainnames{$chain} );
|
process_action( $normalized_target, $ref, $chainnames{$chain} );
|
||||||
#
|
#
|
||||||
@ -4359,8 +4355,11 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
|||||||
# Function Body
|
# Function Body
|
||||||
#
|
#
|
||||||
if ( $inaction ) {
|
if ( $inaction ) {
|
||||||
( $inaction , undef ) = split( /:/, $chainref->{name}, 2 ) if $chainref->{action};
|
assert( $chainref->{action} );
|
||||||
$chainnames{$chain = ACTIONCHAIN} = $chainref->{name};
|
#
|
||||||
|
# Set chain type
|
||||||
|
#
|
||||||
|
$chain = ACTIONCHAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
( $cmd, $designator ) = split_action( $action );
|
( $cmd, $designator ) = split_action( $action );
|
||||||
@ -4374,7 +4373,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
|||||||
|
|
||||||
( $cmd , $params ) = get_target_param1( $cmd );
|
( $cmd , $params ) = get_target_param1( $cmd );
|
||||||
|
|
||||||
$actiontype = $builtin_target{$cmd} || $targets{$cmd};
|
$actiontype = $builtin_target{$cmd} || $targets{$cmd} || 0;
|
||||||
|
|
||||||
$commandref = $commands{$cmd};
|
$commandref = $commands{$cmd};
|
||||||
|
|
||||||
@ -4451,9 +4450,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# Call the command's processing function
|
# Call the command's processing function
|
||||||
#
|
#
|
||||||
my $function = $commandref->{function};
|
$commandref->{function}->();
|
||||||
|
|
||||||
$function->();
|
|
||||||
|
|
||||||
unless ( $done ) {
|
unless ( $done ) {
|
||||||
$chain ||= $designator;
|
$chain ||= $designator;
|
||||||
|
Loading…
Reference in New Issue
Block a user