[PATCH] Make rx_bytes and tx_bytes 64-bit rather than 32-bit.

Jouni Malinen j at w1.fi
Thu Feb 18 10:54:28 PST 2016


On Sat, Feb 13, 2016 at 03:09:14PM +0000, Nick Lowe wrote:
> Make rx_bytes and tx_bytes 64-bit rather than 32-bit. Rework RADIUS
> accounting to use these for Acct-Input-Octets, Acct-Input-Gigawords,
> Acct-Output-Octets and Acct-Output-Gigawords. Remove the race
> vulnerable 32-bit value wrap/overflow detection code.

> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> @@ -5340,10 +5340,10 @@ static int get_sta_handler(struct nl_msg *msg,
> -    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->tx_bytes = nla_get_u32(stats[NL80211_STA_INFO_TX_BYTES]);
> +    if (stats[NL80211_STA_INFO_RX_BYTES64])
> +        data->rx_bytes = nla_get_u64(stats[NL80211_STA_INFO_RX_BYTES64]);
> +    if (stats[NL80211_STA_INFO_TX_BYTES64])
> +        data->tx_bytes = nla_get_u64(stats[NL80211_STA_INFO_TX_BYTES64]);

This would break support for older kernel versions. While we might
eventually be able to drop support for the 32-bit TX/RX byte attributes,
it would probably be best to do this in two steps, i.e., the commit here
should check if the TX/RX_BYTES64 attribute exists and if so, use the
value from there. If those attributes were not present, fall back to
using the older 32-bit versions.
 
-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list