Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bandwidth shaping support #232

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

neutronth
Copy link
Contributor

Features:

  • Per client bandwidth shaping with default setting.
  • Per client bandwidth shaping with per client setting get from
    authen server.
  • Gateway speed limit. (gateway bandwidth shaping)

Notes:
OpenWRT requires these packages,
* tc
* kmod-ifb
* kmod-sched (sch_htb, sch_codel)
* kmod-sched-core (act_mirred)

Features:
  * Per client bandwidth shaping with default setting.
  * Per client bandwidth shaping with per client setting get from
    authen server.
  * Gateway speed limit. (gateway bandwidth shaping)

Notes:
  OpenWRT requires these packages,
    * tc
    * kmod-ifb
    * kmod-sched (sch_htb, sch_codel)
    * kmod-sched-core (act_mirred)
@mhaas
Copy link
Contributor

mhaas commented Oct 7, 2015

I looked over this rather quickly before bed and I have to say: this is really good.

Just a question: is it possible to have a restriction of the total bandwidth without limiting individual clients? From the config description, I guess it is possible.

@neutronth
Copy link
Contributor Author

Yes, it is possible. Sorry that it's not clearly mentioned in the config description.
You could apply the total bandwidth limit without limiting individual clients by this settings

== 8< ==
BandwidthShaping yes
BandwidthShapingGatewaySpeedLimit yes
BandwidthGatewayMaxDown 102400
BandwidthGatewayMaxUp 102400
BandwidthDefaultClientMaxDown 0 <= set it to 0 for no limit (no bandwidth shaping apply)
BandwidthDefaultClientMaxUp 0 <= set it to 0 for no limit
== 8< ==

or drop the "BandwidthDefaultClientMax{Down,Up}" from the config file as it's default value is 0

@KazukiShimada
Copy link

nice feature!
This patch includes #206?

@mhaas
Copy link
Contributor

mhaas commented Oct 17, 2015

I want to merge this. I hope to test this next weekend when I'll have some more time.

/** Set gateway interface txqueuelen */
rc = bw_shaping_do_command(BW_PROG_IFCONFIG, "%s txqueuelen %" PRIu32,
config->gw_interface, config->bw_shaping_gw_interface_txqueuelen);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't you need to check the return code here?

@mhaas
Copy link
Contributor

mhaas commented Oct 25, 2015

I have added some comments to the code. It's really good even including my minor nitpicks.

From an OpenWrt packager's perspective: since traffic shaping is available by default (albeit not necessarily configured), an OpenWrt should probably include dependencies on tc and related kernel modules. That's probably quite a big dependency for an embedded system.

I see two possible solutions here:

  • Add a --enable-traffic-shaping configure option and provide an additional package (wifidog-shaping) for those who need the feature
  • Add run-time checks for the presence of the tc binary and tell the user he needs to install additional packages. Then the OpenWrt packager wouldn't need to create yet another Wifidog sub-package.

@imnobodyet
Copy link

nice work! compiled and worked fine for client speed limiting, but with few issues:

  1. "wdctl restart" will reset the bw parameters to 0 for each client, additional settings during the clients transferring would fix this.
  2. The BandwidthShapingGatewaySpeedLimit seems not working, i.e
    a. gatewaymaxdown=1024 and clientmaxdown=2048 and the client get 2048kbps.
    b. gatewaymaxdown=1524 and clientmaxdown=1024 and 2 clients can both get 1024kbps.
    and gatewaymaxdown/up cannot be 0. But I was not using standard LAN-WAN interfaces, I used eth0 as WAN and eth0.5 as LAN (also the gatewayinterface in wifidog) , I'll try two physical interfaces next time

@qianguozheng
Copy link

So, what's current status ? who will do the suggestions ?

@mhaas
Copy link
Contributor

mhaas commented Feb 4, 2016

@qianguozheng I was hoping for @neutronth to tackle the improvements and bug fixes. It will be several weeks at least before I can commit any time :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants