diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-06-10 16:26:53 -0700 |
---|---|---|
committer | Stephen Hemminger <shemminger@lenny.localdomain> | 2009-10-01 13:51:19 -0700 |
commit | a4746e015e64aeca8b64b59abd0558ec339323e9 (patch) | |
tree | aa41c3bf5de294e8520a31127ca9a8e62b121917 | |
parent | 4e41f747e53ebdba0e6f835ec701fa9ee6bb2ead (diff) | |
download | vyatta-cfg-qos-a4746e015e64aeca8b64b59abd0558ec339323e9.tar.gz vyatta-cfg-qos-a4746e015e64aeca8b64b59abd0558ec339323e9.zip |
Fix netem bandwidth (TBF) setup
Need limit or latency value
Bug 4533
(cherry picked from commit 61a756a5003bda12380c300dbc963adfcc09d888)
-rw-r--r-- | lib/Vyatta/Qos/NetworkEmulator.pm | 19 |
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); |