]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mesh: Generate proper AID for peer
authorBob Copeland <me@bobcopeland.com>
Mon, 5 Oct 2015 12:16:40 +0000 (08:16 -0400)
committerJouni Malinen <j@w1.fi>
Mon, 5 Oct 2015 22:27:29 +0000 (01:27 +0300)
IEEE Std 802.11-2012 13.3.1 states that the AID should be generated on
the local node for each peer. Previously, we were using the peer link ID
(generated by the peer) which may not be unique among all peers. Correct
this by reusing the AP AID generation code.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
src/ap/ieee802_11.c
src/ap/ieee802_11.h
wpa_supplicant/mesh_mpm.c

index 43d405d2336a476aac67756daf8e67685f2ba12a..01b514eee3fe4fae24e3b82a5c98b882b126f679 100644 (file)
@@ -1210,7 +1210,7 @@ static void handle_auth(struct hostapd_data *hapd,
 }
 
 
-static int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta)
+int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta)
 {
        int i, j = 32, aid;
 
index 93f9dc333f3cb34b24cd16b1e38e7e89156eaf2d..a2dd132838fd1431ca0b74d65a71ad7bbcd21725 100644 (file)
@@ -64,6 +64,7 @@ void hostapd_get_ht_capab(struct hostapd_data *hapd,
 void hostapd_get_vht_capab(struct hostapd_data *hapd,
                           struct ieee80211_vht_capabilities *vht_cap,
                           struct ieee80211_vht_capabilities *neg_vht_cap);
+int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta);
 u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
                      const u8 *ht_capab);
 u16 copy_sta_vendor_vht(struct hostapd_data *hapd, struct sta_info *sta,
index f81b88c89401b6e1ccd38109536a11f4c035c44e..86b2bcb093777a4d4fcf3f06ecc71c855ff5b88e 100644 (file)
@@ -258,7 +258,7 @@ 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);
@@ -561,13 +561,19 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
        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;