summaryrefslogtreecommitdiff
path: root/scripts/vyatta-qos.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/vyatta-qos.pl')
-rwxr-xr-xscripts/vyatta-qos.pl13
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl
index 86a0c62..9526793 100755
--- a/scripts/vyatta-qos.pl
+++ b/scripts/vyatta-qos.pl
@@ -3,18 +3,17 @@
use lib "/opt/vyatta/share/perl5/";
use VyattaConfig;
use VyattaQosPolicy;
+use strict;
use Getopt::Long;
my $qosNode = 'qos-policy';
-
+my $debug = $ENV{'QOS_DEBUG'};
my @update = ();
my @delete = ();
-my $debug = $ENV{"DEBUG"};
my $list = undef;
GetOptions(
- "debug" => \$debug,
"list" => \$list,
"update=s{3}" => \@update,
"delete=s{2}" => \@delete,
@@ -67,10 +66,12 @@ sub update_interface {
defined $policy or die "undefined policy";
# When doing debugging just echo the commands
+ my $out;
if (defined $debug) {
- open (my $out, ">&STDOUT");
+ open $out, '>-'
+ or die "can't open stdout: $!";
} else {
- open( my $out, "|sudo tc -batch -" )
+ open $out, "|-" or exec qw/sudo tc -batch -/
or die "Tc setup failed: $!\n";
}
@@ -94,7 +95,7 @@ if ( $#delete == 1 ) {
}
if ( $#update == 2 ) {
- update_interface(@update);
+ update_interface(@update, $debug);
exit 0;
}