diff options
-rw-r--r-- | lib/Vyatta/Qos/TrafficLimiter.pm | 13 | ||||
-rwxr-xr-x | scripts/vyatta-qos.pl | 9 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/Vyatta/Qos/TrafficLimiter.pm b/lib/Vyatta/Qos/TrafficLimiter.pm index e5731d0..ff4a8d2 100644 --- a/lib/Vyatta/Qos/TrafficLimiter.pm +++ b/lib/Vyatta/Qos/TrafficLimiter.pm @@ -76,11 +76,18 @@ sub _define { } sub commands { - my ( $self, $dev ) = @_; + my ( $self, $dev, $direction ) = @_; my $classes = $self->{_classes}; - my $parent = 0xffff; + my $parent; + + if ($direction eq 'in') { + $parent = 0xffff; + printf "qdisc add dev %s handle %x: ingress\n", $dev, $parent; + } else { + $parent = 1; + printf "qdisc add dev %s handle $x: prio\n", $dev, $parent; + } - printf "qdisc add dev %s handle %x: ingress\n", $dev, $parent; foreach my $class (@$classes) { foreach my $match ( $class->matchRules() ) { my $police = " police rate " . $class->{rate} diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index 487fdc6..c962324 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -35,8 +35,11 @@ my %policies = ( 'round-robin' => 'RoundRobin', 'priority-queue' => 'Priority', 'random-detect' => 'RandomDetect', + 'traffic-limiter' => 'TrafficLimiter', }, - 'in' => { 'traffic-limiter' => 'TrafficLimiter', } + 'in' => { + 'traffic-limiter' => 'TrafficLimiter', + } ); # find policy for name - also check for duplicates @@ -119,7 +122,7 @@ sub delete_interface { my $arg = $delcmd{$direction}; die "bad direction $direction\n" unless $arg; - + my $cmd = "sudo tc qdisc del dev $interface ". $arg . " 2>/dev/null"; # ignore errors (may have no qdisc) @@ -207,7 +210,7 @@ sub interfaces_using { # these are arguments to update_interface() push @inuse, [ $name, $direction, $policy ] - if ($cur eq $policy); + if ($cur eq $policy); } } return @inuse; |