Set WMM flag to Mesh STA by default
[mech_eap.git] / wpa_supplicant / mesh_mpm.c
index 1d6f2be..0a05815 100644 (file)
@@ -239,6 +239,9 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s,
                           2 + 22;  /* HT operation */
        }
 #endif /* CONFIG_IEEE80211N */
+       if (type != PLINK_CLOSE)
+               buf_len += conf->rsn_ie_len; /* RSN IE */
+
        buf = wpabuf_alloc(buf_len);
        if (!buf)
                return;
@@ -255,13 +258,16 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s,
 
                /* aid */
                if (type == PLINK_CONFIRM)
-                       wpabuf_put_le16(buf, sta->peer_lid);
+                       wpabuf_put_le16(buf, sta->aid);
 
                /* IE: supp + ext. supp rates */
                pos = hostapd_eid_supp_rates(bss, supp_rates);
                pos = hostapd_eid_ext_supp_rates(bss, pos);
                wpabuf_put_data(buf, supp_rates, pos - supp_rates);
 
+               /* IE: RSN IE */
+               wpabuf_put_data(buf, conf->rsn_ie, conf->rsn_ie_len);
+
                /* IE: Mesh ID */
                wpabuf_put_u8(buf, WLAN_EID_MESH_ID);
                wpabuf_put_u8(buf, conf->meshid_len);
@@ -542,6 +548,9 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
                        return NULL;
        }
 
+       /* Set WMM by default since Mesh STAs are QoS STAs */
+       sta->flags |= WLAN_STA_WMM;
+
        /* initialize sta */
        if (copy_supp_rates(wpa_s, sta, elems)) {
                ap_free_sta(data, sta);
@@ -551,18 +560,23 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
        mesh_mpm_init_link(wpa_s, sta);
 
 #ifdef CONFIG_IEEE80211N
-       copy_sta_ht_capab(data, sta, elems->ht_capabilities,
-                       elems->ht_capabilities_len);
+       copy_sta_ht_capab(data, sta, elems->ht_capabilities);
        update_ht_state(data, sta);
 #endif /* CONFIG_IEEE80211N */
 
+       if (hostapd_get_aid(data, sta) < 0) {
+               wpa_msg(wpa_s, MSG_ERROR, "No AIDs available");
+               ap_free_sta(data, sta);
+               return NULL;
+       }
+
        /* insert into driver */
        os_memset(&params, 0, sizeof(params));
        params.supp_rates = sta->supported_rates;
        params.supp_rates_len = sta->supported_rates_len;
        params.addr = addr;
        params.plink_state = sta->plink_state;
-       params.aid = sta->peer_lid;
+       params.aid = sta->aid;
        params.listen_interval = 100;
        params.ht_capabilities = sta->ht_capabilities;
        params.flags |= WPA_STA_WMM;