mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-24 15:18:53 +01:00
Improve optimizer handling of origin during rule merge
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
1c4815358b
commit
894a98f24e
@ -1191,6 +1191,8 @@ sub merge_rules( $$$ ) {
|
|||||||
$toref->{comment} = $fromref->{comment} if exists $fromref->{comment};
|
$toref->{comment} = $fromref->{comment} if exists $fromref->{comment};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$toref->{origin} = $fromref->{origin} if $fromref->{origin};
|
||||||
|
|
||||||
$toref->{target} = $target;
|
$toref->{target} = $target;
|
||||||
|
|
||||||
if ( my $targetref = $tableref->{$target} ) {
|
if ( my $targetref = $tableref->{$target} ) {
|
||||||
@ -3106,8 +3108,8 @@ sub calculate_digest( $ ) {
|
|||||||
#
|
#
|
||||||
# Replace jumps to the passed chain with jumps to the passed target
|
# Replace jumps to the passed chain with jumps to the passed target
|
||||||
#
|
#
|
||||||
sub replace_references( $$$$;$ ) {
|
sub replace_references( $$$$$;$ ) {
|
||||||
my ( $chainref, $target, $targetopts, $comment, $digest ) = @_;
|
my ( $chainref, $target, $targetopts, $comment, $origin, $digest ) = @_;
|
||||||
my $tableref = $chain_table{$chainref->{table}};
|
my $tableref = $chain_table{$chainref->{table}};
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
my $name = $chainref->{name};
|
my $name = $chainref->{name};
|
||||||
@ -3125,6 +3127,7 @@ sub replace_references( $$$$;$ ) {
|
|||||||
$_->{target} = $target;
|
$_->{target} = $target;
|
||||||
$_->{targetopts} = $targetopts if $targetopts;
|
$_->{targetopts} = $targetopts if $targetopts;
|
||||||
$_->{comment} = $comment unless $_->{comment};
|
$_->{comment} = $comment unless $_->{comment};
|
||||||
|
$_->{origin} = $origin if $origin;
|
||||||
|
|
||||||
if ( $targetref ) {
|
if ( $targetref ) {
|
||||||
add_reference ( $fromref, $targetref );
|
add_reference ( $fromref, $targetref );
|
||||||
@ -3375,7 +3378,8 @@ sub optimize_level4( $$ ) {
|
|||||||
replace_references( $chainref,
|
replace_references( $chainref,
|
||||||
$firstrule->{target},
|
$firstrule->{target},
|
||||||
$firstrule->{targetopts},
|
$firstrule->{targetopts},
|
||||||
$firstrule->{comment} );
|
$firstrule->{comment},
|
||||||
|
$firstrule->{origin} );
|
||||||
$progress = 1;
|
$progress = 1;
|
||||||
}
|
}
|
||||||
} elsif ( $firstrule->{target} ) {
|
} elsif ( $firstrule->{target} ) {
|
||||||
@ -3595,7 +3599,7 @@ sub optimize_level8( $$$ ) {
|
|||||||
if ( $chainref->{digest} eq $chainref1->{digest} ) {
|
if ( $chainref->{digest} eq $chainref1->{digest} ) {
|
||||||
progress_message " Chain $chainref1->{name} combined with $chainref->{name}";
|
progress_message " Chain $chainref1->{name} combined with $chainref->{name}";
|
||||||
$progress = 1;
|
$progress = 1;
|
||||||
replace_references $chainref1, $chainref->{name}, undef, '', 1;
|
replace_references $chainref1, $chainref->{name}, undef, '', '', 1;
|
||||||
|
|
||||||
unless ( $chainref->{name} =~ /^~/ || $chainref1->{name} =~ /^%/ ) {
|
unless ( $chainref->{name} =~ /^~/ || $chainref1->{name} =~ /^%/ ) {
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user