HostAP, accounting Stop, and input/output octets
Jouni Malinen
j at w1.fi
Fri Dec 18 11:47:02 PST 2015
On Fri, Dec 18, 2015 at 11:50:48AM -0500, Alan DeKok wrote:
> I've had a report that HostAP doesn't send Acct-Input-Octets / Acct-Output-Octets in Accounting-Request packets with Acct-Status-Type = Stop.
>
> Some spelunking through the code leads me to believe that this is likely. src/ap/accounting.c has:
>
> static void accounting_sta_report(struct hostapd_data *hapd,
> struct sta_info *sta, int stop)
> ...
>
> if (accounting_sta_update_stats(hapd, sta, &data) == 0) {
> ... add octet counters
>
> }
>
> The accounting_sta_update_stats() function returns -1 if hostapd_drv_read_sta_data() fails.
>
> What would be better is if it sent the last stats even if that function failed. Patch is attached. 90% of the change is indentation.
This change is practically only ignoring that
accounting_sta_update_stats() return value and then sending out whatever
is in the data variable which would be uninitialized stack data in case
accounting_sta_update_stats() fails due to the driver interface not
supporting the operation at all or all zeros if the driver interface
supports the operation but it fails for some reason.. As such, this
cannot really be correct.
hostapd does not currently track the previously received statistics for
any other purpose than to update Acct-{Input,Output}-Gigawords. All the
attributes added here in accounting_sta_report() are the raw values from
the driver apart from those gigawords.
I don't see much point in sending out the attributes unless there is
some useful information in them. I guess I would be fine with make
hostapd remember the last values and use them and only include the
attributes if there has been at least one successful fetch operation
from the driver. That said, I'd like to see a hostapd debug log showing
a case where this type of extra complexity would have actually helped.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list