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} ); }; #