Add 'TC_ENABLED=Shared' support

This commit is contained in:
Tom Eastep 2010-11-14 07:52:51 -08:00
parent 5bae689fe1
commit 2d8785d574
2 changed files with 164 additions and 161 deletions

View File

@ -3217,6 +3217,8 @@ sub get_configuration( $ ) {
$globals{TC_SCRIPT} = $file;
} elsif ( $val eq 'internal' ) {
$config{TC_ENABLED} = 'Internal';
} elsif ( $val eq 'shared' ) {
$config{TC_ENABLED} = 'Shared';
} elsif ( $val eq 'simple' ) {
$config{TC_ENABLED} = 'Simple';
} else {

View File

@ -254,7 +254,7 @@ sub process_tc_rule( ) {
} else {
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' ) {
if ( $config{TC_ENABLED} eq 'Internal' || $config{TC_ENABLED} eq 'Shared' ) {
fatal_error "Unknown Class ($originalmark)}" unless ( $device = $classids{$originalmark} );
}
@ -424,7 +424,7 @@ sub process_tc_rule( ) {
#
# expand_rule() returns destination device if any
#
fatal_error "Class Id $originalmark is not associated with device $result" if $config{TC_ENABLED} eq 'Internal' && $device ne $result;
fatal_error "Class Id $originalmark is not associated with device $result" if $device ne $result &&( $config{TC_ENABLED} eq 'Internal' || $config{TC_ENABLED} eq 'Shared' );
}
progress_message " TC Rule \"$currentline\" $done";
@ -1331,6 +1331,7 @@ sub setup_traffic_shaping() {
validate_tc_class while read_a_line;
}
unless ( $config{TC_ENABLED} eq 'Shared' ) {
for my $device ( @tcdevices ) {
my $devref = $tcdevices{$device};
my $defmark = in_hexp ( $devref->{default} || 0 );
@ -1504,7 +1505,7 @@ sub setup_traffic_shaping() {
}
process_tcfilters;
}
}
#
@ -1615,7 +1616,7 @@ sub setup_tc() {
if ( $globals{TC_SCRIPT} ) {
save_progress_message q('Setting up Traffic Control...');
append_file $globals{TC_SCRIPT};
} elsif ( $config{TC_ENABLED} eq 'Internal' ) {
} elsif ( $config{TC_ENABLED} eq 'Internal' || $config{TC_ENABLED} eq 'Shared' ) {
setup_traffic_shaping;
} elsif ( $config{TC_ENABLED} eq 'Simple' ) {
setup_simple_traffic_shaping;