Deleted Added
full compact
ieee802_11_ht.c (281806) ieee802_11_ht.c (289549)
1/*
2 * hostapd / IEEE 802.11n HT
3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
4 * Copyright (c) 2007-2008, Intel Corporation
5 *
6 * This software may be distributed under the terms of the BSD license.
7 * See README for more details.
8 */

--- 195 unchanged lines hidden (view full) ---

204
205
206void hostapd_2040_coex_action(struct hostapd_data *hapd,
207 const struct ieee80211_mgmt *mgmt, size_t len)
208{
209 struct hostapd_iface *iface = hapd->iface;
210 struct ieee80211_2040_bss_coex_ie *bc_ie;
211 struct ieee80211_2040_intol_chan_report *ic_report;
1/*
2 * hostapd / IEEE 802.11n HT
3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
4 * Copyright (c) 2007-2008, Intel Corporation
5 *
6 * This software may be distributed under the terms of the BSD license.
7 * See README for more details.
8 */

--- 195 unchanged lines hidden (view full) ---

204
205
206void hostapd_2040_coex_action(struct hostapd_data *hapd,
207 const struct ieee80211_mgmt *mgmt, size_t len)
208{
209 struct hostapd_iface *iface = hapd->iface;
210 struct ieee80211_2040_bss_coex_ie *bc_ie;
211 struct ieee80211_2040_intol_chan_report *ic_report;
212 int is_ht_allowed = 1;
212 int is_ht40_allowed = 1;
213 int i;
214 const u8 *start = (const u8 *) mgmt;
215 const u8 *data = start + IEEE80211_HDRLEN + 2;
216
217 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
218 HOSTAPD_LEVEL_DEBUG, "hostapd_public_action - action=%d",
219 mgmt->u.action.u.public_action.action);
220

--- 16 unchanged lines hidden (view full) ---

237
238 wpa_printf(MSG_DEBUG, "20/40 BSS Coexistence Information field: 0x%x",
239 bc_ie->coex_param);
240 if (bc_ie->coex_param & WLAN_20_40_BSS_COEX_20MHZ_WIDTH_REQ) {
241 hostapd_logger(hapd, mgmt->sa,
242 HOSTAPD_MODULE_IEEE80211,
243 HOSTAPD_LEVEL_DEBUG,
244 "20 MHz BSS width request bit is set in BSS coexistence information field");
213 int i;
214 const u8 *start = (const u8 *) mgmt;
215 const u8 *data = start + IEEE80211_HDRLEN + 2;
216
217 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
218 HOSTAPD_LEVEL_DEBUG, "hostapd_public_action - action=%d",
219 mgmt->u.action.u.public_action.action);
220

--- 16 unchanged lines hidden (view full) ---

237
238 wpa_printf(MSG_DEBUG, "20/40 BSS Coexistence Information field: 0x%x",
239 bc_ie->coex_param);
240 if (bc_ie->coex_param & WLAN_20_40_BSS_COEX_20MHZ_WIDTH_REQ) {
241 hostapd_logger(hapd, mgmt->sa,
242 HOSTAPD_MODULE_IEEE80211,
243 HOSTAPD_LEVEL_DEBUG,
244 "20 MHz BSS width request bit is set in BSS coexistence information field");
245 is_ht_allowed = 0;
245 is_ht40_allowed = 0;
246 }
247
248 if (bc_ie->coex_param & WLAN_20_40_BSS_COEX_40MHZ_INTOL) {
249 hostapd_logger(hapd, mgmt->sa,
250 HOSTAPD_MODULE_IEEE80211,
251 HOSTAPD_LEVEL_DEBUG,
252 "40 MHz intolerant bit is set in BSS coexistence information field");
246 }
247
248 if (bc_ie->coex_param & WLAN_20_40_BSS_COEX_40MHZ_INTOL) {
249 hostapd_logger(hapd, mgmt->sa,
250 HOSTAPD_MODULE_IEEE80211,
251 HOSTAPD_LEVEL_DEBUG,
252 "40 MHz intolerant bit is set in BSS coexistence information field");
253 is_ht_allowed = 0;
253 is_ht40_allowed = 0;
254 }
255
256 if (start + len - data >= 3 &&
257 data[0] == WLAN_EID_20_40_BSS_INTOLERANT && data[1] >= 1) {
258 u8 ielen = data[1];
259
260 if (ielen > start + len - data - 2)
261 return;

--- 9 unchanged lines hidden (view full) ---

271
272 if (is_40_allowed(iface, chan))
273 continue;
274 hostapd_logger(hapd, mgmt->sa,
275 HOSTAPD_MODULE_IEEE80211,
276 HOSTAPD_LEVEL_DEBUG,
277 "20_40_INTOLERANT channel %d reported",
278 chan);
254 }
255
256 if (start + len - data >= 3 &&
257 data[0] == WLAN_EID_20_40_BSS_INTOLERANT && data[1] >= 1) {
258 u8 ielen = data[1];
259
260 if (ielen > start + len - data - 2)
261 return;

--- 9 unchanged lines hidden (view full) ---

271
272 if (is_40_allowed(iface, chan))
273 continue;
274 hostapd_logger(hapd, mgmt->sa,
275 HOSTAPD_MODULE_IEEE80211,
276 HOSTAPD_LEVEL_DEBUG,
277 "20_40_INTOLERANT channel %d reported",
278 chan);
279 is_ht_allowed = 0;
279 is_ht40_allowed = 0;
280 }
281 }
280 }
281 }
282 wpa_printf(MSG_DEBUG, "is_ht_allowed=%d num_sta_ht40_intolerant=%d",
283 is_ht_allowed, iface->num_sta_ht40_intolerant);
282 wpa_printf(MSG_DEBUG, "is_ht40_allowed=%d num_sta_ht40_intolerant=%d",
283 is_ht40_allowed, iface->num_sta_ht40_intolerant);
284
284
285 if (!is_ht_allowed &&
285 if (!is_ht40_allowed &&
286 (iface->drv_flags & WPA_DRIVER_FLAGS_HT_2040_COEX)) {
287 if (iface->conf->secondary_channel) {
288 hostapd_logger(hapd, mgmt->sa,
289 HOSTAPD_MODULE_IEEE80211,
290 HOSTAPD_LEVEL_INFO,
291 "Switching to 20 MHz operation");
292 iface->conf->secondary_channel = 0;
293 ieee802_11_set_beacons(iface);

--- 11 unchanged lines hidden (view full) ---

305 "Reschedule HT 20/40 timeout to occur in %u seconds",
306 delay_time);
307 }
308 }
309}
310
311
312u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
286 (iface->drv_flags & WPA_DRIVER_FLAGS_HT_2040_COEX)) {
287 if (iface->conf->secondary_channel) {
288 hostapd_logger(hapd, mgmt->sa,
289 HOSTAPD_MODULE_IEEE80211,
290 HOSTAPD_LEVEL_INFO,
291 "Switching to 20 MHz operation");
292 iface->conf->secondary_channel = 0;
293 ieee802_11_set_beacons(iface);

--- 11 unchanged lines hidden (view full) ---

305 "Reschedule HT 20/40 timeout to occur in %u seconds",
306 delay_time);
307 }
308 }
309}
310
311
312u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
313 const u8 *ht_capab, size_t ht_capab_len)
313 const u8 *ht_capab)
314{
314{
315 /* Disable HT caps for STAs associated to no-HT BSSes. */
315 /*
316 * Disable HT caps for STAs associated to no-HT BSSes, or for stations
317 * that did not specify a valid WMM IE in the (Re)Association Request
318 * frame.
319 */
316 if (!ht_capab ||
320 if (!ht_capab ||
317 ht_capab_len < sizeof(struct ieee80211_ht_capabilities) ||
318 hapd->conf->disable_11n) {
321 !(sta->flags & WLAN_STA_WMM) || hapd->conf->disable_11n) {
319 sta->flags &= ~WLAN_STA_HT;
320 os_free(sta->ht_capabilities);
321 sta->ht_capabilities = NULL;
322 return WLAN_STATUS_SUCCESS;
323 }
324
325 if (sta->ht_capabilities == NULL) {
326 sta->ht_capabilities =

--- 161 unchanged lines hidden ---
322 sta->flags &= ~WLAN_STA_HT;
323 os_free(sta->ht_capabilities);
324 sta->ht_capabilities = NULL;
325 return WLAN_STATUS_SUCCESS;
326 }
327
328 if (sta->ht_capabilities == NULL) {
329 sta->ht_capabilities =

--- 161 unchanged lines hidden ---