diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-03-07 13:06:02 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-03-07 13:06:02 -0800 |
commit | fd9ffb944c35ea269bc1be337221dd0438b5f0be (patch) | |
tree | 32018ddbef20d5421f05877f74beeec4fde6d92b /scripts | |
parent | 3422a4ab9ca22d5f43efae457fc2c5f0a1478e98 (diff) | |
download | vyatta-cfg-qos-fd9ffb944c35ea269bc1be337221dd0438b5f0be.tar.gz vyatta-cfg-qos-fd9ffb944c35ea269bc1be337221dd0438b5f0be.zip |
fix filtering rules when using set-dscp
The generated filtering rules were using wrong id's when
set-dscp was being used. Need to put dsmark rules on root,
and htb rules on start of that tree, and the id needs to
be printed in hex not decimal.
Bugfix: 2947
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/VyattaQosMatch.pm | 2 | ||||
-rw-r--r-- | scripts/VyattaQosTrafficShaper.pm | 29 |
2 files changed, 23 insertions, 8 deletions
diff --git a/scripts/VyattaQosMatch.pm b/scripts/VyattaQosMatch.pm index 437dd50..cf54fb0 100644 --- a/scripts/VyattaQosMatch.pm +++ b/scripts/VyattaQosMatch.pm @@ -51,7 +51,7 @@ sub filter { return; } - print {$out} "filter add dev $dev parent $parent:0 prio 1"; + printf {$out} "filter add dev $dev parent %x:0 prio 1", $parent; if (defined $ip) { print {$out} " protocol ip u32"; print {$out} " match ip dsfield $$ip{dsfield} 0xff" diff --git a/scripts/VyattaQosTrafficShaper.pm b/scripts/VyattaQosTrafficShaper.pm index cedebb9..201cd8d 100644 --- a/scripts/VyattaQosTrafficShaper.pm +++ b/scripts/VyattaQosTrafficShaper.pm @@ -48,7 +48,8 @@ $self->{_limit} = $config->returnValue("queue-limit"); $self->{_qdisc} = $config->returnValue("queue-type"); - $self->{dsmark} = VyattaQosUtil::getDsfield($config->returnValue("set-dscp")); + $self->{dsmark} = + VyattaQosUtil::getDsfield($config->returnValue("set-dscp")); foreach my $match ($config->listNodes("match")) { $config->setLevel("$level match $match"); @@ -57,6 +58,12 @@ $self->{_match} = \@matches; } + sub matchRules { + my ($self) = @_; + my $matches = $self->{_match}; + return @$matches; + } + sub _getPercentRate { my ($rate, $speed) = @_; @@ -187,11 +194,6 @@ } else { die "Unknown queue type $self->{_qdisc}\n"; } - - my $matches = $self->{_match}; - foreach my $match (@$matches) { - $match->filter( $out, $dev, $parent, $self->{id} ); - } } sub dsmarkClass { @@ -199,6 +201,7 @@ printf ${out} "class change dev %s classid %x:%x dsmark", $dev, $parent, $self->{id}; + if ($self->{dsmark}) { print ${out} " mask 0 value $self->{dsmark}\n"; } else { @@ -342,8 +345,15 @@ sub commands { . " indices $indices default_index $default->{id}\n"; foreach my $class (@$classes) { - $class->dsmarkClass($out, "1", $dev); + $class->dsmarkClass($out, 1, $dev); + + if ($class->{dsmark}) { + foreach my $match ($class->matchRules()) { + $match->filter($out, $dev, 1, $class->{id}); + } + } } + $parent = $indices + 1; $root = "parent 1:1" } @@ -355,6 +365,11 @@ sub commands { foreach my $class (@$classes) { $class->htbClass($out, $dev, $parent, $rate); + + foreach my $match ($class->matchRules()) { + $match->filter($out, $dev, $parent, $class->{id}); + } + } } |