magnific0 / wondershaper

Command-line utility for limiting an adapter's bandwidth
GNU General Public License v2.0
1.73k stars 264 forks source link

Cannot change limit without clear the limit #20

Open vincentcheng62 opened 6 years ago

vincentcheng62 commented 6 years ago

When I try to set the upload bandwidth the 2nd time, it doesn't work, i.e.

$ sudo wondershaper -a enp0s25 -u 400 $ sudo wondershaper -a enp0s25 -u 600 RTNETLINK answers: File exists RTNETLINK answers: File exists RTNETLINK answers: File exists RTNETLINK answers: File exists

What I can do is to clear the limit everytime when I want to change the limit, i.e. $ sudo wondershaper -a enp0s25 -u 400 $ sudo wondershaper -a enp0s25 -c $ sudo wondershaper -a enp0s25 -u 600

Is it a bug? Or this behavious is expected?

magnific0 commented 6 years ago

My observation has always been that the rules are overwritten. So this could be new behavior. It is best to clear the rules anyway. I will think about making wondershaper "smarter" in that it clears rules (if exist) before setting new ones.

lesinigo commented 6 years ago

Same behavior as reported by @vincentcheng62 on Ubuntu 16.04 LTS with HWE kernel (currently 4.13.0-43)

magnific0 commented 6 years ago

Thanks, good to know. It's added to the list of features to clear the rules before new ones.

sigmaSd commented 6 years ago

Hi, just wondering can't you just add a

wondershaper -a $IFACE -c 

before each usage or that would be too ugly ?

magnific0 commented 6 years ago

The problem is that currently the clearing is too aggressive. Ideally you want to clear only the rules that for the specific task. So clear only outgoing rules before applying new outgoing rules, leaving incoming and who knows what other rules users have custom added intact.

Autoclearing all rules on an interface could break other programs and rules that people have set. Using -c still effectively does that now, but at least it's only manually invoked.

I'll try to have a look at it soon.

sigmaSd commented 6 years ago

Got it thanks for the explanation.

davidjmemmett commented 3 years ago

Sorry to necropost, but this is still an issue. The -c option doesn't do anything as far as I can tell. Once wondershaper -a ... -d ... -u ... has been run once, it is not possible to change the values in use or clear them without (at least) rebooting the machine.

ghostface commented 3 years ago

@davidjmemmett just tried it with 1.4.1 from arch aur and clearing with -c worked fine for me to update the limits with a 2. called after