Parcourir la source

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.
Jouni Malinen il y a 16 ans
Parent
commit
dbdf58b053
2 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 2 0
      hostapd/ChangeLog
  2. 2 1
      hostapd/driver_nl80211.c

+ 2 - 0
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)

+ 2 - 1
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;