mirror of
https://gitlab.com/shorewall/code.git
synced 2025-02-02 10:59:27 +01:00
Add tracing to Optimize 16.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
3581b2667e
commit
d8caa6498a
@ -2947,13 +2947,15 @@ sub get_keys( $ ) {
|
|||||||
#
|
#
|
||||||
sub combine_dports {
|
sub combine_dports {
|
||||||
my @rules;
|
my @rules;
|
||||||
|
my $rulenum = 1;
|
||||||
|
my $chainref = shift;
|
||||||
my $baseref = shift;
|
my $baseref = shift;
|
||||||
|
|
||||||
while ( $baseref ) {
|
while ( $baseref ) {
|
||||||
{
|
{
|
||||||
my $ruleref;
|
my $ruleref;
|
||||||
my $ports1;
|
my $ports1;
|
||||||
|
my $basenum = $rulenum;
|
||||||
|
|
||||||
if ( $ports1 = get_dports( $baseref ) ) {
|
if ( $ports1 = get_dports( $baseref ) ) {
|
||||||
my $proto = $baseref->{p};
|
my $proto = $baseref->{p};
|
||||||
@ -2970,6 +2972,8 @@ sub combine_dports {
|
|||||||
while ( ( $ruleref = shift ) && $ports < 15 ) {
|
while ( ( $ruleref = shift ) && $ports < 15 ) {
|
||||||
my $ports2;
|
my $ports2;
|
||||||
|
|
||||||
|
$rulenum++;
|
||||||
|
|
||||||
if ( ( $ports2 = get_dports( $ruleref ) ) && $ruleref->{p} eq $proto ) {
|
if ( ( $ports2 = get_dports( $ruleref ) ) && $ruleref->{p} eq $proto ) {
|
||||||
#
|
#
|
||||||
# We have a candidate
|
# We have a candidate
|
||||||
@ -3016,6 +3020,9 @@ sub combine_dports {
|
|||||||
}
|
}
|
||||||
|
|
||||||
push @ports, split ',', $ports2;
|
push @ports, split ',', $ports2;
|
||||||
|
|
||||||
|
trace( $chainref, 'D', $rulenum, $ruleref ) if $debug;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
@ -3031,6 +3038,8 @@ sub combine_dports {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$baseref->{comment} = $comment if $comment;
|
$baseref->{comment} = $comment if $comment;
|
||||||
|
|
||||||
|
trace ( $chainref, 'R', $basenum, $baseref ) if $debug;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3052,7 +3061,7 @@ sub optimize_level16( $$$ ) {
|
|||||||
progress_message "\n Table $table pass $passes, $chains referenced user chains, level 16...";
|
progress_message "\n Table $table pass $passes, $chains referenced user chains, level 16...";
|
||||||
|
|
||||||
for my $chainref ( @chains ) {
|
for my $chainref ( @chains ) {
|
||||||
$chainref->{rules} = combine_dports( @{$chainref->{rules}} );
|
$chainref->{rules} = combine_dports( $chainref, @{$chainref->{rules}} );
|
||||||
}
|
}
|
||||||
|
|
||||||
$passes++;
|
$passes++;
|
||||||
|
Loading…
Reference in New Issue
Block a user