From c2b36d99a7715e13df75d83cc63ce92cac0981dc Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 14 Feb 2008 14:00:20 -0800 Subject: if error occurs in qos processing display commands If the command to tc doesn't work, then reprint to standard out for diagnostic. Also, fix use of sudo in delete of qdisc. --- scripts/vyatta-qos.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-qos.pl b/scripts/vyatta-qos.pl index 2aef09c..5996e92 100755 --- a/scripts/vyatta-qos.pl +++ b/scripts/vyatta-qos.pl @@ -65,8 +65,7 @@ sub delete_interface { if ($direction eq "out" ) { # delete old qdisc - will give error if no policy in place - system("tc qdisc del dev $interface root 2>/dev/null"); - system("tc filter del dev $interface 2>/dev/null"); + qx(sudo tc qdisc del dev "$interface" root 2>/dev/null); } } @@ -98,7 +97,12 @@ sub update_interface { $policy->commands($out, $interface); if (! close $out && ! defined $debug) { delete_interface($interface, $direction); - die "Tc commands failed\n"; + + # replay commands to stdout + open $out, '>-'; + $policy->commands($out, $interface); + close $out; + die "Conversion of configuration to tc command error\n"; } exit 0; } -- cgit v1.2.3