}
+static int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta)
+{
+ int i, j = 32, aid;
+
+ /* get a unique AID */
+ if (sta->aid > 0) {
+ wpa_printf(MSG_DEBUG, " old AID %d", sta->aid);
+ return 0;
+ }
+
+ for (i = 0; i < AID_WORDS; i++) {
+ if (hapd->sta_aid[i] == (u32) -1)
+ continue;
+ for (j = 0; j < 32; j++) {
+ if (!(hapd->sta_aid[i] & BIT(j)))
+ break;
+ }
+ if (j < 32)
+ break;
+ }
+ if (j == 32)
+ return -1;
+ aid = i * 32 + j + 1;
+ if (aid > 2007)
+ return -1;
+
+ sta->aid = aid;
+ hapd->sta_aid[i] |= BIT(j);
+ wpa_printf(MSG_DEBUG, " new AID %d", sta->aid);
+ return 0;
+}
+
+
static void handle_assoc(struct hostapd_data *hapd,
struct ieee80211_mgmt *mgmt, size_t len, int reassoc)
{
int send_deauth = 0, send_len, left, i;
struct sta_info *sta;
struct ieee802_11_elems elems;
- u8 buf[sizeof(struct ieee80211_mgmt) + 512];
+ u8 buf[sizeof(struct ieee80211_mgmt) + 1024];
struct ieee80211_mgmt *reply;
if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
ieee802_11_set_beacons(hapd->iface);
#endif /* CONFIG_IEEE80211N */
- /* get a unique AID */
- if (sta->aid > 0) {
- wpa_printf(MSG_DEBUG, " old AID %d", sta->aid);
- } else {
- for (sta->aid = 1; sta->aid <= MAX_AID_TABLE_SIZE; sta->aid++)
- if (hapd->sta_aid[sta->aid - 1] == NULL)
- break;
- if (sta->aid > MAX_AID_TABLE_SIZE) {
- sta->aid = 0;
- resp = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
- wpa_printf(MSG_ERROR, " no room for more AIDs");
- goto fail;
- } else {
- hapd->sta_aid[sta->aid - 1] = sta;
- wpa_printf(MSG_DEBUG, " new AID %d", sta->aid);
- }
+ if (hostapd_get_aid(hapd, sta) < 0) {
+ resp = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
+ wpa_printf(MSG_ERROR, " no room for more AIDs");
+ goto fail;
}
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
#ifdef CONFIG_IEEE80211R
if (resp == WLAN_STATUS_SUCCESS) {
/* IEEE 802.11r: Mobility Domain Information, Fast BSS
- * Transition Information, RSN */
+ * Transition Information, RSN, [RIC Response] */
p = wpa_sm_write_assoc_resp_ies(sta->wpa_sm, p,
buf + sizeof(buf) - p,
- sta->auth_alg);
+ sta->auth_alg,
+ pos, left);
}
#endif /* CONFIG_IEEE80211R */
if (sta->flags & WLAN_STA_ASSOC)
new_assoc = 0;
sta->flags |= WLAN_STA_ASSOC;
+ if (!hapd->conf->ieee802_1x && !hapd->conf->wpa) {
+ /* Open or static WEP; no separate authorization */
+ sta->flags |= WLAN_STA_AUTHORIZED;
+ }
if (reassoc)
mlme_reassociate_indication(hapd, sta);