From: Alexandre Derumier Date: Tue, 5 Mar 2013 09:23:44 +0000 (+0100) Subject: setup_tc_rate_limit : delete class and filter before update X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=957753df143fc5212f1754927c2368d79b01fd61 setup_tc_rate_limit : delete class and filter before update also return after remove if rate is not defined Signed-off-by: Alexandre Derumier --- diff --git a/data/PVE/Network.pm b/data/PVE/Network.pm index 4efd30b..4cc5fb8 100644 --- a/data/PVE/Network.pm +++ b/data/PVE/Network.pm @@ -11,9 +11,13 @@ use File::Basename; sub setup_tc_rate_limit { my ($iface, $rate, $burst, $debug) = @_; + system("/sbin/tc class del dev $iface parent 1: classid 1:1 >/dev/null 2>&1"); + system("/sbin/tc filter del dev $iface parent ffff: protocol ip prio 50 estimator 1sec 8sec >/dev/null 2>&1"); system("/sbin/tc qdisc del dev $iface ingress >/dev/null 2>&1"); system("/sbin/tc qdisc del dev $iface root >/dev/null 2>&1"); + return if (!$rate || ($rate && $rate == 0)); + run_command("/sbin/tc qdisc add dev $iface handle ffff: ingress"); # this does not work wit virtio - don't know why (setting "mtu 64kb" does not help)