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

Wifi hotspot name (ssid) awareness #128

Open
artumi-richard opened this issue Apr 18, 2019 · 5 comments
Open

Wifi hotspot name (ssid) awareness #128

artumi-richard opened this issue Apr 18, 2019 · 5 comments

Comments

@artumi-richard
Copy link

Hi

Thanks for your work on vnstat. I'm using it to determine the correct level of internet provision I should buy and it would be helpful if I had a breakdown of my wifi interface by the network it was connected to, ideally using the wifi hotspot name. Since I don't know how much of the data going through the wifi interface is going through my phone's hot spot, and how much is going through my home internet, and how much is going through my work's internet, it's hard for me to make a good decision about changing what access I need.

Thanks again.

@vergoh
Copy link
Owner

vergoh commented Apr 18, 2019

That's an interesting idea and it might even be possible to implement with the new database model. Quickly thinking, this would at least require adding support for some sort of pseudo interfaces that get stored in the database but aren't directly tracked and making vnStat able to detect which interfaces are wireless and getting somehow the essid information. That could then allow storing the traffic information twice, once for the interface itself and a second time for the pseudo interface named something like _.

I suspect getting the essid information is likely to differ between Linux and BSD requiring therefore different implementations for each. Which distribution do you have in use?

@vergoh vergoh changed the title Feature Request: Wifi hotspot name (ssid) awareness Wifi hotspot name (ssid) awareness Apr 18, 2019
@artumi-richard
Copy link
Author

I'm using Linux (Ubuntu LTS).

@vergoh
Copy link
Owner

vergoh commented May 30, 2019

Short update:

It looks like there's no /proc or /sys interface available for getting the ssid string. /proc/net/wireless is the closest and is available if the kernel has wireless interface support included. While that interface provides details about the link status and quality, it lacks th ssid string for some reason. The remaining options appear to be either using libiw or ioctl call for SIOCGIWESSID.

Another matter that came to mind is that the ssid can contain all sorts of characters and most likely also some non-ASCII ones. Trying to type something like vnstat -d -i "wlan0_鱼汤" might not be that practical depending on the used keyboard so some other way of accessing the ssid created pseudo interfaces would be needed.

@artumi-richard
Copy link
Author

Update appreciated. iwgetid --raw (system command - part of wireless-tools) will produce the ssid string. It's source code is here https://github.com/HewlettPackard/wireless-tools/blob/master/wireless_tools/iwgetid.c if you want to pull out the bit you need to avoid a dependency.

@vergoh
Copy link
Owner

vergoh commented May 30, 2019

That example directly adds a dependency to libiw (and its development package) and that's something I'd prefer to avoid. https://gist.github.com/lf-/90912626f24246540e52 does pretty much what I need after few minor modifications. Haven't yet searched what the equivalent for BSD is.

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

No branches or pull requests

2 participants