From 1d2580eb53a94f758e88c09b74a7e554d8b010a3 Mon Sep 17 00:00:00 2001 From: Quentin De Coninck Date: Wed, 27 Nov 2019 13:29:45 +0100 Subject: [PATCH] use policing instead of shaping --- src/mpLinkCharacteristics.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mpLinkCharacteristics.py b/src/mpLinkCharacteristics.py index 06ec0ed..6a372ce 100644 --- a/src/mpLinkCharacteristics.py +++ b/src/mpLinkCharacteristics.py @@ -53,12 +53,13 @@ class MpLinkCharacteristics: for n in self.netemAt: cmd = cmd + "sleep " + str(n.delta) cmd = cmd + " && tc qdisc del dev " + ifname + " root " - cmd = cmd + " && tc qdisc add dev " + ifname + " root handle 1:0 tbf rate " + self.bandwidth - cmd = cmd + "mbit burst " + str(int(self.queueSize) * 1500) + " latency " + self.queuingDelay - cmd = cmd + "ms && " - cmd = cmd + " tc qdisc add dev " + ifname + " " - cmd = cmd + " parent 1:0 handle 10: " - cmd = cmd + " netem " + n.cmd + " delay " + self.delay + "ms && " + cmd = cmd + " && tc qdisc add dev {} root handle 5:0 htb default 1".format(ifname) + cmd = cmd + " && tc class add dev {} parent 5:0 class 5:1 htb rate {}Mbit burst {}".format(ifname, self.bandwidth, int(self.queueSize) * 1500) + cmd = cmd + " && tc qdisc add dev {} handle ffff: ingress".format(ifname) + cmd = cmd + " && tc filter add dev {} parent ffff: u32 match u32 0 0 police rate {}mbit burst {} drop".format(ifname, self.bandwidth, int(self.queueSize) * 1500) + + cmd = cmd + " && tc qdisc add dev {} parent 5:1 handle 10: netem {} delay {}ms limit 1000000 &&".format(ifname, n.cmd, self.delay) + cmd = cmd + " true &" return cmd