nl80211: Add TX/RX packet counts into accounting information
authorJouni Malinen <jouni.malinen@atheros.com>
Wed, 18 Feb 2009 09:29:45 +0000 (11:29 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 18 Feb 2009 09:29:45 +0000 (11:29 +0200)
hostapd/driver_nl80211.c

index f09f5b5..b70484d 100644 (file)
@@ -690,6 +690,8 @@ static int get_sta_handler(struct nl_msg *msg, void *arg)
                [NL80211_STA_INFO_INACTIVE_TIME] = { .type = NLA_U32 },
                [NL80211_STA_INFO_RX_BYTES] = { .type = NLA_U32 },
                [NL80211_STA_INFO_TX_BYTES] = { .type = NLA_U32 },
+               [NL80211_STA_INFO_RX_PACKETS] = { .type = NLA_U32 },
+               [NL80211_STA_INFO_TX_PACKETS] = { .type = NLA_U32 },
        };
 
        nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@@ -719,6 +721,12 @@ static int get_sta_handler(struct nl_msg *msg, void *arg)
                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_PACKETS])
+               data->rx_packets =
+                       nla_get_u32(stats[NL80211_STA_INFO_RX_PACKETS]);
+       if (stats[NL80211_STA_INFO_TX_PACKETS])
+               data->tx_packets =
+                       nla_get_u32(stats[NL80211_STA_INFO_TX_PACKETS]);
 
        return NL_SKIP;
 }