Avoid recent problems by not padding $target in process_tc_rule()

This commit is contained in:
Tom Eastep 2010-09-11 11:03:28 -07:00
parent d9ced1051a
commit e93a7fe9df

View File

@ -278,7 +278,7 @@ sub process_tc_rule( ) {
require_capability ('CONNMARK' , "SAVE/RESTORE Rules", '' ) if $tccmd->{connmark}; require_capability ('CONNMARK' , "SAVE/RESTORE Rules", '' ) if $tccmd->{connmark};
$target = "$tccmd->{target} "; $target = $tccmd->{target};
my $marktype = $tccmd->{mark}; my $marktype = $tccmd->{mark};
if ( $marktype == NOMARK ) { if ( $marktype == NOMARK ) {
@ -294,11 +294,7 @@ sub process_tc_rule( ) {
fatal_error "SAME rules are only allowed in the PREROUTING and OUTPUT chains" if $chain ne 'tcpre'; fatal_error "SAME rules are only allowed in the PREROUTING and OUTPUT chains" if $chain ne 'tcpre';
} }
my $chain1 = $target; ensure_mangle_chain($target);
$chain1 =~ s/ +$//;
ensure_mangle_chain($chain1);
$sticky++; $sticky++;
} elsif ( $target eq 'IPMARK' ) { } elsif ( $target eq 'IPMARK' ) {
@ -404,8 +400,6 @@ sub process_tc_rule( ) {
} }
} }
$target =~ s/ +$// if $mark eq '';
if ( ( my $result = expand_rule( ensure_chain( 'mangle' , $chain ) , if ( ( my $result = expand_rule( ensure_chain( 'mangle' , $chain ) ,
$restrictions{$chain} , $restrictions{$chain} ,
do_proto( $proto, $ports, $sports) . do_proto( $proto, $ports, $sports) .