mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-08 08:44:05 +01:00
Complete prior commit.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
202d5f800e
commit
71480f38e2
@ -1007,12 +1007,22 @@ sub setup_traffic_shaping() {
|
|||||||
my $lastdevice = '';
|
my $lastdevice = '';
|
||||||
|
|
||||||
for my $class ( @tcclasses ) {
|
for my $class ( @tcclasses ) {
|
||||||
my ( $device, $classnum ) = split /:/, $class;
|
#
|
||||||
|
# The class number in the tcclasses array is expressed in decimal.
|
||||||
|
#
|
||||||
|
my ( $device, $decimalclassnum ) = split /:/, $class;
|
||||||
|
#
|
||||||
|
# For inclusion in 'tc' commands, we also need the hex representation
|
||||||
|
#
|
||||||
|
my $classnum = in_hexp $decimalclassnum;
|
||||||
my $devref = $tcdevices{$device};
|
my $devref = $tcdevices{$device};
|
||||||
my $tcref = $tcclasses{$device}{$classnum};
|
#
|
||||||
|
# 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 $mark = $tcref->{mark};
|
my $mark = $tcref->{mark};
|
||||||
my $devicenumber = $devref->{number};
|
my $devicenumber = in_hexp $devref->{number};
|
||||||
my $classid = join( ':', in_hexp $devicenumber, in_hexp $classnum);
|
my $classid = join( ':', in_hexp $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} );
|
||||||
my $dev = chain_base $device;
|
my $dev = chain_base $device;
|
||||||
@ -1021,10 +1031,6 @@ sub setup_traffic_shaping() {
|
|||||||
|
|
||||||
$classids{$classid}=$device;
|
$classids{$classid}=$device;
|
||||||
|
|
||||||
$classnum = in_hexp $classnum;
|
|
||||||
|
|
||||||
$classid = join( ':', in_hexp $devicenumber, $classnum );
|
|
||||||
|
|
||||||
if ( $lastdevice ne $device ) {
|
if ( $lastdevice ne $device ) {
|
||||||
if ( $lastdevice ) {
|
if ( $lastdevice ) {
|
||||||
pop_indent;
|
pop_indent;
|
||||||
@ -1046,14 +1052,6 @@ sub setup_traffic_shaping() {
|
|||||||
unless ( $devref->{classify} ) {
|
unless ( $devref->{classify} ) {
|
||||||
if ( $tcref->{occurs} == 1 ) {
|
if ( $tcref->{occurs} == 1 ) {
|
||||||
emit "run_tc filter add dev $device protocol ip parent $devicenumber:0 prio " . ( $priority | 20 ) . " handle $mark fw classid $classid";
|
emit "run_tc filter add dev $device protocol ip parent $devicenumber:0 prio " . ( $priority | 20 ) . " handle $mark fw classid $classid";
|
||||||
} elsif ( $tcref->{occurs} ) {
|
|
||||||
emit( qq(if ! qt \$TC filter add dev $device parent $devicenumber:0 prio 65535 protocol ip fw; then) ,
|
|
||||||
qq( if ! \$TC filter list dev $device | grep -q 65535; then) ,
|
|
||||||
qq( error_message "ERROR: Command '\$TC add dev $device parent $devicenumber:0 prio 65535 protocol ip fw' failed"),
|
|
||||||
qq( stop_firewall),
|
|
||||||
qq( exit 1),
|
|
||||||
qq( fi),
|
|
||||||
qq(fi) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user