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 support for multiple network interface stats #119

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

aacero
Copy link

@aacero aacero commented Apr 15, 2021

Some of my machines have multiple default interfaces and this caused the net-traffic script to not work. This pull request adds support for multiple interfaces and is backward compatible with the original script.

@kgilmer
Copy link
Member

kgilmer commented May 23, 2021

Hi @aacero thanks for your contribution! The code looks very clean. I ran it locally and didn't find any issues, although I don't have multiple active network interfaces.

It is common in this part of Regolith (status indicators) that a seemingly benign change causes regressions for users with various configurations we didn't consider. Unfortunately due to the nature of i3blocks these errors can result in big problems like spamming syslog or consuming 100% of a cpu core. Unrelated to your PR, but generally I have low confidence that any indicator shell script changes won't result in some regressions for some users.

Given this I propose that in the short term we rename this such that the existing script and your updates are available independently for users. Those wishing for network status for multiple interfaces would install another package, say i3xrocks-net-traffic-multi-nic or something. It would follow that rather than modification to net-traffic this would be a new script, net-traffic-multi-nic (or whatever is the better name).

@aacero
Copy link
Author

aacero commented Jun 14, 2021

@kgilmer -- renaming sounds good to me

@kgilmer
Copy link
Member

kgilmer commented Jun 15, 2021

Great, can you update the PR such that your changes are in new file as described? Then I'll merge and add a i3xrocks config script and package it for testing.

@kgilmer
Copy link
Member

kgilmer commented Jul 4, 2021

If you rebase from master the test regression should disappear @aacero

@aacero
Copy link
Author

aacero commented Jul 4, 2021 via email


IF_PATH="/sys/class/net/${IF}"
# Original behavior: use the following to include only routable intefaces:
declare -a IFACES="${BLOCK_INSTANCE:-$(ip route show default | awk '!/(ppp|tun|tap)/ { print $5 }')}"

Choose a reason for hiding this comment

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

I hope this PR is picked up again. I also think the awk pattern here should be something like (ppp|tun|tap|vpn0) to ignore vpn connections, but that may be subject to debate.

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.

3 participants