From aae37d50be386cf9746c4be51a250aa91f6d9a00 Mon Sep 17 00:00:00 2001 From: Quentin De Coninck Date: Thu, 28 Nov 2019 17:03:05 +0100 Subject: [PATCH] is police in bit? --- src/mpLinkCharacteristics.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mpLinkCharacteristics.py b/src/mpLinkCharacteristics.py index bf1f14a..642bed7 100644 --- a/src/mpLinkCharacteristics.py +++ b/src/mpLinkCharacteristics.py @@ -55,7 +55,7 @@ class MpLinkCharacteristics: cmd = "" for n in self.netemAt: cmd = cmd + "sleep {}".format(n.delta) - cmd = cmd + " && tc qdisc add dev {} root handle 5:0 tbf rate {}mbit burst 15000 limit {} &&".format(ifname, self.bandwidth, self.bufferSize()) + cmd = cmd + " && tc qdisc add dev {} root handle 5:0 tbf rate {}mbit burst 15000 limit {} &&".format(ifname, self.bandwidth, int(self.bufferSize())) cmd = cmd + " true &" return cmd @@ -65,7 +65,7 @@ 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 {} root handle 10: netem {} delay {}ms limit {} &&".format(ifname, n.cmd, self.delay, 2 * self.bufferSize() // 1500) + cmd = cmd + " && tc qdisc add dev {} root handle 10: netem {} delay {}ms limit {} &&".format(ifname, n.cmd, self.delay, int(2 * self.bufferSize() // 1500)) cmd = cmd + " true &" return cmd @@ -76,7 +76,7 @@ class MpLinkCharacteristics: cmd = cmd + "sleep {}".format(n.delta) cmd = cmd + " && tc qdisc del dev {} ingress".format(ifname) 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, self.bufferSize()) + cmd = cmd + " && tc filter add dev {} parent ffff: u32 match u32 0 0 police rate {}mbit burst {} drop && ".format(ifname, self.bandwidth, int(self.bufferSize() * 8)) cmd = cmd + " true &" return cmd