From da8a3fdc4e5cc526bb28f6959944f3635c23a6ed Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Jun 2009 15:33:30 -0700 Subject: Fix IPV6 traffic-class match This resolves issues with mulitple filters (can't have same priority), and IPV6 traffic-class/dscp match rules Bug 4552 --- lib/Vyatta/Qos/Match.pm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm index 682996f..033aee1 100644 --- a/lib/Vyatta/Qos/Match.pm +++ b/lib/Vyatta/Qos/Match.pm @@ -75,11 +75,13 @@ sub filter { my $ip = $self->{$ipver}; next unless $ip && $$ip{dsfield}; - printf "filter add dev %s parent %x: protocol %s prio 1", + printf "filter add dev %s parent %x: protocol %s prio $prio", $dev, $parent, $ipver; printf " handle %s tcindex classid %x:%x\n", $$ip{dsfield}, $parent, $classid; - } + + $prio += 1; + } return; } @@ -88,7 +90,10 @@ sub filter { next unless $p; printf "filter add dev %s parent %x:", $dev, $parent; - printf " prio %d", $prio if ($prio); + if ($prio) { + printf " prio %d", $prio; + $prio += 1; + } if ($proto eq 'ether') { my $type = $$p{protocol}; @@ -106,8 +111,14 @@ sub filter { print " protocol $proto u32"; # workaround inconsistent usage in tc u32 match - my $sel = ($proto eq 'ipv6') ? 'ip6' : $proto; - print " match $sel dsfield $$p{dsfield} 0xff" if $$p{dsfield}; + my $sel = $proto; + if ($proto eq 'ipv6') { + $sel = 'ip6'; + printf " match u16 0x%x 0x0ff0 at 0", hex($$p{dsfield}) << 4, + if $$p{dsfield}; + } else { + 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}; -- cgit v1.2.3