From 7e6fc3229d41cc06feedc9a08ff3ac114a1c3491 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Tue, 7 Jan 2014 13:15:51 -0800 Subject: [PATCH] Correct handling of default chain when a mark range is specified. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Tc.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Tc.pm b/Shorewall/Perl/Shorewall/Tc.pm index a3159204a..c8584dbcf 100644 --- a/Shorewall/Perl/Shorewall/Tc.pm +++ b/Shorewall/Perl/Shorewall/Tc.pm @@ -215,12 +215,12 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) { our $matches = ''; our $params = ''; our $done = 0; - my $default_chain = 0; + our $default_chain = 0; our $restriction = 0; our $exceptionrule = ''; my $device = ''; our $cmd; - my $designator; + our $designator; my $fw = firewall_zone; sub handle_mark_param( $ ) { @@ -253,6 +253,9 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) { my $marks = ( ( $mark2val - $markval ) >> $shift ) + 1; + $chain ||= $designator; + $chain ||= $default_chain; + my $chainref = ensure_chain( 'mangle', $chain = $chainnames{$chain} ); for ( my $packet = 0; $packet < $marks; $packet++, $markval += $increment ) { @@ -367,9 +370,8 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) { minparams => 1, maxparams => 1, function => sub () { - $chain = $designator || $default_chain; $target = 'CONNMARK'; - handle_mark_param('--set-mark'); + handle_mark_param('--set-mark' ); }, },