Fixed non-HT (and GF, 20 MHz) counting

Must not count the same STA multiple times if it reassociates back to
the same AP without the old STA entry being removed.
This commit is contained in:
Jouni Malinen 2008-12-02 14:32:05 +02:00 committed by Jouni Malinen
parent 08bec36178
commit e8ff1e594e
3 changed files with 28 additions and 11 deletions

View file

@ -56,6 +56,9 @@ struct sta_info {
unsigned int nonerp_set:1;
unsigned int no_short_slot_time_set:1;
unsigned int no_short_preamble_set:1;
unsigned int no_ht_gf_set:1;
unsigned int no_ht_set:1;
unsigned int ht_20mhz_set:1;
u16 auth_alg;
u8 previous_ap[6];

View file

@ -980,21 +980,30 @@ static void handle_assoc(struct hostapd_data *hapd,
wpa_printf(MSG_DEBUG, "HT: STA " MACSTR " HT Capabilities "
"Info: 0x%04x", MAC2STR(sta->addr), ht_capab);
if ((ht_capab & HT_CAP_INFO_GREEN_FIELD) == 0) {
hapd->iface->num_sta_ht_no_gf++;
if (!sta->no_ht_gf_set) {
sta->no_ht_gf_set = 1;
hapd->iface->num_sta_ht_no_gf++;
}
wpa_printf(MSG_DEBUG, "%s STA " MACSTR " - no "
"greenfield, num of non-gf stations %d",
__func__, MAC2STR(sta->addr),
hapd->iface->num_sta_ht_no_gf);
}
if ((ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) == 0) {
hapd->iface->num_sta_ht_20mhz++;
if (!sta->ht_20mhz_set) {
sta->ht_20mhz_set = 1;
hapd->iface->num_sta_ht_20mhz++;
}
wpa_printf(MSG_DEBUG, "%s STA " MACSTR " - 20 MHz HT, "
"num of 20MHz HT STAs %d",
__func__, MAC2STR(sta->addr),
hapd->iface->num_sta_ht_20mhz);
}
} else {
hapd->iface->num_sta_no_ht++;
if (!sta->no_ht_set) {
sta->no_ht_set = 1;
hapd->iface->num_sta_no_ht++;
}
if (hapd->iconf->ieee80211n) {
wpa_printf(MSG_DEBUG, "%s STA " MACSTR
" - no HT, num of non-HT stations %d",

View file

@ -155,15 +155,20 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
}
#ifdef CONFIG_IEEE80211N
if (sta->flags & WLAN_STA_HT) {
u16 ht_capab = le_to_host16(
sta->ht_capabilities.data.capabilities_info);
if ((ht_capab & HT_CAP_INFO_GREEN_FIELD) == 0)
hapd->iface->num_sta_ht_no_gf--;
if ((ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) == 0)
hapd->iface->num_sta_ht_20mhz--;
} else
if (sta->no_ht_gf_set) {
sta->no_ht_gf_set = 0;
hapd->iface->num_sta_ht_no_gf--;
}
if (sta->no_ht_set) {
sta->no_ht_set = 0;
hapd->iface->num_sta_no_ht--;
}
if (sta->ht_20mhz_set) {
sta->ht_20mhz_set = 0;
hapd->iface->num_sta_ht_20mhz--;
}
if (hostapd_ht_operation_update(hapd->iface) > 0)
set_beacon++;