Gluon: Traffic shaping using simple-tc does not work for downloads

Created on 31 Jul 2019  路  1Comment  路  Source: freifunk-gluon/gluon

Bug report

What is the problem?
A user in our community reported that taffic-shaping using the gluon-buildin simple-tc does not work for download-speed (but only for uplad speed). The community-member is using a WR941ND.

We were able to reproduce this on our desk using a newly flashed TL WR 841 v10:
The configuration was set using luci during the setup wizard. After reboot the config was:

root@freifunk60e327cf26e0-chrissi-test:~# uci show simple-tc
simple-tc.example=interface
simple-tc.example.enabled='0'
simple-tc.example.ifname='eth0'
simple-tc.example.limit_egress='1000'
simple-tc.example.limit_ingress='5000'
simple-tc.mesh_vpn=interface
simple-tc.mesh_vpn.enabled='1'
simple-tc.mesh_vpn.ifname='mesh-vpn'
simple-tc.mesh_vpn.limit_egress='500'
simple-tc.mesh_vpn.limit_ingress='500'

We tested the speed using iperf3 in both directions (but not at the same time). Results were:
Download: 10 Mbits/s, Upload: 500 Kbits/s

We removed the limits using:
root@freifunk60e327cf26e0-chrissi-test:~# simple-tc mesh-vpn - -
and the upload limit was removed as expected.

But: We were not able to set the download-limit using simple-tc:

root@freifunk60e327cf26e0-chrissi-test:~# simple-tc mesh-vpn - 500
root@freifunk60e327cf26e0-chrissi-test:~# simple-tc mesh-vpn 500 -
uradvd: error: netlink: No such file or directory

(Ignore the uradvd-name there. Jan Luebbe has already fixed that: https://github.com/freifunk-gluon/packages/commit/17e253563241eecd6e474c4ffd78adcd28744337 )

This restored the limits as they have been initially.

We dug into the gluon config and found out that the KERNEL_NET_ACT_POLICE is only marked as module for our kernel but the module is not installed onto our target. simple-tc depends (https://github.com/freifunk-gluon/packages/blob/master/net/simple-tc/files/etc/modules.d/30-simple-tc ) on that module but fails to load it.

We figure this happens because the package simple-tc has no dependency on this.

To prove our theory we added this dependency to the gluon core as follows:

$ git diff
diff --git a/package/gluon-core/Config.in b/package/gluon-core/Config.in
index caf4f4c6..1da7f294 100644
--- a/package/gluon-core/Config.in
+++ b/package/gluon-core/Config.in
@@ -50,6 +50,10 @@ config KERNEL_NET_CLS_ACT
        bool
        select KERNEL_NET_CLS

+config KERNEL_NET_ACT_POLICE
+       bool
+       select KERNEL_NET_CLS_ACT
+
 config KERNEL_NET_CLS_BASIC
        bool
        select KERNEL_NET_CLS
@@ -343,3 +347,4 @@ config GLUON_SPECIALIZE_KERNEL
        select KERNEL_IP_NF_NAT
        select KERNEL_IP_NF_TARGET_MASQUERADE
        select KERNEL_IP_NF_TARGET_REDIRECT
+       select KERNEL_NET_ACT_POLICE

Using this _hack_ traffic shaping works as a charm. After the config wizard our config was:

root@freifunk60e327cf26e0-chrissi-test2:~# uci show simple-tc
simple-tc.example=interface
simple-tc.example.enabled='0'
simple-tc.example.ifname='eth0'
simple-tc.example.limit_egress='1000'
simple-tc.example.limit_ingress='5000'
simple-tc.mesh_vpn=interface
simple-tc.mesh_vpn.enabled='1'
simple-tc.mesh_vpn.ifname='mesh-vpn'
simple-tc.mesh_vpn.limit_egress='500'
simple-tc.mesh_vpn.limit_ingress='500'

Speed was: Download: 500 Kbits/s, Upload: 500 Kbits/s

root@freifunk60e327cf26e0-chrissi-test2:~# simple-tc mesh-vpn - - removed the limit as expected.

The following commands now also work work without error messages:

root@freifunk60e327cf26e0-chrissi-test2:~# simple-tc mesh-vpn - - 
root@freifunk60e327cf26e0-chrissi-test2:~# simple-tc mesh-vpn 50 50
root@freifunk60e327cf26e0-chrissi-test2:~# simple-tc mesh-vpn 100 100

We would be happy to provide a fix for this. But we are currently not sure where we need to add this dependency. We see the following options:

  • gluon-core/Config.in as shown above. This is probably not a good place.
  • `gluon-mesh-vpn-core/Makefile' could be an option when it is also need by other packages.
  • Or the dependency could be added to the simple-tc -package.

Gluon Version:
We are using mostly a vanialla Gluon + some changes:
https://gitli.stratum0.org/ffbs/ffbs-gluon/commits/v2018.2.2-ffbs

Site Configuration:
https://gitli.stratum0.org/ffbs/ffbs-site
This is mostly fastd + gluon

bug blocker

Most helpful comment

I have created a Pull Request here: https://github.com/freifunk-gluon/gluon/pull/1793

>All comments

I have created a Pull Request here: https://github.com/freifunk-gluon/gluon/pull/1793

Was this page helpful?
0 / 5 - 0 ratings