]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Reorder some IEs to get closer to IEEE 802.11 standard
authorJouni Malinen <j@w1.fi>
Sun, 2 May 2010 07:53:01 +0000 (10:53 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 2 May 2010 07:53:01 +0000 (10:53 +0300)
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.

src/ap/beacon.c
src/ap/ieee802_11.c

index 1a4cc1a6120ff4444b913531ea47d189785abe6e..bdc2c0a8fd5995ade30cce21caabd8b6d77b81d9 100644 (file)
@@ -308,16 +308,17 @@ void handle_probe_req(struct hostapd_data *hapd,
        /* Extended supported rates */
        pos = hostapd_eid_ext_supp_rates(hapd, pos);
 
+       /* RSN, MDIE, WPA */
        pos = hostapd_eid_wpa(hapd, pos, epos - pos, sta);
 
-       /* Wi-Fi Alliance WMM */
-       pos = hostapd_eid_wmm(hapd, pos);
-
 #ifdef CONFIG_IEEE80211N
        pos = hostapd_eid_ht_capabilities(hapd, pos);
        pos = hostapd_eid_ht_operation(hapd, pos);
 #endif /* CONFIG_IEEE80211N */
 
+       /* Wi-Fi Alliance WMM */
+       pos = hostapd_eid_wmm(hapd, pos);
+
 #ifdef CONFIG_WPS
        if (hapd->conf->wps_state && 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 */
        tailpos = hostapd_eid_ext_supp_rates(hapd, tailpos);
 
+       /* RSN, MDIE, WPA */
        tailpos = hostapd_eid_wpa(hapd, tailpos, tail + BEACON_TAIL_BUF_SIZE -
                                  tailpos, NULL);
 
-       /* Wi-Fi Alliance WMM */
-       tailpos = hostapd_eid_wmm(hapd, tailpos);
-
 #ifdef CONFIG_IEEE80211N
        tailpos = hostapd_eid_ht_capabilities(hapd, tailpos);
        tailpos = hostapd_eid_ht_operation(hapd, tailpos);
 #endif /* CONFIG_IEEE80211N */
 
+       /* Wi-Fi Alliance WMM */
+       tailpos = hostapd_eid_wmm(hapd, tailpos);
+
 #ifdef CONFIG_WPS
        if (hapd->conf->wps_state && hapd->wps_beacon_ie) {
                os_memcpy(tailpos, wpabuf_head(hapd->wps_beacon_ie),
index 6ce94b21c415135e9b7057c289864aa89fab60d7..02baddd4cb98e4842aa44badae009df26b093f48 100644 (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);
        /* Extended supported rates */
        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
        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);
 #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;
 
        if (hapd->drv.send_mgmt_frame(hapd, reply, send_len) < 0)