More fixes for TC

This commit is contained in:
Tom Eastep 2011-05-01 21:24:52 -07:00
parent 3bdde27bd1
commit a0b00b4bd6
2 changed files with 2 additions and 1 deletions

View File

@ -813,6 +813,7 @@ 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;

View File

@ -255,6 +255,7 @@ sub process_tc_rule( ) {
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-9]+|0x[0-9a-f]+)$/ and $designator =~ /^([0-9]+|0x[0-9a-f]+)$/;
if ( $config{TC_ENABLED} eq 'Internal' || $config{TC_ENABLED} eq 'Shared' ) { if ( $config{TC_ENABLED} eq 'Internal' || $config{TC_ENABLED} eq 'Shared' ) {
$originalmark =~ s/0x//g;
fatal_error "Unknown Class ($originalmark)}" unless ( $device = $classids{$originalmark} ); fatal_error "Unknown Class ($originalmark)}" unless ( $device = $classids{$originalmark} );
} }
@ -762,7 +763,6 @@ sub validate_tc_class( ) {
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]+)$/ ) { if ( $device =~ /^(\d+|0x[\da-fA-F]+)$/ ) {
$device =~ s/^0x//;
( $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 {