diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-06-06 15:12:12 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-06-06 15:12:12 -0700 |
commit | b90702a4ce498172f7cfec2b45c875c959cc5081 (patch) | |
tree | 8e89d082f93a00e610fc2f74f13ff5d6fe7d7912 | |
parent | 1c372300391087c05637ca4591d48a5f347d88f7 (diff) | |
download | vyatta-cfg-qos-b90702a4ce498172f7cfec2b45c875c959cc5081.tar.gz vyatta-cfg-qos-b90702a4ce498172f7cfec2b45c875c959cc5081.zip |
Fix mixing of set-dscp and dscp match
Use tcindex to get original dsfield value.
Fixes bug: 3033
-rw-r--r-- | scripts/VyattaQosMatch.pm | 16 | ||||
-rw-r--r-- | scripts/VyattaQosTrafficShaper.pm | 13 |
2 files changed, 18 insertions, 11 deletions
diff --git a/scripts/VyattaQosMatch.pm b/scripts/VyattaQosMatch.pm index 44ece49..0fedda2 100644 --- a/scripts/VyattaQosMatch.pm +++ b/scripts/VyattaQosMatch.pm @@ -56,7 +56,7 @@ sub _define { } sub filter { - my ( $self, $out, $dev, $parent, $id ) = @_; + my ( $self, $out, $dev, $parent, $id, $dsmark ) = @_; my $ip = $self->{_ip}; my $indev = $self->{_dev}; my $vif = $self->{_vif}; @@ -66,7 +66,17 @@ sub filter { return; } - printf {$out} "filter add dev $dev parent %x:0 prio 1", $parent; + # Special case for when dsmarking is used with ds matching + # original dscp is saved in tc_index + if (defined $dsmark && defined $ip && defined $$ip{dsfield}) { + printf {$out} "filter add dev %s parent %x:0 protocol ip prio 1", + $dev, $parent; + printf ${out} " handle %d tcindex classid %x:%x\n", + $$ip{dsfield}, $parent, $id; + return; + } + + printf {$out} "filter add dev %s parent %x:0 prio 1", $dev, $parent; if (defined $ip) { print {$out} " protocol ip u32"; print {$out} " match ip dsfield $$ip{dsfield} 0xff" @@ -88,5 +98,5 @@ sub filter { print {$out} " match meta\(vlan mask 0xfff eq $vif\)" if (defined $vif); } - printf {$out} " classid $parent:%x\n", $id; + printf {$out} " classid %x:%x\n", $parent, $id; } diff --git a/scripts/VyattaQosTrafficShaper.pm b/scripts/VyattaQosTrafficShaper.pm index 02bfd31..8e7c1e3 100644 --- a/scripts/VyattaQosTrafficShaper.pm +++ b/scripts/VyattaQosTrafficShaper.pm @@ -350,15 +350,12 @@ sub commands { } print {$out} "qdisc add dev $dev handle 1:0 root dsmark" - . " indices $indices default_index $default->{id}\n"; + . " indices $indices default_index $default->{id} set_tc_index\n"; foreach my $class (@$classes) { $class->dsmarkClass($out, 1, $dev); - - if ($class->{dsmark}) { - foreach my $match ($class->matchRules()) { - $match->filter($out, $dev, 1, $class->{id}); - } + foreach my $match ($class->matchRules()) { + $match->filter($out, $dev, 1, $class->{id}); } } @@ -375,8 +372,8 @@ sub commands { $class->htbClass($out, $dev, $parent, $rate); foreach my $match ($class->matchRules()) { - $match->filter($out, $dev, 1, $class->{id}); - } + $match->filter($out, $dev, $parent, $class->{id}, $class->{dsmark}); + } } } |