From dbdf58b053e4b839ec05ee19d73f96a448f1a863 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 16 Feb 2009 13:28:42 +0200 Subject: [PATCH] driver_nl80211: Fix STA accounting data collection TX/RX bytes are now reported correctly (typo ended up leaving TX bytes uninitialized and set RX bytes value to use correct TX bytes). TX/RX packet counts are not yet available from kernel, so we have to clear the values to avoid reporting bogus data. --- hostapd/ChangeLog | 2 ++ hostapd/driver_nl80211.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hostapd/ChangeLog b/hostapd/ChangeLog index 17ebc3b33..3a1c2a9ea 100644 --- a/hostapd/ChangeLog +++ b/hostapd/ChangeLog @@ -6,6 +6,8 @@ ChangeLog for hostapd * driver_nl80211: use Linux socket filter to improve performance * added support for external Registrars with WPS (UPnP transport) * 802.11n: scan for overlapping BSSes before starting 20/40 MHz channel + * driver_nl80211: fixed STA accounting data collection (TX/RX bytes + reported correctly; TX/RX packets not yet available from kernel) 2009-01-06 - v0.6.7 * added support for Wi-Fi Protected Setup (WPS) diff --git a/hostapd/driver_nl80211.c b/hostapd/driver_nl80211.c index 3cb74d167..f09f5b58e 100644 --- a/hostapd/driver_nl80211.c +++ b/hostapd/driver_nl80211.c @@ -718,7 +718,7 @@ static int get_sta_handler(struct nl_msg *msg, void *arg) if (stats[NL80211_STA_INFO_RX_BYTES]) data->rx_bytes = nla_get_u32(stats[NL80211_STA_INFO_RX_BYTES]); if (stats[NL80211_STA_INFO_TX_BYTES]) - data->rx_bytes = nla_get_u32(stats[NL80211_STA_INFO_TX_BYTES]); + data->tx_bytes = nla_get_u32(stats[NL80211_STA_INFO_TX_BYTES]); return NL_SKIP; } @@ -729,6 +729,7 @@ static int i802_read_sta_data(void *priv, struct hostap_sta_driver_data *data, struct i802_driver_data *drv = priv; struct nl_msg *msg; + os_memset(data, 0, sizeof(*data)); msg = nlmsg_alloc(); if (!msg) return -ENOMEM;