mesh: Generate proper AID for peer

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>
This commit is contained in:
Bob Copeland 2015-10-05 08:16:40 -04:00 committed by Jouni Malinen
parent 41d621075e
commit 681753f23c
3 changed files with 10 additions and 3 deletions

View 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; int i, j = 32, aid;

View file

@ -64,6 +64,7 @@ void hostapd_get_ht_capab(struct hostapd_data *hapd,
void hostapd_get_vht_capab(struct hostapd_data *hapd, void hostapd_get_vht_capab(struct hostapd_data *hapd,
struct ieee80211_vht_capabilities *vht_cap, struct ieee80211_vht_capabilities *vht_cap,
struct ieee80211_vht_capabilities *neg_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, u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
const u8 *ht_capab); const u8 *ht_capab);
u16 copy_sta_vendor_vht(struct hostapd_data *hapd, struct sta_info *sta, u16 copy_sta_vendor_vht(struct hostapd_data *hapd, struct sta_info *sta,

View file

@ -258,7 +258,7 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s,
/* aid */ /* aid */
if (type == PLINK_CONFIRM) if (type == PLINK_CONFIRM)
wpabuf_put_le16(buf, sta->peer_lid); wpabuf_put_le16(buf, sta->aid);
/* IE: supp + ext. supp rates */ /* IE: supp + ext. supp rates */
pos = hostapd_eid_supp_rates(bss, 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); update_ht_state(data, sta);
#endif /* CONFIG_IEEE80211N */ #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 */ /* insert into driver */
os_memset(&params, 0, sizeof(params)); os_memset(&params, 0, sizeof(params));
params.supp_rates = sta->supported_rates; params.supp_rates = sta->supported_rates;
params.supp_rates_len = sta->supported_rates_len; params.supp_rates_len = sta->supported_rates_len;
params.addr = addr; params.addr = addr;
params.plink_state = sta->plink_state; params.plink_state = sta->plink_state;
params.aid = sta->peer_lid; params.aid = sta->aid;
params.listen_interval = 100; params.listen_interval = 100;
params.ht_capabilities = sta->ht_capabilities; params.ht_capabilities = sta->ht_capabilities;
params.flags |= WPA_STA_WMM; params.flags |= WPA_STA_WMM;