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 nonerp_set:1;
unsigned int no_short_slot_time_set:1; unsigned int no_short_slot_time_set:1;
unsigned int no_short_preamble_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; u16 auth_alg;
u8 previous_ap[6]; 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 " wpa_printf(MSG_DEBUG, "HT: STA " MACSTR " HT Capabilities "
"Info: 0x%04x", MAC2STR(sta->addr), ht_capab); "Info: 0x%04x", MAC2STR(sta->addr), ht_capab);
if ((ht_capab & HT_CAP_INFO_GREEN_FIELD) == 0) { 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 " wpa_printf(MSG_DEBUG, "%s STA " MACSTR " - no "
"greenfield, num of non-gf stations %d", "greenfield, num of non-gf stations %d",
__func__, MAC2STR(sta->addr), __func__, MAC2STR(sta->addr),
hapd->iface->num_sta_ht_no_gf); hapd->iface->num_sta_ht_no_gf);
} }
if ((ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) == 0) { 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, " wpa_printf(MSG_DEBUG, "%s STA " MACSTR " - 20 MHz HT, "
"num of 20MHz HT STAs %d", "num of 20MHz HT STAs %d",
__func__, MAC2STR(sta->addr), __func__, MAC2STR(sta->addr),
hapd->iface->num_sta_ht_20mhz); hapd->iface->num_sta_ht_20mhz);
} }
} else { } 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) { if (hapd->iconf->ieee80211n) {
wpa_printf(MSG_DEBUG, "%s STA " MACSTR wpa_printf(MSG_DEBUG, "%s STA " MACSTR
" - no HT, num of non-HT stations %d", " - 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 #ifdef CONFIG_IEEE80211N
if (sta->flags & WLAN_STA_HT) { if (sta->no_ht_gf_set) {
u16 ht_capab = le_to_host16( sta->no_ht_gf_set = 0;
sta->ht_capabilities.data.capabilities_info); hapd->iface->num_sta_ht_no_gf--;
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) if (sta->no_ht_set) {
hapd->iface->num_sta_ht_20mhz--; sta->no_ht_set = 0;
} else
hapd->iface->num_sta_no_ht--; 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) if (hostapd_ht_operation_update(hapd->iface) > 0)
set_beacon++; set_beacon++;