Re: Is accounting supported?

Hi Daniel,

> >> 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.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]