Back out part of TC change

This commit is contained in:
Tom Eastep 2011-05-02 17:22:06 -07:00
parent 5ce6d7d988
commit d8c2845085
2 changed files with 4 additions and 6 deletions

View File

@ -814,7 +814,6 @@ sub numeric_value1 ( $ ) {
sub hex_value( $ ) { sub hex_value( $ ) {
my $val = lc $_[0]; my $val = lc $_[0];
$val =~ s/^0x//;
return undef unless $val =~ /^[a-fA-F0-9]+$/; return undef unless $val =~ /^[a-fA-F0-9]+$/;
no warnings; no warnings;
oct '0x' . $val; oct '0x' . $val;
@ -825,9 +824,8 @@ sub hex_value( $ ) {
# Strip off leading 0x and superfluous leading zeros from a hex number # Strip off leading 0x and superfluous leading zeros from a hex number
# #
sub normalize_hex( $ ) { sub normalize_hex( $ ) {
my $val = shift; my $val = lc shift;
$val =~ s/^0x//;
$val =~ s/^0// while $val =~ /^0/ && length $val > 1; $val =~ s/^0// while $val =~ /^0/ && length $val > 1;
$val; $val;
} }

View File

@ -252,7 +252,7 @@ sub process_tc_rule( ) {
require_capability ('CONNMARK' , "CONNMARK Rules", '' ) if $connmark; require_capability ('CONNMARK' , "CONNMARK Rules", '' ) if $connmark;
} else { } else {
fatal_error "Invalid MARK ($originalmark)" unless $mark =~ /^([0-9]+|0x[0-9a-f]+)$/ and $designator =~ /^([0-9]+|0x[0-9a-f]+)$/; fatal_error "Invalid MARK ($originalmark)" unless $mark =~ /^([0-9a-fA-F]+)$/ and $designator =~ /^([0-9a-fA-F]+)$/;
if ( $config{TC_ENABLED} eq 'Internal' || $config{TC_ENABLED} eq 'Shared' ) { if ( $config{TC_ENABLED} eq 'Internal' || $config{TC_ENABLED} eq 'Shared' ) {
$originalmark = join( ':', normalize_hex( $mark ), normalize_hex( $designator ) ); $originalmark = join( ':', normalize_hex( $mark ), normalize_hex( $designator ) );
@ -562,7 +562,7 @@ sub process_simple_device() {
my $id = $number; $number = in_hexp( $devnum | 0x100 ); my $id = $number; $number = in_hexp( $devnum | 0x100 );
emit "run_tc qdisc add dev $physical parent $number: handle $number: prio bands 3 priomap $config{TC_PRIOMAP}"; emit "run_tc qdisc add dev $physical parent $id: handle $number: prio bands 3 priomap $config{TC_PRIOMAP}";
} else { } else {
emit "run_tc qdisc add dev $physical root handle $number: prio bands 3 priomap $config{TC_PRIOMAP}"; emit "run_tc qdisc add dev $physical root handle $number: prio bands 3 priomap $config{TC_PRIOMAP}";
} }
@ -763,7 +763,7 @@ sub validate_tc_class( ) {
( $device, my ($number, $subnumber, $rest ) ) = split /:/, $device, 4; ( $device, my ($number, $subnumber, $rest ) ) = split /:/, $device, 4;
fatal_error "Invalid INTERFACE:CLASS ($devclass)" if defined $rest; fatal_error "Invalid INTERFACE:CLASS ($devclass)" if defined $rest;
if ( $device =~ /^(\d+|0x[\da-fA-F]+)$/ || ( $device =~ /^[\da-fA-F]+$/ && ! $tcdevices{$device} ) ) { if ( $device =~ /^[\da-fA-F]+$/ && ! $tcdevices{$device} ) {
( $number , $classnumber ) = ( hex_value $device, hex_value $number ); ( $number , $classnumber ) = ( hex_value $device, hex_value $number );
( $device , $devref) = dev_by_number( $number ); ( $device , $devref) = dev_by_number( $number );
} else { } else {