summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-19 15:43:03 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-19 15:43:03 -0700
commitf0e2cf5e11c04be0c6d2739be60802edf0924f45 (patch)
tree792b40dfc5a7f0c673efa55bc4560c0a04b981ab
parentc4caa9a79f3e35db0a318a2e428ea41b1945d56a (diff)
downloadvyatta-cfg-qos-f0e2cf5e11c04be0c6d2739be60802edf0924f45.tar.gz
vyatta-cfg-qos-f0e2cf5e11c04be0c6d2739be60802edf0924f45.zip
Fix network emulator when no rate defined
It is okay to use netem without any rate setting.
-rw-r--r--lib/Vyatta/Qos/NetworkEmulator.pm17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Vyatta/Qos/NetworkEmulator.pm b/lib/Vyatta/Qos/NetworkEmulator.pm
index 1458dd4..4232ff2 100644
--- a/lib/Vyatta/Qos/NetworkEmulator.pm
+++ b/lib/Vyatta/Qos/NetworkEmulator.pm
@@ -39,13 +39,15 @@ sub new {
my $class = ref($that) || $that;
my $self = {%fields};
- $self->{_rate} = getRate( $config->returnValue("bandwidth") );
+ my $bw = $config->returnValue("bandwidth");
+ $self->{_rate} = getRate( $bw ) if ($bw);
+
$self->{_burst} = $config->returnValue("burst");
- $self->{_limit} = $config->returnValue("queue-limit");
- $self->{_delay} = getTime($config->returnValue("network-delay"));
- $self->{_drop} = $config->returnValue("packet-loss");
- $self->{_corrupt} = $config->returnValue("packet-corruption");
- $self->{_reorder} = $config->returnValue("packet-reordering");
+ $self->{_limit} = $config->returnValue("queue-limit");
+ $self->{_delay} = getTime($config->returnValue("network-delay"));
+ $self->{_drop} = $config->returnValue("packet-loss");
+ $self->{_corrupt} = $config->returnValue("packet-corruption");
+ $self->{_reorder} = $config->returnValue("packet-reordering");
return bless $self, $class;
@@ -62,8 +64,7 @@ sub commands {
printf "qdisc add dev %s root handle 1:0 tbf rate %s burst %s\n",
$dev, $rate, $burst;
printf "qdisc add dev %s parent 1:1 handle 10: netem";
- }
- else {
+ } else {
printf "qdisc add dev %s root netem";
}