hostapd: Reorder some IEs to get closer to IEEE 802.11 standard

Vendor-specific IEs are supposed to be in the end of the frame, so move
WMM into the end of Beacon, Probe Response, and (Re)Association Response
frames. In addition, move HT IEs to be later in (Re)Association
Response to match the correct order.

hostapd_eid_wpa() adds multiple IEs and the end result may not always be
correct. If WPA is enabled, WPA IE (vendor-specific) gets added in the
middle of the frame and not in the end. This would require a larger
change to spliut the IEs from WPA module into separate locations when
constructing Beacon and Probe Response frames. This is not yet addressed.
This commit is contained in:
Jouni Malinen 2010-05-02 10:53:01 +03:00
parent b4a1256d36
commit 1bc774a12a
2 changed files with 16 additions and 13 deletions

View file

@ -308,16 +308,17 @@ void handle_probe_req(struct hostapd_data *hapd,
/* Extended supported rates */ /* Extended supported rates */
pos = hostapd_eid_ext_supp_rates(hapd, pos); pos = hostapd_eid_ext_supp_rates(hapd, pos);
/* RSN, MDIE, WPA */
pos = hostapd_eid_wpa(hapd, pos, epos - pos, sta); pos = hostapd_eid_wpa(hapd, pos, epos - pos, sta);
/* Wi-Fi Alliance WMM */
pos = hostapd_eid_wmm(hapd, pos);
#ifdef CONFIG_IEEE80211N #ifdef CONFIG_IEEE80211N
pos = hostapd_eid_ht_capabilities(hapd, pos); pos = hostapd_eid_ht_capabilities(hapd, pos);
pos = hostapd_eid_ht_operation(hapd, pos); pos = hostapd_eid_ht_operation(hapd, pos);
#endif /* CONFIG_IEEE80211N */ #endif /* CONFIG_IEEE80211N */
/* Wi-Fi Alliance WMM */
pos = hostapd_eid_wmm(hapd, pos);
#ifdef CONFIG_WPS #ifdef CONFIG_WPS
if (hapd->conf->wps_state && hapd->wps_probe_resp_ie) { if (hapd->conf->wps_state && hapd->wps_probe_resp_ie) {
os_memcpy(pos, wpabuf_head(hapd->wps_probe_resp_ie), os_memcpy(pos, wpabuf_head(hapd->wps_probe_resp_ie),
@ -408,17 +409,18 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
/* Extended supported rates */ /* Extended supported rates */
tailpos = hostapd_eid_ext_supp_rates(hapd, tailpos); tailpos = hostapd_eid_ext_supp_rates(hapd, tailpos);
/* RSN, MDIE, WPA */
tailpos = hostapd_eid_wpa(hapd, tailpos, tail + BEACON_TAIL_BUF_SIZE - tailpos = hostapd_eid_wpa(hapd, tailpos, tail + BEACON_TAIL_BUF_SIZE -
tailpos, NULL); tailpos, NULL);
/* Wi-Fi Alliance WMM */
tailpos = hostapd_eid_wmm(hapd, tailpos);
#ifdef CONFIG_IEEE80211N #ifdef CONFIG_IEEE80211N
tailpos = hostapd_eid_ht_capabilities(hapd, tailpos); tailpos = hostapd_eid_ht_capabilities(hapd, tailpos);
tailpos = hostapd_eid_ht_operation(hapd, tailpos); tailpos = hostapd_eid_ht_operation(hapd, tailpos);
#endif /* CONFIG_IEEE80211N */ #endif /* CONFIG_IEEE80211N */
/* Wi-Fi Alliance WMM */
tailpos = hostapd_eid_wmm(hapd, tailpos);
#ifdef CONFIG_WPS #ifdef CONFIG_WPS
if (hapd->conf->wps_state && hapd->wps_beacon_ie) { if (hapd->conf->wps_state && hapd->wps_beacon_ie) {
os_memcpy(tailpos, wpabuf_head(hapd->wps_beacon_ie), os_memcpy(tailpos, wpabuf_head(hapd->wps_beacon_ie),

View file

@ -850,13 +850,6 @@ static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
p = hostapd_eid_supp_rates(hapd, reply->u.assoc_resp.variable); p = hostapd_eid_supp_rates(hapd, reply->u.assoc_resp.variable);
/* Extended supported rates */ /* Extended supported rates */
p = hostapd_eid_ext_supp_rates(hapd, p); p = hostapd_eid_ext_supp_rates(hapd, p);
if (sta->flags & WLAN_STA_WMM)
p = hostapd_eid_wmm(hapd, p);
#ifdef CONFIG_IEEE80211N
p = hostapd_eid_ht_capabilities(hapd, p);
p = hostapd_eid_ht_operation(hapd, p);
#endif /* CONFIG_IEEE80211N */
#ifdef CONFIG_IEEE80211R #ifdef CONFIG_IEEE80211R
if (status_code == WLAN_STATUS_SUCCESS) { if (status_code == WLAN_STATUS_SUCCESS) {
@ -873,6 +866,14 @@ static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
p = hostapd_eid_assoc_comeback_time(hapd, sta, p); p = hostapd_eid_assoc_comeback_time(hapd, sta, p);
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_IEEE80211N
p = hostapd_eid_ht_capabilities(hapd, p);
p = hostapd_eid_ht_operation(hapd, p);
#endif /* CONFIG_IEEE80211N */
if (sta->flags & WLAN_STA_WMM)
p = hostapd_eid_wmm(hapd, p);
send_len += p - reply->u.assoc_resp.variable; send_len += p - reply->u.assoc_resp.variable;
if (hapd->drv.send_mgmt_frame(hapd, reply, send_len) < 0) if (hapd->drv.send_mgmt_frame(hapd, reply, send_len) < 0)