Re: Is accounting supported?
- From: Marcel Holtmann <marcel holtmann org>
- To: Daniel Wagner <wagi monom org>
- Cc: networkmanager-list gnome org
- Subject: Re: Is accounting supported?
- Date: Sun, 17 Jan 2010 12:52:28 -0800
> >> Just out of curiosity: where does the accounting information come from?
> >> I see one possible solution using netfilter with ULOG target and the
> >> ulogd daemon.
> >> I guess when using ulogd there is always a certain lag between the
> >> number of bytes transferred/received and the user defined maximum of
> >> bytes transferred/received (probably enforced by PolicyKit). I don't
> >> think that's a real problem and could be workaround if there isn't the
> >> need to have exact numbers.
> > At least for PPP we can get traffic counts via ioctls. I'd like to get
> > traffic counts for the other devices like ifconfig does, but last I knew
> > ifconfig got that by scraping /proc/net/dev which is just ugly. We may
> > be able to get updated traffic counts from netlink somehow?
> I tried to figure out how a generic solution would look like and the
> solution I found was the thing with the ULOG trick. The kernel interface
> to netfilter is netlink based and the ulogd daemon uses this API. Though
> I'm not so sure if the authors recommand to use this API. IRC the
> iptables API should not be used directly.
I looked into that a few weeks ago and you get netlink messages with the
statistics details for all network interfaces. You get them even when
you unplug the adapter suddenly via the DELLINK netlink message.
However you don't get periodic updates. It might be useful to extend the
kernel with an option to send NEWLINK updates when certain amount of
packets/bytes have been received or transmitted.
The tricky part here is obvious the case that if you have no consumer of
these information you don't want any updates. Meaning if no UI component
is showing these information, then don't even bother to make the kernel
send out updates.
] [Thread Prev