From 62b90cfa91cfe01bf7b29b8c9192391b98dc9250 Mon Sep 17 00:00:00 2001 From: teastep Date: Mon, 12 May 2008 16:47:57 +0000 Subject: [PATCH] Fix MARK bug in tcclasses git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8495 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-common/changelog.txt | 3 ++- Shorewall-common/releasenotes.txt | 5 ++++- Shorewall-perl/Shorewall/Tc.pm | 14 ++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Shorewall-common/changelog.txt b/Shorewall-common/changelog.txt index a0d57e106..7bf9f0598 100644 --- a/Shorewall-common/changelog.txt +++ b/Shorewall-common/changelog.txt @@ -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 diff --git a/Shorewall-common/releasenotes.txt b/Shorewall-common/releasenotes.txt index f51420988..10f12e249 100644 --- a/Shorewall-common/releasenotes.txt +++ b/Shorewall-common/releasenotes.txt @@ -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. diff --git a/Shorewall-perl/Shorewall/Tc.pm b/Shorewall-perl/Shorewall/Tc.pm index a07b7fd59..546aff5f8 100644 --- a/Shorewall-perl/Shorewall/Tc.pm +++ b/Shorewall-perl/Shorewall/Tc.pm @@ -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