is police in bit?

This commit is contained in:
Quentin De Coninck 2019-11-28 17:03:05 +01:00
parent b70103d29f
commit aae37d50be

View File

@ -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