PATCH: Accounting Gigawords

Gunter Burchardt gbur
Sun Jul 18 10:59:44 PDT 2004


On 2004-07-17 - 21:17:35, Jouni Malinen wrote:
> Date: Sat, 17 Jul 2004 21:17:35 -0700
> From: Jouni Malinen <jkmaline at cc.hut.fi>
> To: hostap at shmoo.com
> Mail-Followup-To: hostap at shmoo.com
> Subject: Re: PATCH: Accounting Gigawords
> 
> On Mon, Jul 12, 2004 at 11:13:35AM +0200, Gunter Burchardt wrote:
> 
> > I wrote a patch for accounting. At the moment only traffic up to 4 GB
> > for each direction can be accounted. After 4 GB the counters roll over!
> > This patch defines the rx/tx_bytes per sta as unsigned long long. If a
> > counter roll over Acct-Input-Gigawords and/of Acct-Output-Gigawords will
> > be set in the accounting packet (RFC 2869).
> 
> Thanks, applied. I cleaned up the updated versions of the patch a bit
> and added support for 64-bit hosts (though, I did not test this) and
> updates when interim accounting is disabled.

While testing I found a 2 GB limit (not 4GB). We have to change atoi()
to strtolul(). atoi is signed. all values greater than 2^31 results in
2^31. 

diff -Nur hostap-0.2.3.old/hostapd/driver.c
hostap-0.2.3/hostapd/driver.c
--- hostap-0.2.3.old/hostapd/driver.c   2004-06-22 09:13:56.000000000
+0200
+++ hostap-0.2.3/hostapd/driver.c   2004-07-16 11:06:34.000000000 +0200
@@ -323,7 +323,8 @@
        if (!pos)
            continue;
        *pos++ = '\0';
-       val = atoi(pos);
+       //val = atoi(pos);
+       val = strtoul(pos, NULL, 10);
        if (strcmp(line, "rx_packets") == 0)
            data->rx_packets = val;
        else if (strcmp(line, "tx_packets") == 0)




More information about the Hostap mailing list