summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-15 10:52:25 -0700
committerStephen Hemminger <shemminger@lenny.localdomain>2009-10-01 13:51:20 -0700
commit016dd00049e8c2bae87831c04a450f68a3278898 (patch)
tree2da761f8a42a6958372d1c511ecccbb7b902a3ae
parentc5e332cdf5b734357efef9e385ad5099538a0bd0 (diff)
downloadvyatta-cfg-qos-016dd00049e8c2bae87831c04a450f68a3278898.tar.gz
vyatta-cfg-qos-016dd00049e8c2bae87831c04a450f68a3278898.zip
Address issues in traffic-shaper match
Fix bug when matching only ether protocol field (Bug 4539) Fix IPV6 match (Bug 4548) (cherry picked from commit 4ce140e2d2376b647f5dc65de0316bd331167a41)
-rw-r--r--lib/Vyatta/Qos/Match.pm35
1 files changed, 21 insertions, 14 deletions
diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm
index dbcd3f1..7b81043 100644
--- a/lib/Vyatta/Qos/Match.pm
+++ b/lib/Vyatta/Qos/Match.pm
@@ -89,24 +89,31 @@ sub filter {
printf "filter add dev %s parent %x:", $dev, $parent;
printf " prio %d", $prio if ($prio);
- if ($proto ne 'ether') {
- print " protocol $proto u32";
- print " match $proto dsfield $$p{dsfield} 0xff" if $$p{dsfield};
- print " match $proto protocol $$p{protocol} 0xff" if $$p{protocol};
- } else {
+ if ($proto eq 'ether') {
my $type = $$p{protocol};
$type = 'all' unless $type;
- print " protocol $type u32";
- }
-
- # workaround inconsistent usage in tc u32 match
- $proto = 'ip6' if ($proto eq 'ipv6');
+ if (defined($$p{src}) || defined($$p{dest})) {
+ print " protocol $type u32";
+ print " match ether src $$p{src}" if $$p{src};
+ print " match ether dst $$p{dst}" if $$p{dst};
+ } else {
+ # u32 requires some options to work but basic works
+ print " protocol $type basic";
+ }
+ } else {
+ print " protocol $proto u32";
- print " match $proto src $$p{src}" if $$p{src};
- print " match $proto sport $$p{sport} 0xffff" if $$p{sport};
- print " match $proto dst $$p{dst}" if $$p{dst};
- print " match $proto dport $$p{dport} 0xffff" if $$p{dport};
+ # workaround inconsistent usage in tc u32 match
+ my $sel = ($proto eq 'ipv6') ? 'ip6' : $proto;
+ print " match $sel dsfield $$p{dsfield} 0xff" if $$p{dsfield};
+ print " match $sel protocol $$p{protocol} 0xff" if $$p{protocol};
+
+ print " match $sel src $$p{src}" if $$p{src};
+ print " match $sel sport $$p{sport} 0xffff" if $$p{sport};
+ print " match $sel dst $$p{dst}" if $$p{dst};
+ print " match $sel dport $$p{dport} 0xffff" if $$p{dport};
+ }
}
my $indev = $self->{indev};