diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index b0e005f17..b4ea4b5c6 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -814,7 +814,6 @@ sub numeric_value1 ( $ ) { sub hex_value( $ ) { my $val = lc $_[0]; - $val =~ s/^0x//; return undef unless $val =~ /^[a-fA-F0-9]+$/; no warnings; oct '0x' . $val; @@ -825,9 +824,8 @@ sub hex_value( $ ) { # Strip off leading 0x and superfluous leading zeros from a hex number # sub normalize_hex( $ ) { - my $val = shift; + my $val = lc shift; - $val =~ s/^0x//; $val =~ s/^0// while $val =~ /^0/ && length $val > 1; $val; } diff --git a/Shorewall/Perl/Shorewall/Tc.pm b/Shorewall/Perl/Shorewall/Tc.pm index fc0de67a2..7d4645dd3 100644 --- a/Shorewall/Perl/Shorewall/Tc.pm +++ b/Shorewall/Perl/Shorewall/Tc.pm @@ -252,7 +252,7 @@ sub process_tc_rule( ) { require_capability ('CONNMARK' , "CONNMARK Rules", '' ) if $connmark; } 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' ) { $originalmark = join( ':', normalize_hex( $mark ), normalize_hex( $designator ) ); @@ -562,7 +562,7 @@ sub process_simple_device() { 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 { 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; 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 ); ( $device , $devref) = dev_by_number( $number ); } else {