[PATCH] Placing information elements in beacon, probe-resp, (re)assoc-resp in order

Yogesh Ashok Powar yogeshp
Fri Apr 23 03:39:02 PDT 2010


Information Elements are placed in mixed order of Element IDs in beacons, Probe
Response and (Re)Association Response freames. This patch arranges the IEs in
incresing order.  Following is the Correct sequence is

IEs	Function
42-  hostapd_eid_erp_info,
45-  hostapd_eid_ht_capabilities,
48-  hostapd_eid_wpa,
50-  hostapd_eid_ext_supp_rates,
56-  hostapd_eid_assoc_comeback_time [in re/assoc only]
61-  hostapd_eid_ht_operation
221- hostapd_eid_wmm(221)

Signed-off-by: yogeshp at marvell.com
---
 src/ap/beacon.c     |   27 +++++++++++++++++----------
 src/ap/ieee802_11.c |   15 ++++++++++-----
 2 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 1a4cc1a..08a5e0f 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -305,19 +305,22 @@ void handle_probe_req(struct hostapd_data *hapd,
 	/* ERP Information element */
 	pos = hostapd_eid_erp_info(hapd, pos);
 
-	/* Extended supported rates */
-	pos = hostapd_eid_ext_supp_rates(hapd, pos);
+#ifdef CONFIG_IEEE80211N
+	pos = hostapd_eid_ht_capabilities(hapd, pos);
+#endif /* CONFIG_IEEE80211N */
 
 	pos = hostapd_eid_wpa(hapd, pos, epos - pos, sta);
 
-	/* Wi-Fi Alliance WMM */
-	pos = hostapd_eid_wmm(hapd, pos);
+	/* Extended supported rates */
+	pos = hostapd_eid_ext_supp_rates(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),
@@ -405,20 +408,24 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
 	/* ERP Information element */
 	tailpos = hostapd_eid_erp_info(hapd, tailpos);
 
-	/* Extended supported rates */
-	tailpos = hostapd_eid_ext_supp_rates(hapd, tailpos);
+#ifdef CONFIG_IEEE80211N
+	tailpos = hostapd_eid_ht_capabilities(hapd, tailpos);
+#endif /* CONFIG_IEEE80211N */
 
 	tailpos = hostapd_eid_wpa(hapd, tailpos, tail + BEACON_TAIL_BUF_SIZE -
 				  tailpos, NULL);
 
-	/* Wi-Fi Alliance WMM */
-	tailpos = hostapd_eid_wmm(hapd, tailpos);
+	/* Extended supported rates */
+	tailpos = hostapd_eid_ext_supp_rates(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),
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 6ce94b2..4216493 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -848,14 +848,9 @@ static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
 					       | BIT(14) | BIT(15));
 	/* Supported rates */
 	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
@@ -868,11 +863,21 @@ static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
 	}
 #endif /* CONFIG_IEEE80211R */
 
+	/* Extended supported rates */
+	p = hostapd_eid_ext_supp_rates(hapd, p);
+
 #ifdef CONFIG_IEEE80211W
 	if (status_code == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY)
 		p = hostapd_eid_assoc_comeback_time(hapd, sta, p);
 #endif /* CONFIG_IEEE80211W */
 
+#ifdef CONFIG_IEEE80211N
+	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)
-- 
1.5.4.3




More information about the Hostap mailing list