From 6779c8307f2b8e769649e5b7abe23c014611599a Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Thu, 10 Mar 2016 15:26:52 -0800 Subject: [PATCH] Optimize chain resolution in process_mangle_rule1() Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Rules.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index b23aaaa31..5985683ab 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -4467,9 +4467,12 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) { # Subroutine to resolve which chain to use # my $resolve_chain = sub() { - $chain ||= $designator; - $chain ||= $commandref->{defaultchain}; - $chain ||= $default_chain; + unless ( $chain ) { + $chain ||= $designator; + $chain ||= $commandref->{defaultchain}; + $chain ||= $default_chain; + } + $chainref = ensure_chain( 'mangle', $chainnames{$chain} ); }; #