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

network: bandwidth speed is wrong, shows as sum over all interfaces #610

Closed
maximbaz opened this issue Mar 2, 2020 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@maximbaz
Copy link
Contributor

maximbaz commented Mar 2, 2020

Currently placeholders like {bandwidthDownBits} show the sum across all interfaces, this is a problem if you use a VPN and so all your traffic goes through tunnel interface and then a wireless interface, the numbers shown by waybar are doubled comparing to real internet speed.

I would like to ask that all these placeholders show information about the currently shown interface name.

I tried to enforce the interface name via config "interface": "wlan0" but this doesn't affect these placeholders.

@Alexays Alexays added the bug Something isn't working label Mar 2, 2020
@captainju
Copy link

Relevant code is in src/modules/network.cpp
It currently uses /proc/net/netstat which gives only global bandwidth speed.
It should use /proc/net/dev for having info per interface.

I'll try to look into it if I can (I'm not familiar with C++).

@Iss-in
Copy link

Iss-in commented Feb 28, 2021

yeah, It's even adding the speed of localhost ( playing local videos on browser using jellyfin )

@b10n
Copy link

b10n commented May 24, 2021

Not sure if it's related but for me the reported speed is too low (~6% with VPN, ~3% without).
I'm using Waybar v0.9.7-35-g94a882b on Linux 5.12.3-arch1-1.

@ciarand
Copy link
Contributor

ciarand commented Aug 24, 2021

I spent some time trying to make the changes to read from /proc/net/dev, but I'm not super comfortable with c++ and struggled to incorporate these changes into the project as it is.

In case it's helpful for the next person that tries to tackle this, here's a standalone program that prints the total bandwidth used for the specified interface https://gist.github.com/ciarand/568e6e8d99aa2f1ba0d489ecba9b0d68

Feel free to steal/copy this code if it's helpful (or ignore it if it's not)

ciarand added a commit to ciarand/Waybar that referenced this issue Aug 25, 2021
This fixes issue Alexays#610 by reading bandwidth usage per-interface from
/proc/net/dev instead of globally via /proc/net/netstat. It supports the
same matching logic as elsewhere, so setting interface to '*' should
display the same sum-total bandwidth usage as the previous
implementation.
ciarand added a commit to ciarand/Waybar that referenced this issue Aug 25, 2021
This fixes issue Alexays#610 by reading bandwidth usage per-interface from
/proc/net/dev instead of globally via /proc/net/netstat. It supports the
same matching logic as elsewhere, so setting interface to '*' should
display the same sum-total bandwidth usage as the previous
implementation.
@ciarand
Copy link
Contributor

ciarand commented Aug 25, 2021

Sent out #1230 that attempts to fix this

@captainju
Copy link

Looks fixed to me, thanks @ciarand !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants