From 417bd0138e331a14054ef054c3e43637856b4a89 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 18 Jul 2014 08:32:22 -0700 Subject: [PATCH] Correct two problems with tcrules processing: - SAVE and RESTORE didn't work - '|' and '&' were ignored Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Tc.pm | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Tc.pm b/Shorewall/Perl/Shorewall/Tc.pm index 6ad585cbe..a8643446a 100644 --- a/Shorewall/Perl/Shorewall/Tc.pm +++ b/Shorewall/Perl/Shorewall/Tc.pm @@ -231,6 +231,8 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) { my ( $option, $marktype ) = @_; my $and_or = $1 if $params =~ s/^([|&])//; + $and_or ||= ''; + if ( $params =~ /-/ ) { # # A Mark Range @@ -556,7 +558,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) { mask => in_hex( $globals{TC_MASK} ), function => sub () { $target = 'MARK'; - handle_mark_param('--set-mark', , HIGHMARK ); + handle_mark_param('', , HIGHMARK ); }, }, @@ -927,21 +929,22 @@ sub process_tc_rule1( $$$$$$$$$$$$$$$$ ) { $designator = ''; } - my ( $cmd, $rest ); - - if ( $mark =~ /^TOS/ ) { - $cmd = $mark; - $rest = ''; - } else { - ($cmd, $rest) = split( '/', $mark, 2 ); - } - unless ( $command ) { { - if ( $cmd =~ /^([A-Z]+)/ ) { + my ( $cmd, $rest ) = split( '/', $mark, 2 ); + + if ( $cmd =~ /^([A-Z]+)(?:\((.+)\))?/ ) { if ( my $tccmd = $tccmd{$1} ) { fatal_error "Invalid $1 ACTION ($originalmark)" unless $tccmd->{match}($cmd); - $command = $tccmd->{command} if $tccmd->{command}; + $command = $1; + if ( supplied $rest ) { + fatal_error "Invalid $1 ACTION ($originalmark)" if supplied $2; + $mark = $rest; + } elsif ( supplied $2 ) { + $mark = $2; + } else { + $mark = ''; + } } } else { $command = 'MARK';