forked from extern/shorewall_code
Fix 'Shared' traffic shaping
This commit is contained in:
parent
997a697a65
commit
0e5dc41d31
@ -1331,16 +1331,17 @@ sub setup_traffic_shaping() {
|
|||||||
validate_tc_class while read_a_line;
|
validate_tc_class while read_a_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
unless ( $config{TC_ENABLED} eq 'Shared' ) {
|
for my $device ( @tcdevices ) {
|
||||||
for my $device ( @tcdevices ) {
|
my $devref = $tcdevices{$device};
|
||||||
my $devref = $tcdevices{$device};
|
my $defmark = in_hexp ( $devref->{default} || 0 );
|
||||||
my $defmark = in_hexp ( $devref->{default} || 0 );
|
my $devnum = in_hexp $devref->{number};
|
||||||
my $devnum = in_hexp $devref->{number};
|
my $r2q = int calculate_r2q $devref->{out_bandwidth};
|
||||||
my $r2q = int calculate_r2q $devref->{out_bandwidth};
|
|
||||||
|
|
||||||
$device = physical_name $device;
|
$device = physical_name $device;
|
||||||
|
|
||||||
my $dev = chain_base( $device );
|
my $dev = chain_base( $device );
|
||||||
|
|
||||||
|
unless ( $config{TC_ENABLED} eq 'Shared' ) {
|
||||||
|
|
||||||
emit "if interface_is_up $device; then";
|
emit "if interface_is_up $device; then";
|
||||||
|
|
||||||
@ -1417,36 +1418,38 @@ sub setup_traffic_shaping() {
|
|||||||
pop_indent;
|
pop_indent;
|
||||||
emit "fi\n";
|
emit "fi\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $lastdevice = '';
|
my $lastdevice = '';
|
||||||
|
|
||||||
for my $class ( @tcclasses ) {
|
for my $class ( @tcclasses ) {
|
||||||
#
|
#
|
||||||
# The class number in the tcclasses array is expressed in decimal.
|
# The class number in the tcclasses array is expressed in decimal.
|
||||||
#
|
#
|
||||||
my ( $device, $decimalclassnum ) = split /:/, $class;
|
my ( $device, $decimalclassnum ) = split /:/, $class;
|
||||||
#
|
#
|
||||||
# For inclusion in 'tc' commands, we also need the hex representation
|
# For inclusion in 'tc' commands, we also need the hex representation
|
||||||
#
|
#
|
||||||
my $classnum = in_hexp $decimalclassnum;
|
my $classnum = in_hexp $decimalclassnum;
|
||||||
my $devref = $tcdevices{$device};
|
my $devref = $tcdevices{$device};
|
||||||
#
|
#
|
||||||
# The decimal value of the class number is also used as the key for the hash at $tcclasses{$device}
|
# The decimal value of the class number is also used as the key for the hash at $tcclasses{$device}
|
||||||
#
|
#
|
||||||
my $tcref = $tcclasses{$device}{$decimalclassnum};
|
my $tcref = $tcclasses{$device}{$decimalclassnum};
|
||||||
my $mark = $tcref->{mark};
|
my $mark = $tcref->{mark};
|
||||||
my $devicenumber = in_hexp $devref->{number};
|
my $devicenumber = in_hexp $devref->{number};
|
||||||
my $classid = join( ':', $devicenumber, $classnum);
|
my $classid = join( ':', $devicenumber, $classnum);
|
||||||
my $rate = "$tcref->{rate}kbit";
|
my $rate = "$tcref->{rate}kbit";
|
||||||
my $quantum = calculate_quantum $rate, calculate_r2q( $devref->{out_bandwidth} );
|
my $quantum = calculate_quantum $rate, calculate_r2q( $devref->{out_bandwidth} );
|
||||||
|
|
||||||
$classids{$classid}=$device;
|
$classids{$classid}=$device;
|
||||||
$device = physical_name $device;
|
$device = physical_name $device;
|
||||||
|
|
||||||
my $dev = chain_base $device;
|
my $dev = chain_base $device;
|
||||||
my $priority = $tcref->{priority} << 8;
|
my $priority = $tcref->{priority} << 8;
|
||||||
my $parent = in_hexp $tcref->{parent};
|
my $parent = in_hexp $tcref->{parent};
|
||||||
|
|
||||||
|
unless ( $config{TC_ENABLED} eq 'Shared' ) {
|
||||||
if ( $lastdevice ne $device ) {
|
if ( $lastdevice ne $device ) {
|
||||||
if ( $lastdevice ) {
|
if ( $lastdevice ) {
|
||||||
pop_indent;
|
pop_indent;
|
||||||
@ -1497,15 +1500,15 @@ sub setup_traffic_shaping() {
|
|||||||
|
|
||||||
save_progress_message_short qq(" TC Class $classid defined.");
|
save_progress_message_short qq(" TC Class $classid defined.");
|
||||||
emit '';
|
emit '';
|
||||||
}
|
|
||||||
|
|
||||||
if ( $lastdevice ) {
|
if ( $lastdevice ) {
|
||||||
pop_indent;
|
pop_indent;
|
||||||
emit "fi\n";
|
emit "fi\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process_tcfilters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process_tcfilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user