-
Notifications
You must be signed in to change notification settings - Fork 675
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
net/vnstat: Handle multiple interfaces better #4443
base: master
Are you sure you want to change the base?
Changes from 5 commits
4995dcb
c8697dc
2903e63
0d849ef
b59f9b0
81b8215
ced7a58
371b95d
c217fbb
aac8ec4
5f53d28
17978c9
790583a
f733359
2bd5355
dead6b0
b49ae5c
027ec79
1b75246
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,11 @@ | |
</enabled> | ||
<interface type="InterfaceField"> | ||
<Required>N</Required> | ||
<multiple>Y</multiple> | ||
<multiple>N</multiple> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Allegedly this worked in the past with multiple interfaces given as a single interface, but only up to a limit of 16/32 characters which may be the reason it doesn’t work for you. This is an upstream issue. Breaking this here for people who use it ok is not an option, however. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. My interface string was just igb0+ue0 (possibly reversed) so well within that limit. I'll dig into exactly how vnstat handles that config option later hopefully. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, yes, pretty sure this used to work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, some of this may have been caused by me trying to fix it before understanding that the missing However what I was hoping for (and what my change does) is to show stats for different interfaces separately. Getting a combined total for WAN+LTE isn't useful for my use case. Would a PR which just adds There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that sounds like a plan 😊 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll get right on it. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've updated the PR. I've removed the |
||
</interface> | ||
<interface_display type="InterfaceField"> | ||
<Required>N</Required> | ||
<multiple>Y</multiple> | ||
</interface_display> | ||
</items> | ||
</model> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
type="$1" | ||
interface="$2" | ||
|
||
if [ -z "$interface" ]; then | ||
# Interface not specified, use default interface for backward compatibility | ||
interface=`awk '/^Interface/ { print $2 }' < /usr/local/etc/vnstat.conf` | ||
fi | ||
|
||
vnstat -$type $interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this is only correct for IPv4 or the easy interface cases. Ping me on Monday for how to gather complete stats across split IPv4/6 interface assignments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fichtner so, about this, what's a better way to do it? I checked the logic for how the
vnstat.conf
is generated and it seems to use similar logic to this, but using a macrowhere the macro is doing:
.. which is largely the same as I'm doing, I think? If my logic in this PR is wrong, is this config logic also wrong? (I find it odd that the config logic falls back to the input value for unknown interfaces, rather than just ignoring them? Or is that needed for.. reasons?)