I have a need to automatically collect information about data traffic per connection. On a full-up linux installation, the kernel collects this information and I can obtain it by any of a number of different means. "ss -i" is actually pretty much perfect for my needs.
My reading of the openwrt docs suggests a number of choices, but what I see seems to be per-interface, or perhaps per-user, but not per-connection. There is one choice that uses luci that might do it, but I am not using luci. I would prefer to avoid adding any database to the system.
Also, ss -i in openwrt does not return any bytes/packets passed information.
My searching around in /sys and /proc on my openwrt target system does not turn up any useful information on traffic.
I am deploying a product based on openwrt that uses a controller built entirely in C, so I am quite willing to do whatever is necessary to get the information I need. I presently am thinking about taking an approach similar to that of iftop. In fact, I am thinking of modifying iftop as being the quickest route to reaching my goal; I would need to daemonize it, remove the console display, strip the data that would be displayed in the console to just what I need, aggregate it appropriately, and pipe the result to where I need it to go when told to do so.
Is there an easier way? Some solution already built that I have not found?