Fix MARK bug in tcclasses

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8495 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2008-05-12 16:47:57 +00:00
parent e6d8eabbc1
commit 62b90cfa91
3 changed files with 14 additions and 8 deletions

View File

@ -1,5 +1,6 @@
Changes in 4.1.9
Changes in 4.2.0-Beta1
1) Fix handling of firewall marks.
Changes in 4.1.8

View File

@ -77,7 +77,10 @@ Migration Issues.
Problems Corrected in Shorewall 4.2.0 Beta 1
None.
1) Previously, Shorewall was generating an incorrect tc filter when
MARK values were used in /etc/shorewall/tcclasses (the filter
matched when the mark value was equal to the minor class ID rather
than the contents of the MARK column).
Other Changes in Shoreall 4.2.0 Beta 1.

View File

@ -476,7 +476,7 @@ sub validate_tc_class( $$$$$$ ) {
$tcclasses{$device} = {} unless $tcclasses{$device};
my $tcref = $tcclasses{$device};
my $markval;
my $markval = 0;
if ( $mark ne '-' ) {
if ( $devref->{classify} ) {
@ -497,7 +497,8 @@ sub validate_tc_class( $$$$$$ ) {
$tcref->{$classnumber} = { tos => [] ,
rate => convert_rate( $full, $rate, 'RATE' ) ,
ceiling => convert_rate( $full, $ceil, 'CEIL' ) ,
priority => $prio eq '-' ? 1 : $prio
priority => $prio eq '-' ? 1 : $prio ,
mark => $markval
};
$tcref = $tcref->{$classnumber};
@ -769,11 +770,12 @@ sub setup_traffic_shaping() {
my $lastdevice = '';
for my $class ( @tcclasses ) {
my ( $device, $mark ) = split /:/, $class;
my ( $device, $classnum ) = split /:/, $class;
my $devref = $tcdevices{$device};
my $tcref = $tcclasses{$device}{$mark};
my $tcref = $tcclasses{$device}{$classnum};
my $mark = $tcref->{mark};
my $devicenumber = $devref->{number};
my $classid = join( '', $devicenumber, ':', $mark);
my $classid = join( '', $devicenumber, ':', $classnum);
my $rate = "$tcref->{rate}kbit";
my $quantum = calculate_quantum $rate, calculate_r2q( $devref->{out_bandwidth} );
my $dev = chain_base $device;
@ -793,7 +795,7 @@ sub setup_traffic_shaping() {
emit ( "[ \$${dev}_mtu -gt $quantum ] && quantum=\$${dev}_mtu || quantum=$quantum",
"run_tc class add dev $device parent $devref->{number}:1 classid $classid htb rate $rate ceil $tcref->{ceiling}kbit prio $tcref->{priority} \$${dev}_mtu1 quantum \$quantum",
"run_tc qdisc add dev $device parent $classid handle ${mark}: sfq perturb 10"
"run_tc qdisc add dev $device parent $classid handle ${classnum}: sfq perturb 10"
);
#
# add filters