From 76d9a80df3f68da0804022fe02d0892bb94c0092 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Thu, 3 Sep 2009 18:26:50 -0700 Subject: [PATCH] A small optimization on the last restriction removal --- Shorewall/Perl/Shorewall/Chains.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index e53462c86..2c280cc73 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -422,15 +422,16 @@ sub add_commands ( $$;@ ) { } sub push_rule( $$ ) { - my ($chainref, $rule) = @_; + my $chainref = $_[0]; + my $rule = join( ' ', '-A', $chainref->{name} , $_[1]); $rule .= qq( -m comment --comment "$comment") if $comment; if ( $chainref->{cmdlevel} ) { $rule =~ s/"/\\"/g; #Must preserve quotes in the rule - add_commands $chainref , qq(echo "-A $chainref->{name} $rule" >&3); + add_commands $chainref , qq(echo "$rule" >&3); } else { - push @{$chainref->{rules}}, join( ' ', '-A' , $chainref->{name}, $rule ); + push @{$chainref->{rules}}, $rule; $chainref->{referenced} = 1; } }