summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-10 16:26:53 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-10 16:26:53 -0700
commit61a756a5003bda12380c300dbc963adfcc09d888 (patch)
treed5a4bcd8bda53b7d0c647a8bea7fbc4003bd3758
parent112dc478bcc9e193ffd71a25a6c5b527f33a37da (diff)
downloadvyatta-cfg-qos-61a756a5003bda12380c300dbc963adfcc09d888.tar.gz
vyatta-cfg-qos-61a756a5003bda12380c300dbc963adfcc09d888.zip
Fix netem bandwidth (TBF) setup
Need limit or latency value Bug 4533
-rw-r--r--lib/Vyatta/Qos/NetworkEmulator.pm19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/Vyatta/Qos/NetworkEmulator.pm b/lib/Vyatta/Qos/NetworkEmulator.pm
index 2a87407..d7a3404 100644
--- a/lib/Vyatta/Qos/NetworkEmulator.pm
+++ b/lib/Vyatta/Qos/NetworkEmulator.pm
@@ -46,23 +46,28 @@ sub new {
sub commands {
my ( $self, $dev ) = @_;
my $rate = $self->{_rate};
+ my $limit = $self->{_limit};
+ my $delay = $self->{_delay};
if ($rate) {
my $burst = $self->{_burst};
$burst or $burst = "15K";
- printf "qdisc add dev %s root handle 1:0 tbf rate %s burst %s\n",
+ printf "qdisc add dev %s root handle 1:0 tbf rate %s burst %s",
$dev, $rate, $burst;
- printf "qdisc add dev %s parent 1:1 handle 10: netem", $dev;
+ if ($limit) {
+ print " limit $limit";
+ } elsif ($delay) {
+ print " latency $delay";
+ } else {
+ print " latency 50ms";
+ }
+ printf "\nqdisc add dev %s parent 1:1 handle 10: netem", $dev;
} else {
printf "qdisc add dev %s root netem", $dev;
}
-
- my $delay = $self->{_delay};
- print " delay $delay" if ($delay);
-
- my $limit = $self->{_limit};
print " limit $limit" if ($limit);
+ print " delay $delay" if ($delay);
my $drop = $self->{_drop};
print " drop $drop" if ($drop);