summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-15 10:52:25 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-15 10:52:25 -0700
commit4ce140e2d2376b647f5dc65de0316bd331167a41 (patch)
tree0ec101ae08202113937332b08d249ffc09349aa7
parent40f69942a08a0551e2d7e9997ef022201d08fe36 (diff)
downloadvyatta-cfg-qos-4ce140e2d2376b647f5dc65de0316bd331167a41.tar.gz
vyatta-cfg-qos-4ce140e2d2376b647f5dc65de0316bd331167a41.zip
Address issues in traffic-shaper match
Fix bug when matching only ether protocol field (Bug 4539) Fix IPV6 match (Bug 4548)
-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};