From b7273d6999b626920acb86144f01ffddd458819d Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 25 Jan 2013 13:55:04 -0800 Subject: [PATCH] Favor low-numbered less complex synonym chains in optimization 8. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Chains.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index 484f02665..2debbd581 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -3120,18 +3120,22 @@ sub optimize_level4( $$ ) { } # -# Delete duplicate chains replacing their references +# Compare two chains. Sort in reverse order except within names that have the +# same first character, which are sorted in forward order. # sub level8_compare( $$ ) { my ( $name1, $name2 ) = ( $_[0]->{name}, $_[1]->{name} ); - if ( $name1 =~ /^%/ && $name2 =~ /^%/ ) { + if ( substr( $name1, 0, 1 ) eq substr( $name2, 0, 1 ) ) { $name1 cmp $name2; } else { $name2 cmp $name1; } } +# +# Delete duplicate chains replacing their references +# sub optimize_level8( $$$ ) { my ( $table, $tableref , $passes ) = @_; my $progress = 1;