summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-07-12 11:04:51 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-07-12 11:04:51 -0700
commitf86af4191fddf13848b1fa6e2a8bd5b48f0b8f75 (patch)
treea57b6ebe4a5fa025c9f01b521416571e1a73db00
parent57f0c381bd45f78828396dbfc5dd2c96bb31e7d8 (diff)
parent738affa4b8f5adf66c7451f50698fd76651d1f88 (diff)
downloadvyatta-cfg-qos-f86af4191fddf13848b1fa6e2a8bd5b48f0b8f75.tar.gz
vyatta-cfg-qos-f86af4191fddf13848b1fa6e2a8bd5b48f0b8f75.zip
Merge branch 'larkspur' of vm:git/vyatta-cfg-qos into larkspur
-rw-r--r--lib/Vyatta/Qos/Match.pm40
-rw-r--r--templates/traffic-policy/limiter/node.tag/class/node.tag/match/node.tag/mark/node.def2
2 files changed, 17 insertions, 25 deletions
diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm
index 839ef43..48e92c3 100644
--- a/lib/Vyatta/Qos/Match.pm
+++ b/lib/Vyatta/Qos/Match.pm
@@ -24,17 +24,13 @@ sub new {
my ( $that, $config ) = @_;
my $self = {};
my $class = ref($that) || $that;
- my %filter;
+ my $ptype;
bless $self, $class;
foreach my $proto (qw(ip ipv6 ether)) {
next unless $config->exists($proto);
- foreach my $t (qw(vif dev)) {
- die "can not match on $proto and $t\n" if $config->exists($t);
- }
-
my %fields;
if ( $proto eq 'ether' ) {
@@ -55,11 +51,10 @@ sub new {
$self->{$proto} = \%fields;
- my $other = $filter{'protocol'};
+ my $other = $ptype;
die "Can not match on both $proto and $other protocol in same match\n"
if $other;
-
- $filter{'protocol'} = $proto;
+ $ptype = $other;
}
my $vif = $config->returnValue("vif");
@@ -67,17 +62,18 @@ sub new {
my $iif = $config->returnValue("interface");
$self->{_indev} = getIfIndex($iif);
- $filter{'interface'} = 1 if defined($vif) | defined($iif);
my $fwmark = $config->returnValue("mark");
$self->{_fwmark} = $fwmark;
- $filter{'mark'} = 1 if $fwmark;
- # Firewall mark, packet contents, and meta data use different
- # tc filters
- my @filters = (keys %filter);
- die "Can not combine match on both ", join(' and ',@filters), "\n"
- if $#filters > 0;
+ if ($ptype) {
+ die "Can not combine protocol and firewall mark match\n"
+ if ($fwmark);
+ die "Can not combine protocol and vlan tag match\n"
+ if ($vif);
+ die "Can not combine protocol and interface match\n"
+ if ($iif);
+ }
return $self;
}
@@ -148,14 +144,6 @@ sub filter {
}
my $fwmark = $self->{_fwmark};
- if ( $fwmark ) {
- printf "filter add dev %s parent %x: prio %d", $dev, $parent, $prio;
- printf " protocol all handle %d fw", $fwmark;
- print " $police" if $police;
- printf " flowid %x:%x\n", $parent, $classid;
- return;
- }
-
my $indev = $self->{_indev};
my $vif = $self->{_vif};
if ( defined($vif) || defined($indev) ) {
@@ -163,9 +151,15 @@ sub filter {
print " protocol all basic";
print " match meta\(rt_iif eq $indev\)" if $indev;
print " match meta\(vlan mask 0xfff eq $vif\)" if $vif;
+ print " match meta\(fw_mark eq $fwmark\)" if $fwmark;
print " $police" if $police;
printf " flowid %x:%x\n", $parent, $classid;
+ } elsif ( $fwmark ) {
+ printf "filter add dev %s parent %x: prio %d", $dev, $parent, $prio;
+ printf " protocol all handle %d fw", $fwmark;
+ print " $police" if $police;
+ printf " flowid %x:%x\n", $parent, $classid;
}
}
diff --git a/templates/traffic-policy/limiter/node.tag/class/node.tag/match/node.tag/mark/node.def b/templates/traffic-policy/limiter/node.tag/class/node.tag/match/node.tag/mark/node.def
deleted file mode 100644
index a3a805e..0000000
--- a/templates/traffic-policy/limiter/node.tag/class/node.tag/match/node.tag/mark/node.def
+++ /dev/null
@@ -1,2 +0,0 @@
-type: u32
-help: Match on mark applied by firewall