counters overflow
Hello linux-ppp,
The problem is that counters for 'bytes in' and 'bytes out' are 32 bit integers, which is enough for counting data while connected via modem, but really small while using pppoe or pptpd-based solutions deployed over 100/1000mbit network.
Signature · 2 lines
Best regards, Dmitry mailto:[email protected]
hi
i've encountered the same problem working the code while writing a plugin. i managed to get around it by taking a copy of the counters every few minutes and noting when they loop around to zero (i.e. when old_value > new_value). its a bit of a hack, but it seems to work for my purposes.
david ananian-cooper
Quoted 6 lines · Dmitry Vereschaka
Hello linux-ppp,
The problem is that counters for 'bytes in' and 'bytes out' are 32 bit
integers, which is enough for counting data while connected via modem, but really small while using pppoe or pptpd-based solutions deployed over 100/1000mbit network.
Quoted 12 lines · David Ananian-Cooper
hi
i've encountered the same problem working the code while writing a plugin. i managed to get around it by taking a copy of the counters every few minutes and noting when they loop around to zero (i.e. when
old_value>new_value). its a bit of a hack, but it seems to work for my purposes.Quoted 5 lines
The problem is that counters for 'bytes in' and 'bytes out' are 32 bit
integers, which is enough for counting data while connected via modem, but really small while using pppoe or pptpd-based solutions deployed over 100/1000mbit network.
You have the source code. Make the counters longs instead. Does not seem a terribly difficult hack.
Quoted 2 lines · Bill Unruh
You have the source code. Make the counters longs instead. Does not seem a terribly difficult hack.
They would need to be long long, and the problem (from my point of view, at least) is that that changes the user/kernel ABI, which causes all sorts of compatibility problems.
I think I will make pppd maintain the upper 32 bits of a count in userspace, by having it wake up periodically and poll the 32-bit counters from the kernel and see if they have wrapped.
Paul.
Quoted 3 lines · Paul Mackerras
I think I will make pppd maintain the upper 32 bits of a count in userspace, by having it wake up periodically and poll the 32-bit counters from the kernel and see if they have wrapped.
Yuck. How often would you need to poll?
We solved the problem on Solaris by having the kernel implement both a PPPIO_GETSTAT ioctl and a new PPPIO_GETSTAT64 ioctl. The former still returns 32 bit counters to applications that want them. The latter uses 64 bit counters. In the user space, we call PPPIO_GETSTAT64 first, and if that fails, fall back to PPPIO_GETSTAT.
I'd expect that the same sort of thing would work fine on Linux as well.
Signature · 1 line
James Carlson <[email protected]>