Deleted Added
full compact
drv_callbacks.c (281806) drv_callbacks.c (289549)
1/*
2 * hostapd / Callback functions for driver wrappers
3 * Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8

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

13#include "radius/radius.h"
14#include "drivers/driver.h"
15#include "common/ieee802_11_defs.h"
16#include "common/ieee802_11_common.h"
17#include "common/wpa_ctrl.h"
18#include "crypto/random.h"
19#include "p2p/p2p.h"
20#include "wps/wps.h"
1/*
2 * hostapd / Callback functions for driver wrappers
3 * Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8

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

13#include "radius/radius.h"
14#include "drivers/driver.h"
15#include "common/ieee802_11_defs.h"
16#include "common/ieee802_11_common.h"
17#include "common/wpa_ctrl.h"
18#include "crypto/random.h"
19#include "p2p/p2p.h"
20#include "wps/wps.h"
21#include "fst/fst.h"
21#include "wnm_ap.h"
22#include "hostapd.h"
23#include "ieee802_11.h"
24#include "sta_info.h"
25#include "accounting.h"
26#include "tkip_countermeasures.h"
27#include "ieee802_1x.h"
28#include "wpa_auth.h"

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

37int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
38 const u8 *req_ies, size_t req_ies_len, int reassoc)
39{
40 struct sta_info *sta;
41 int new_assoc, res;
42 struct ieee802_11_elems elems;
43 const u8 *ie;
44 size_t ielen;
22#include "wnm_ap.h"
23#include "hostapd.h"
24#include "ieee802_11.h"
25#include "sta_info.h"
26#include "accounting.h"
27#include "tkip_countermeasures.h"
28#include "ieee802_1x.h"
29#include "wpa_auth.h"

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

38int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
39 const u8 *req_ies, size_t req_ies_len, int reassoc)
40{
41 struct sta_info *sta;
42 int new_assoc, res;
43 struct ieee802_11_elems elems;
44 const u8 *ie;
45 size_t ielen;
45#ifdef CONFIG_IEEE80211R
46#if defined(CONFIG_IEEE80211R) || defined(CONFIG_IEEE80211W)
46 u8 buf[sizeof(struct ieee80211_mgmt) + 1024];
47 u8 *p = buf;
47 u8 buf[sizeof(struct ieee80211_mgmt) + 1024];
48 u8 *p = buf;
48#endif /* CONFIG_IEEE80211R */
49#endif /* CONFIG_IEEE80211R || CONFIG_IEEE80211W */
49 u16 reason = WLAN_REASON_UNSPECIFIED;
50 u16 status = WLAN_STATUS_SUCCESS;
51 const u8 *p2p_dev_addr = NULL;
52
53 if (addr == NULL) {
54 /*
55 * This could potentially happen with unexpected event from the
56 * driver wrapper. This was seen at least in one case where the
57 * driver ended up being set to station mode while hostapd was
58 * running, so better make sure we stop processing such an
59 * event here.
60 */
50 u16 reason = WLAN_REASON_UNSPECIFIED;
51 u16 status = WLAN_STATUS_SUCCESS;
52 const u8 *p2p_dev_addr = NULL;
53
54 if (addr == NULL) {
55 /*
56 * This could potentially happen with unexpected event from the
57 * driver wrapper. This was seen at least in one case where the
58 * driver ended up being set to station mode while hostapd was
59 * running, so better make sure we stop processing such an
60 * event here.
61 */
61 wpa_printf(MSG_DEBUG, "hostapd_notif_assoc: Skip event with "
62 "no address");
62 wpa_printf(MSG_DEBUG,
63 "hostapd_notif_assoc: Skip event with no address");
63 return -1;
64 }
65 random_add_randomness(addr, ETH_ALEN);
66
67 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
68 HOSTAPD_LEVEL_INFO, "associated");
69
70 ieee802_11_parse_elems(req_ies, req_ies_len, &elems, 0);

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

84 } else if (elems.osen) {
85 ie = elems.osen - 2;
86 ielen = elems.osen_len + 2;
87 wpa_printf(MSG_DEBUG, "STA included OSEN IE in (Re)AssocReq");
88#endif /* CONFIG_HS20 */
89 } else {
90 ie = NULL;
91 ielen = 0;
64 return -1;
65 }
66 random_add_randomness(addr, ETH_ALEN);
67
68 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
69 HOSTAPD_LEVEL_INFO, "associated");
70
71 ieee802_11_parse_elems(req_ies, req_ies_len, &elems, 0);

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

85 } else if (elems.osen) {
86 ie = elems.osen - 2;
87 ielen = elems.osen_len + 2;
88 wpa_printf(MSG_DEBUG, "STA included OSEN IE in (Re)AssocReq");
89#endif /* CONFIG_HS20 */
90 } else {
91 ie = NULL;
92 ielen = 0;
92 wpa_printf(MSG_DEBUG, "STA did not include WPS/RSN/WPA IE in "
93 "(Re)AssocReq");
93 wpa_printf(MSG_DEBUG,
94 "STA did not include WPS/RSN/WPA IE in (Re)AssocReq");
94 }
95
96 sta = ap_get_sta(hapd, addr);
97 if (sta) {
98 ap_sta_no_session_timeout(hapd, sta);
99 accounting_sta_stop(hapd, sta);
100
101 /*

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

121 if (sta->p2p_ie)
122 p2p_dev_addr = p2p_get_go_dev_addr(sta->p2p_ie);
123 }
124#endif /* CONFIG_P2P */
125
126#ifdef CONFIG_IEEE80211N
127#ifdef NEED_AP_MLME
128 if (elems.ht_capabilities &&
95 }
96
97 sta = ap_get_sta(hapd, addr);
98 if (sta) {
99 ap_sta_no_session_timeout(hapd, sta);
100 accounting_sta_stop(hapd, sta);
101
102 /*

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

122 if (sta->p2p_ie)
123 p2p_dev_addr = p2p_get_go_dev_addr(sta->p2p_ie);
124 }
125#endif /* CONFIG_P2P */
126
127#ifdef CONFIG_IEEE80211N
128#ifdef NEED_AP_MLME
129 if (elems.ht_capabilities &&
129 elems.ht_capabilities_len >=
130 sizeof(struct ieee80211_ht_capabilities) &&
131 (hapd->iface->conf->ht_capab &
132 HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)) {
133 struct ieee80211_ht_capabilities *ht_cap =
134 (struct ieee80211_ht_capabilities *)
135 elems.ht_capabilities;
136
137 if (le_to_host16(ht_cap->ht_capabilities_info) &
138 HT_CAP_INFO_40MHZ_INTOLERANT)

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

152 wpabuf_free(sta->hs20_ie);
153 if (elems.hs20 && elems.hs20_len > 4) {
154 sta->hs20_ie = wpabuf_alloc_copy(elems.hs20 + 4,
155 elems.hs20_len - 4);
156 } else
157 sta->hs20_ie = NULL;
158#endif /* CONFIG_HS20 */
159
130 (hapd->iface->conf->ht_capab &
131 HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)) {
132 struct ieee80211_ht_capabilities *ht_cap =
133 (struct ieee80211_ht_capabilities *)
134 elems.ht_capabilities;
135
136 if (le_to_host16(ht_cap->ht_capabilities_info) &
137 HT_CAP_INFO_40MHZ_INTOLERANT)

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

151 wpabuf_free(sta->hs20_ie);
152 if (elems.hs20 && elems.hs20_len > 4) {
153 sta->hs20_ie = wpabuf_alloc_copy(elems.hs20 + 4,
154 elems.hs20_len - 4);
155 } else
156 sta->hs20_ie = NULL;
157#endif /* CONFIG_HS20 */
158
159#ifdef CONFIG_FST
160 wpabuf_free(sta->mb_ies);
161 if (hapd->iface->fst)
162 sta->mb_ies = mb_ies_by_info(&elems.mb_ies);
163 else
164 sta->mb_ies = NULL;
165#endif /* CONFIG_FST */
166
160 if (hapd->conf->wpa) {
161 if (ie == NULL || ielen == 0) {
162#ifdef CONFIG_WPS
163 if (hapd->conf->wps_state) {
167 if (hapd->conf->wpa) {
168 if (ie == NULL || ielen == 0) {
169#ifdef CONFIG_WPS
170 if (hapd->conf->wps_state) {
164 wpa_printf(MSG_DEBUG, "STA did not include "
165 "WPA/RSN IE in (Re)Association "
166 "Request - possible WPS use");
171 wpa_printf(MSG_DEBUG,
172 "STA did not include WPA/RSN IE in (Re)Association Request - possible WPS use");
167 sta->flags |= WLAN_STA_MAYBE_WPS;
168 goto skip_wpa_check;
169 }
170#endif /* CONFIG_WPS */
171
172 wpa_printf(MSG_DEBUG, "No WPA/RSN IE from STA");
173 return -1;
174 }
175#ifdef CONFIG_WPS
176 if (hapd->conf->wps_state && ie[0] == 0xdd && ie[1] >= 4 &&
177 os_memcmp(ie + 2, "\x00\x50\xf2\x04", 4) == 0) {
178 struct wpabuf *wps;
173 sta->flags |= WLAN_STA_MAYBE_WPS;
174 goto skip_wpa_check;
175 }
176#endif /* CONFIG_WPS */
177
178 wpa_printf(MSG_DEBUG, "No WPA/RSN IE from STA");
179 return -1;
180 }
181#ifdef CONFIG_WPS
182 if (hapd->conf->wps_state && ie[0] == 0xdd && ie[1] >= 4 &&
183 os_memcmp(ie + 2, "\x00\x50\xf2\x04", 4) == 0) {
184 struct wpabuf *wps;
185
179 sta->flags |= WLAN_STA_WPS;
180 wps = ieee802_11_vendor_ie_concat(ie, ielen,
181 WPS_IE_VENDOR_TYPE);
182 if (wps) {
183 if (wps_is_20(wps)) {
186 sta->flags |= WLAN_STA_WPS;
187 wps = ieee802_11_vendor_ie_concat(ie, ielen,
188 WPS_IE_VENDOR_TYPE);
189 if (wps) {
190 if (wps_is_20(wps)) {
184 wpa_printf(MSG_DEBUG, "WPS: STA "
185 "supports WPS 2.0");
191 wpa_printf(MSG_DEBUG,
192 "WPS: STA supports WPS 2.0");
186 sta->flags |= WLAN_STA_WPS2;
187 }
188 wpabuf_free(wps);
189 }
190 goto skip_wpa_check;
191 }
192#endif /* CONFIG_WPS */
193
194 if (sta->wpa_sm == NULL)
195 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
196 sta->addr,
197 p2p_dev_addr);
198 if (sta->wpa_sm == NULL) {
193 sta->flags |= WLAN_STA_WPS2;
194 }
195 wpabuf_free(wps);
196 }
197 goto skip_wpa_check;
198 }
199#endif /* CONFIG_WPS */
200
201 if (sta->wpa_sm == NULL)
202 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
203 sta->addr,
204 p2p_dev_addr);
205 if (sta->wpa_sm == NULL) {
199 wpa_printf(MSG_ERROR, "Failed to initialize WPA state "
200 "machine");
206 wpa_printf(MSG_ERROR,
207 "Failed to initialize WPA state machine");
201 return -1;
202 }
203 res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm,
204 ie, ielen,
205 elems.mdie, elems.mdie_len);
206 if (res != WPA_IE_OK) {
208 return -1;
209 }
210 res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm,
211 ie, ielen,
212 elems.mdie, elems.mdie_len);
213 if (res != WPA_IE_OK) {
207 wpa_printf(MSG_DEBUG, "WPA/RSN information element "
208 "rejected? (res %u)", res);
214 wpa_printf(MSG_DEBUG,
215 "WPA/RSN information element rejected? (res %u)",
216 res);
209 wpa_hexdump(MSG_DEBUG, "IE", ie, ielen);
210 if (res == WPA_INVALID_GROUP) {
211 reason = WLAN_REASON_GROUP_CIPHER_NOT_VALID;
212 status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID;
213 } else if (res == WPA_INVALID_PAIRWISE) {
214 reason = WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID;
215 status = WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID;
216 } else if (res == WPA_INVALID_AKMP) {

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

243 * Query timeout has not been reached. Reject the
244 * association attempt temporarily and start SA Query,
245 * if one is not pending.
246 */
247
248 if (sta->sa_query_count == 0)
249 ap_sta_start_sa_query(hapd, sta);
250
217 wpa_hexdump(MSG_DEBUG, "IE", ie, ielen);
218 if (res == WPA_INVALID_GROUP) {
219 reason = WLAN_REASON_GROUP_CIPHER_NOT_VALID;
220 status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID;
221 } else if (res == WPA_INVALID_PAIRWISE) {
222 reason = WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID;
223 status = WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID;
224 } else if (res == WPA_INVALID_AKMP) {

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

251 * Query timeout has not been reached. Reject the
252 * association attempt temporarily and start SA Query,
253 * if one is not pending.
254 */
255
256 if (sta->sa_query_count == 0)
257 ap_sta_start_sa_query(hapd, sta);
258
251#ifdef CONFIG_IEEE80211R
252 status = WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY;
253
254 p = hostapd_eid_assoc_comeback_time(hapd, sta, p);
255
256 hostapd_sta_assoc(hapd, addr, reassoc, status, buf,
257 p - buf);
259 status = WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY;
260
261 p = hostapd_eid_assoc_comeback_time(hapd, sta, p);
262
263 hostapd_sta_assoc(hapd, addr, reassoc, status, buf,
264 p - buf);
258#endif /* CONFIG_IEEE80211R */
259 return 0;
260 }
261
262 if (wpa_auth_uses_mfp(sta->wpa_sm))
263 sta->flags |= WLAN_STA_MFP;
264 else
265 sta->flags &= ~WLAN_STA_MFP;
266#endif /* CONFIG_IEEE80211W */

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

278 reason = WLAN_REASON_INVALID_IE;
279 goto fail;
280 }
281 }
282#endif /* CONFIG_IEEE80211R */
283 } else if (hapd->conf->wps_state) {
284#ifdef CONFIG_WPS
285 struct wpabuf *wps;
265 return 0;
266 }
267
268 if (wpa_auth_uses_mfp(sta->wpa_sm))
269 sta->flags |= WLAN_STA_MFP;
270 else
271 sta->flags &= ~WLAN_STA_MFP;
272#endif /* CONFIG_IEEE80211W */

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

284 reason = WLAN_REASON_INVALID_IE;
285 goto fail;
286 }
287 }
288#endif /* CONFIG_IEEE80211R */
289 } else if (hapd->conf->wps_state) {
290#ifdef CONFIG_WPS
291 struct wpabuf *wps;
292
286 if (req_ies)
287 wps = ieee802_11_vendor_ie_concat(req_ies, req_ies_len,
288 WPS_IE_VENDOR_TYPE);
289 else
290 wps = NULL;
291#ifdef CONFIG_WPS_STRICT
292 if (wps && wps_validate_assoc_req(wps) < 0) {
293 reason = WLAN_REASON_INVALID_IE;
294 status = WLAN_STATUS_INVALID_IE;
295 wpabuf_free(wps);
296 goto fail;
297 }
298#endif /* CONFIG_WPS_STRICT */
299 if (wps) {
300 sta->flags |= WLAN_STA_WPS;
301 if (wps_is_20(wps)) {
293 if (req_ies)
294 wps = ieee802_11_vendor_ie_concat(req_ies, req_ies_len,
295 WPS_IE_VENDOR_TYPE);
296 else
297 wps = NULL;
298#ifdef CONFIG_WPS_STRICT
299 if (wps && wps_validate_assoc_req(wps) < 0) {
300 reason = WLAN_REASON_INVALID_IE;
301 status = WLAN_STATUS_INVALID_IE;
302 wpabuf_free(wps);
303 goto fail;
304 }
305#endif /* CONFIG_WPS_STRICT */
306 if (wps) {
307 sta->flags |= WLAN_STA_WPS;
308 if (wps_is_20(wps)) {
302 wpa_printf(MSG_DEBUG, "WPS: STA supports "
303 "WPS 2.0");
309 wpa_printf(MSG_DEBUG,
310 "WPS: STA supports WPS 2.0");
304 sta->flags |= WLAN_STA_WPS2;
305 }
306 } else
307 sta->flags |= WLAN_STA_MAYBE_WPS;
308 wpabuf_free(wps);
309#endif /* CONFIG_WPS */
310#ifdef CONFIG_HS20
311 } else if (hapd->conf->osen) {

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

317 return WLAN_STATUS_INVALID_IE;
318 }
319
320 wpa_printf(MSG_DEBUG, "HS 2.0: OSEN association");
321 if (sta->wpa_sm == NULL)
322 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
323 sta->addr, NULL);
324 if (sta->wpa_sm == NULL) {
311 sta->flags |= WLAN_STA_WPS2;
312 }
313 } else
314 sta->flags |= WLAN_STA_MAYBE_WPS;
315 wpabuf_free(wps);
316#endif /* CONFIG_WPS */
317#ifdef CONFIG_HS20
318 } else if (hapd->conf->osen) {

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

324 return WLAN_STATUS_INVALID_IE;
325 }
326
327 wpa_printf(MSG_DEBUG, "HS 2.0: OSEN association");
328 if (sta->wpa_sm == NULL)
329 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
330 sta->addr, NULL);
331 if (sta->wpa_sm == NULL) {
325 wpa_printf(MSG_WARNING, "Failed to initialize WPA "
326 "state machine");
332 wpa_printf(MSG_WARNING,
333 "Failed to initialize WPA state machine");
327 return WLAN_STATUS_UNSPECIFIED_FAILURE;
328 }
329 if (wpa_validate_osen(hapd->wpa_auth, sta->wpa_sm,
330 elems.osen - 2, elems.osen_len + 2) < 0)
331 return WLAN_STATUS_INVALID_IE;
332#endif /* CONFIG_HS20 */
333 }
334#ifdef CONFIG_WPS

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

390 if (addr == NULL) {
391 /*
392 * This could potentially happen with unexpected event from the
393 * driver wrapper. This was seen at least in one case where the
394 * driver ended up reporting a station mode event while hostapd
395 * was running, so better make sure we stop processing such an
396 * event here.
397 */
334 return WLAN_STATUS_UNSPECIFIED_FAILURE;
335 }
336 if (wpa_validate_osen(hapd->wpa_auth, sta->wpa_sm,
337 elems.osen - 2, elems.osen_len + 2) < 0)
338 return WLAN_STATUS_INVALID_IE;
339#endif /* CONFIG_HS20 */
340 }
341#ifdef CONFIG_WPS

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

397 if (addr == NULL) {
398 /*
399 * This could potentially happen with unexpected event from the
400 * driver wrapper. This was seen at least in one case where the
401 * driver ended up reporting a station mode event while hostapd
402 * was running, so better make sure we stop processing such an
403 * event here.
404 */
398 wpa_printf(MSG_DEBUG, "hostapd_notif_disassoc: Skip event "
399 "with no address");
405 wpa_printf(MSG_DEBUG,
406 "hostapd_notif_disassoc: Skip event with no address");
400 return;
401 }
402
403 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
404 HOSTAPD_LEVEL_INFO, "disassociated");
405
406 sta = ap_get_sta(hapd, addr);
407 if (sta == NULL) {
407 return;
408 }
409
410 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
411 HOSTAPD_LEVEL_INFO, "disassociated");
412
413 sta = ap_get_sta(hapd, addr);
414 if (sta == NULL) {
408 wpa_printf(MSG_DEBUG, "Disassociation notification for "
409 "unknown STA " MACSTR, MAC2STR(addr));
415 wpa_printf(MSG_DEBUG,
416 "Disassociation notification for unknown STA "
417 MACSTR, MAC2STR(addr));
410 return;
411 }
412
413 ap_sta_set_authorized(hapd, sta, 0);
414 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
415 wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
416 sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
417 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);

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

422void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr)
423{
424 struct sta_info *sta = ap_get_sta(hapd, addr);
425
426 if (!sta || !hapd->conf->disassoc_low_ack)
427 return;
428
429 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
418 return;
419 }
420
421 ap_sta_set_authorized(hapd, sta, 0);
422 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
423 wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
424 sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
425 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);

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

430void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr)
431{
432 struct sta_info *sta = ap_get_sta(hapd, addr);
433
434 if (!sta || !hapd->conf->disassoc_low_ack)
435 return;
436
437 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
430 HOSTAPD_LEVEL_INFO, "disconnected due to excessive "
431 "missing ACKs");
438 HOSTAPD_LEVEL_INFO,
439 "disconnected due to excessive missing ACKs");
432 hostapd_drv_sta_disassoc(hapd, addr, WLAN_REASON_DISASSOC_LOW_ACK);
433 if (sta)
434 ap_sta_disassociate(hapd, sta, WLAN_REASON_DISASSOC_LOW_ACK);
435}
436
437
438void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
439 int offset, int width, int cf1, int cf2)

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

447 freq, ht, offset, width, channel_width_to_string(width),
448 cf1, cf2);
449
450 hapd->iface->freq = freq;
451
452 channel = hostapd_hw_get_channel(hapd, freq);
453 if (!channel) {
454 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
440 hostapd_drv_sta_disassoc(hapd, addr, WLAN_REASON_DISASSOC_LOW_ACK);
441 if (sta)
442 ap_sta_disassociate(hapd, sta, WLAN_REASON_DISASSOC_LOW_ACK);
443}
444
445
446void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
447 int offset, int width, int cf1, int cf2)

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

455 freq, ht, offset, width, channel_width_to_string(width),
456 cf1, cf2);
457
458 hapd->iface->freq = freq;
459
460 channel = hostapd_hw_get_channel(hapd, freq);
461 if (!channel) {
462 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
455 HOSTAPD_LEVEL_WARNING, "driver switched to "
456 "bad channel!");
463 HOSTAPD_LEVEL_WARNING,
464 "driver switched to bad channel!");
457 return;
458 }
459
460 switch (width) {
461 case CHAN_WIDTH_80:
462 chwidth = VHT_CHANWIDTH_80MHZ;
463 break;
464 case CHAN_WIDTH_80P80:

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

527 MAC2STR(addr));
528 break;
529 }
530}
531
532
533#ifdef CONFIG_ACS
534static void hostapd_acs_channel_selected(struct hostapd_data *hapd,
465 return;
466 }
467
468 switch (width) {
469 case CHAN_WIDTH_80:
470 chwidth = VHT_CHANWIDTH_80MHZ;
471 break;
472 case CHAN_WIDTH_80P80:

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

535 MAC2STR(addr));
536 break;
537 }
538}
539
540
541#ifdef CONFIG_ACS
542static void hostapd_acs_channel_selected(struct hostapd_data *hapd,
535 u8 pri_channel, u8 sec_channel)
543 struct acs_selected_channels *acs_res)
536{
544{
537 int channel;
538 int ret;
545 int ret, i;
539
540 if (hapd->iconf->channel) {
541 wpa_printf(MSG_INFO, "ACS: Channel was already set to %d",
542 hapd->iconf->channel);
543 return;
544 }
545
546
547 if (hapd->iconf->channel) {
548 wpa_printf(MSG_INFO, "ACS: Channel was already set to %d",
549 hapd->iconf->channel);
550 return;
551 }
552
546 hapd->iface->freq = hostapd_hw_get_freq(hapd, pri_channel);
553 if (!hapd->iface->current_mode) {
554 for (i = 0; i < hapd->iface->num_hw_features; i++) {
555 struct hostapd_hw_modes *mode =
556 &hapd->iface->hw_features[i];
547
557
548 channel = pri_channel;
549 if (!channel) {
558 if (mode->mode == acs_res->hw_mode) {
559 hapd->iface->current_mode = mode;
560 break;
561 }
562 }
563 if (!hapd->iface->current_mode) {
564 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
565 HOSTAPD_LEVEL_WARNING,
566 "driver selected to bad hw_mode");
567 return;
568 }
569 }
570
571 hapd->iface->freq = hostapd_hw_get_freq(hapd, acs_res->pri_channel);
572
573 if (!acs_res->pri_channel) {
550 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
551 HOSTAPD_LEVEL_WARNING,
552 "driver switched to bad channel");
553 return;
554 }
555
574 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
575 HOSTAPD_LEVEL_WARNING,
576 "driver switched to bad channel");
577 return;
578 }
579
556 hapd->iconf->channel = channel;
580 hapd->iconf->channel = acs_res->pri_channel;
581 hapd->iconf->acs = 1;
557
582
558 if (sec_channel == 0)
583 if (acs_res->sec_channel == 0)
559 hapd->iconf->secondary_channel = 0;
584 hapd->iconf->secondary_channel = 0;
560 else if (sec_channel < pri_channel)
585 else if (acs_res->sec_channel < acs_res->pri_channel)
561 hapd->iconf->secondary_channel = -1;
586 hapd->iconf->secondary_channel = -1;
562 else if (sec_channel > pri_channel)
587 else if (acs_res->sec_channel > acs_res->pri_channel)
563 hapd->iconf->secondary_channel = 1;
564 else {
565 wpa_printf(MSG_ERROR, "Invalid secondary channel!");
566 return;
567 }
568
588 hapd->iconf->secondary_channel = 1;
589 else {
590 wpa_printf(MSG_ERROR, "Invalid secondary channel!");
591 return;
592 }
593
594 if (hapd->iface->conf->ieee80211ac) {
595 /* set defaults for backwards compatibility */
596 hapd->iconf->vht_oper_centr_freq_seg1_idx = 0;
597 hapd->iconf->vht_oper_centr_freq_seg0_idx = 0;
598 hapd->iconf->vht_oper_chwidth = VHT_CHANWIDTH_USE_HT;
599 if (acs_res->ch_width == 80) {
600 hapd->iconf->vht_oper_centr_freq_seg0_idx =
601 acs_res->vht_seg0_center_ch;
602 hapd->iconf->vht_oper_chwidth = VHT_CHANWIDTH_80MHZ;
603 } else if (acs_res->ch_width == 160) {
604 if (acs_res->vht_seg1_center_ch == 0) {
605 hapd->iconf->vht_oper_centr_freq_seg0_idx =
606 acs_res->vht_seg0_center_ch;
607 hapd->iconf->vht_oper_chwidth =
608 VHT_CHANWIDTH_160MHZ;
609 } else {
610 hapd->iconf->vht_oper_centr_freq_seg0_idx =
611 acs_res->vht_seg0_center_ch;
612 hapd->iconf->vht_oper_centr_freq_seg1_idx =
613 acs_res->vht_seg1_center_ch;
614 hapd->iconf->vht_oper_chwidth =
615 VHT_CHANWIDTH_80P80MHZ;
616 }
617 }
618 }
619
569 ret = hostapd_acs_completed(hapd->iface, 0);
570 if (ret) {
571 wpa_printf(MSG_ERROR,
572 "ACS: Possibly channel configuration is invalid");
573 }
574}
575#endif /* CONFIG_ACS */
576

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

642 ieee802_1x_notify_pre_auth(sta->eapol_sm, 0);
643#ifdef CONFIG_IEEE80211R
644 if (rx_auth->auth_type == WLAN_AUTH_FT && hapd->wpa_auth) {
645 sta->auth_alg = WLAN_AUTH_FT;
646 if (sta->wpa_sm == NULL)
647 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
648 sta->addr, NULL);
649 if (sta->wpa_sm == NULL) {
620 ret = hostapd_acs_completed(hapd->iface, 0);
621 if (ret) {
622 wpa_printf(MSG_ERROR,
623 "ACS: Possibly channel configuration is invalid");
624 }
625}
626#endif /* CONFIG_ACS */
627

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

693 ieee802_1x_notify_pre_auth(sta->eapol_sm, 0);
694#ifdef CONFIG_IEEE80211R
695 if (rx_auth->auth_type == WLAN_AUTH_FT && hapd->wpa_auth) {
696 sta->auth_alg = WLAN_AUTH_FT;
697 if (sta->wpa_sm == NULL)
698 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
699 sta->addr, NULL);
700 if (sta->wpa_sm == NULL) {
650 wpa_printf(MSG_DEBUG, "FT: Failed to initialize WPA "
651 "state machine");
701 wpa_printf(MSG_DEBUG,
702 "FT: Failed to initialize WPA state machine");
652 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
653 goto fail;
654 }
655 wpa_ft_process_auth(sta->wpa_sm, rx_auth->bssid,
656 rx_auth->auth_transaction, rx_auth->ies,
657 rx_auth->ies_len,
658 hostapd_notify_auth_ft_finish, hapd);
659 return;

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

678
679 plen = drv_mgmt->frame_len - 24 - 1;
680
681 mgmt = (struct ieee80211_mgmt *) drv_mgmt->frame;
682 fc = le_to_host16(mgmt->frame_control);
683 if (WLAN_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ACTION)
684 return; /* handled by the driver */
685
703 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
704 goto fail;
705 }
706 wpa_ft_process_auth(sta->wpa_sm, rx_auth->bssid,
707 rx_auth->auth_transaction, rx_auth->ies,
708 rx_auth->ies_len,
709 hostapd_notify_auth_ft_finish, hapd);
710 return;

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

729
730 plen = drv_mgmt->frame_len - 24 - 1;
731
732 mgmt = (struct ieee80211_mgmt *) drv_mgmt->frame;
733 fc = le_to_host16(mgmt->frame_control);
734 if (WLAN_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ACTION)
735 return; /* handled by the driver */
736
686 wpa_printf(MSG_DEBUG, "RX_ACTION cat %d action plen %d",
737 wpa_printf(MSG_DEBUG, "RX_ACTION cat %d action plen %d",
687 mgmt->u.action.category, (int) plen);
688
689 sta = ap_get_sta(hapd, mgmt->sa);
690 if (sta == NULL) {
691 wpa_printf(MSG_DEBUG, "%s: station not found", __func__);
692 return;
693 }
694#ifdef CONFIG_IEEE80211R
695 if (mgmt->u.action.category == WLAN_ACTION_FT) {
696 const u8 *payload = drv_mgmt->frame + 24 + 1;
738 mgmt->u.action.category, (int) plen);
739
740 sta = ap_get_sta(hapd, mgmt->sa);
741 if (sta == NULL) {
742 wpa_printf(MSG_DEBUG, "%s: station not found", __func__);
743 return;
744 }
745#ifdef CONFIG_IEEE80211R
746 if (mgmt->u.action.category == WLAN_ACTION_FT) {
747 const u8 *payload = drv_mgmt->frame + 24 + 1;
748
697 wpa_ft_action_rx(sta->wpa_sm, payload, plen);
698 }
699#endif /* CONFIG_IEEE80211R */
700#ifdef CONFIG_IEEE80211W
701 if (mgmt->u.action.category == WLAN_ACTION_SA_QUERY && plen >= 4) {
702 ieee802_11_sa_query_action(
703 hapd, mgmt->sa,
704 mgmt->u.action.u.sa_query_resp.action,
705 mgmt->u.action.u.sa_query_resp.trans_id);
706 }
707#endif /* CONFIG_IEEE80211W */
708#ifdef CONFIG_WNM
709 if (mgmt->u.action.category == WLAN_ACTION_WNM) {
710 ieee802_11_rx_wnm_action_ap(hapd, mgmt, drv_mgmt->frame_len);
711 }
712#endif /* CONFIG_WNM */
749 wpa_ft_action_rx(sta->wpa_sm, payload, plen);
750 }
751#endif /* CONFIG_IEEE80211R */
752#ifdef CONFIG_IEEE80211W
753 if (mgmt->u.action.category == WLAN_ACTION_SA_QUERY && plen >= 4) {
754 ieee802_11_sa_query_action(
755 hapd, mgmt->sa,
756 mgmt->u.action.u.sa_query_resp.action,
757 mgmt->u.action.u.sa_query_resp.trans_id);
758 }
759#endif /* CONFIG_IEEE80211W */
760#ifdef CONFIG_WNM
761 if (mgmt->u.action.category == WLAN_ACTION_WNM) {
762 ieee802_11_rx_wnm_action_ap(hapd, mgmt, drv_mgmt->frame_len);
763 }
764#endif /* CONFIG_WNM */
765#ifdef CONFIG_FST
766 if (mgmt->u.action.category == WLAN_ACTION_FST && hapd->iface->fst) {
767 fst_rx_action(hapd->iface->fst, mgmt, drv_mgmt->frame_len);
768 return;
769 }
770#endif /* CONFIG_FST */
771
713}
714
715
716#ifdef NEED_AP_MLME
717
718#define HAPD_BROADCAST ((struct hostapd_data *) -1)
719
720static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface,

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

756 const u8 *bssid;
757 struct hostapd_frame_info fi;
758 int ret;
759
760#ifdef CONFIG_TESTING_OPTIONS
761 if (hapd->ext_mgmt_frame_handling) {
762 size_t hex_len = 2 * rx_mgmt->frame_len + 1;
763 char *hex = os_malloc(hex_len);
772}
773
774
775#ifdef NEED_AP_MLME
776
777#define HAPD_BROADCAST ((struct hostapd_data *) -1)
778
779static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface,

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

815 const u8 *bssid;
816 struct hostapd_frame_info fi;
817 int ret;
818
819#ifdef CONFIG_TESTING_OPTIONS
820 if (hapd->ext_mgmt_frame_handling) {
821 size_t hex_len = 2 * rx_mgmt->frame_len + 1;
822 char *hex = os_malloc(hex_len);
823
764 if (hex) {
765 wpa_snprintf_hex(hex, hex_len, rx_mgmt->frame,
766 rx_mgmt->frame_len);
767 wpa_msg(hapd->msg_ctx, MSG_INFO, "MGMT-RX %s", hex);
768 os_free(hex);
769 }
770 return 1;
771 }
772#endif /* CONFIG_TESTING_OPTIONS */
773
774 hdr = (const struct ieee80211_hdr *) rx_mgmt->frame;
775 bssid = get_hdr_bssid(hdr, rx_mgmt->frame_len);
776 if (bssid == NULL)
777 return 0;
778
779 hapd = get_hapd_bssid(iface, bssid);
780 if (hapd == NULL) {
824 if (hex) {
825 wpa_snprintf_hex(hex, hex_len, rx_mgmt->frame,
826 rx_mgmt->frame_len);
827 wpa_msg(hapd->msg_ctx, MSG_INFO, "MGMT-RX %s", hex);
828 os_free(hex);
829 }
830 return 1;
831 }
832#endif /* CONFIG_TESTING_OPTIONS */
833
834 hdr = (const struct ieee80211_hdr *) rx_mgmt->frame;
835 bssid = get_hdr_bssid(hdr, rx_mgmt->frame_len);
836 if (bssid == NULL)
837 return 0;
838
839 hapd = get_hapd_bssid(iface, bssid);
840 if (hapd == NULL) {
781 u16 fc;
782 fc = le_to_host16(hdr->frame_control);
841 u16 fc = le_to_host16(hdr->frame_control);
783
784 /*
785 * Drop frames to unknown BSSIDs except for Beacon frames which
786 * could be used to update neighbor information.
787 */
788 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
789 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
790 hapd = iface->bss[0];
791 else
792 return 0;
793 }
794
795 os_memset(&fi, 0, sizeof(fi));
796 fi.datarate = rx_mgmt->datarate;
797 fi.ssi_signal = rx_mgmt->ssi_signal;
798
799 if (hapd == HAPD_BROADCAST) {
800 size_t i;
842
843 /*
844 * Drop frames to unknown BSSIDs except for Beacon frames which
845 * could be used to update neighbor information.
846 */
847 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
848 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
849 hapd = iface->bss[0];
850 else
851 return 0;
852 }
853
854 os_memset(&fi, 0, sizeof(fi));
855 fi.datarate = rx_mgmt->datarate;
856 fi.ssi_signal = rx_mgmt->ssi_signal;
857
858 if (hapd == HAPD_BROADCAST) {
859 size_t i;
860
801 ret = 0;
802 for (i = 0; i < iface->num_bss; i++) {
803 /* if bss is set, driver will call this function for
804 * each bss individually. */
805 if (rx_mgmt->drv_priv &&
806 (iface->bss[i]->drv_priv != rx_mgmt->drv_priv))
807 continue;
808

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

819 return ret;
820}
821
822
823static void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, const u8 *buf,
824 size_t len, u16 stype, int ok)
825{
826 struct ieee80211_hdr *hdr;
861 ret = 0;
862 for (i = 0; i < iface->num_bss; i++) {
863 /* if bss is set, driver will call this function for
864 * each bss individually. */
865 if (rx_mgmt->drv_priv &&
866 (iface->bss[i]->drv_priv != rx_mgmt->drv_priv))
867 continue;
868

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

879 return ret;
880}
881
882
883static void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, const u8 *buf,
884 size_t len, u16 stype, int ok)
885{
886 struct ieee80211_hdr *hdr;
887
827 hdr = (struct ieee80211_hdr *) buf;
828 hapd = get_hapd_bssid(hapd->iface, get_hdr_bssid(hdr, len));
829 if (hapd == NULL || hapd == HAPD_BROADCAST)
830 return;
831 ieee802_11_mgmt_cb(hapd, buf, len, stype, ok);
832}
833
834#endif /* NEED_AP_MLME */
835
836
837static int hostapd_event_new_sta(struct hostapd_data *hapd, const u8 *addr)
838{
839 struct sta_info *sta = ap_get_sta(hapd, addr);
888 hdr = (struct ieee80211_hdr *) buf;
889 hapd = get_hapd_bssid(hapd->iface, get_hdr_bssid(hdr, len));
890 if (hapd == NULL || hapd == HAPD_BROADCAST)
891 return;
892 ieee802_11_mgmt_cb(hapd, buf, len, stype, ok);
893}
894
895#endif /* NEED_AP_MLME */
896
897
898static int hostapd_event_new_sta(struct hostapd_data *hapd, const u8 *addr)
899{
900 struct sta_info *sta = ap_get_sta(hapd, addr);
901
840 if (sta)
841 return 0;
842
843 wpa_printf(MSG_DEBUG, "Data frame from unknown STA " MACSTR
844 " - adding a new STA", MAC2STR(addr));
845 sta = ap_sta_add(hapd, addr);
846 if (sta) {
847 hostapd_new_assoc_sta(hapd, sta, 0);

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

858static void hostapd_event_eapol_rx(struct hostapd_data *hapd, const u8 *src,
859 const u8 *data, size_t data_len)
860{
861 struct hostapd_iface *iface = hapd->iface;
862 struct sta_info *sta;
863 size_t j;
864
865 for (j = 0; j < iface->num_bss; j++) {
902 if (sta)
903 return 0;
904
905 wpa_printf(MSG_DEBUG, "Data frame from unknown STA " MACSTR
906 " - adding a new STA", MAC2STR(addr));
907 sta = ap_sta_add(hapd, addr);
908 if (sta) {
909 hostapd_new_assoc_sta(hapd, sta, 0);

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

920static void hostapd_event_eapol_rx(struct hostapd_data *hapd, const u8 *src,
921 const u8 *data, size_t data_len)
922{
923 struct hostapd_iface *iface = hapd->iface;
924 struct sta_info *sta;
925 size_t j;
926
927 for (j = 0; j < iface->num_bss; j++) {
866 if ((sta = ap_get_sta(iface->bss[j], src))) {
867 if (sta->flags & WLAN_STA_ASSOC) {
868 hapd = iface->bss[j];
869 break;
870 }
928 sta = ap_get_sta(iface->bss[j], src);
929 if (sta && sta->flags & WLAN_STA_ASSOC) {
930 hapd = iface->bss[j];
931 break;
871 }
872 }
873
874 ieee802_1x_receive(hapd, src, data, data_len);
875}
876
877
878static struct hostapd_channel_data * hostapd_get_mode_channel(

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

922 list);
923 if (!survey || !survey->freq)
924 return;
925
926 chan = hostapd_get_mode_channel(iface, survey->freq);
927 if (!chan || chan->flag & HOSTAPD_CHAN_DISABLED)
928 return;
929
932 }
933 }
934
935 ieee802_1x_receive(hapd, src, data, data_len);
936}
937
938
939static struct hostapd_channel_data * hostapd_get_mode_channel(

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

983 list);
984 if (!survey || !survey->freq)
985 return;
986
987 chan = hostapd_get_mode_channel(iface, survey->freq);
988 if (!chan || chan->flag & HOSTAPD_CHAN_DISABLED)
989 return;
990
930 wpa_printf(MSG_DEBUG, "Single Channel Survey: (freq=%d channel_time=%ld channel_time_busy=%ld)",
991 wpa_printf(MSG_DEBUG,
992 "Single Channel Survey: (freq=%d channel_time=%ld channel_time_busy=%ld)",
931 survey->freq,
932 (unsigned long int) survey->channel_time,
933 (unsigned long int) survey->channel_time_busy);
934
935 if (survey->channel_time > iface->last_channel_time &&
936 survey->channel_time > survey->channel_time_busy) {
937 dividend = survey->channel_time_busy -
938 iface->last_channel_time_busy;

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

1056 struct hostapd_data *hapd = ctx;
1057#ifndef CONFIG_NO_STDOUT_DEBUG
1058 int level = MSG_DEBUG;
1059
1060 if (event == EVENT_RX_MGMT && data->rx_mgmt.frame &&
1061 data->rx_mgmt.frame_len >= 24) {
1062 const struct ieee80211_hdr *hdr;
1063 u16 fc;
993 survey->freq,
994 (unsigned long int) survey->channel_time,
995 (unsigned long int) survey->channel_time_busy);
996
997 if (survey->channel_time > iface->last_channel_time &&
998 survey->channel_time > survey->channel_time_busy) {
999 dividend = survey->channel_time_busy -
1000 iface->last_channel_time_busy;

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

1118 struct hostapd_data *hapd = ctx;
1119#ifndef CONFIG_NO_STDOUT_DEBUG
1120 int level = MSG_DEBUG;
1121
1122 if (event == EVENT_RX_MGMT && data->rx_mgmt.frame &&
1123 data->rx_mgmt.frame_len >= 24) {
1124 const struct ieee80211_hdr *hdr;
1125 u16 fc;
1126
1064 hdr = (const struct ieee80211_hdr *) data->rx_mgmt.frame;
1065 fc = le_to_host16(hdr->frame_control);
1066 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
1067 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
1068 level = MSG_EXCESSIVE;
1069 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
1070 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_PROBE_REQ)
1071 level = MSG_EXCESSIVE;

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

1243 break;
1244 case EVENT_INTERFACE_DISABLED:
1245 hostapd_free_stas(hapd);
1246 wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_DISABLED);
1247 hapd->disabled = 1;
1248 break;
1249#ifdef CONFIG_ACS
1250 case EVENT_ACS_CHANNEL_SELECTED:
1127 hdr = (const struct ieee80211_hdr *) data->rx_mgmt.frame;
1128 fc = le_to_host16(hdr->frame_control);
1129 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
1130 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
1131 level = MSG_EXCESSIVE;
1132 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
1133 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_PROBE_REQ)
1134 level = MSG_EXCESSIVE;

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

1306 break;
1307 case EVENT_INTERFACE_DISABLED:
1308 hostapd_free_stas(hapd);
1309 wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_DISABLED);
1310 hapd->disabled = 1;
1311 break;
1312#ifdef CONFIG_ACS
1313 case EVENT_ACS_CHANNEL_SELECTED:
1251 hostapd_acs_channel_selected(
1252 hapd, data->acs_selected_channels.pri_channel,
1253 data->acs_selected_channels.sec_channel);
1314 hostapd_acs_channel_selected(hapd,
1315 &data->acs_selected_channels);
1254 break;
1255#endif /* CONFIG_ACS */
1256 default:
1257 wpa_printf(MSG_DEBUG, "Unknown event %d", event);
1258 break;
1259 }
1260}
1261
1262#endif /* HOSTAPD */
1316 break;
1317#endif /* CONFIG_ACS */
1318 default:
1319 wpa_printf(MSG_DEBUG, "Unknown event %d", event);
1320 break;
1321 }
1322}
1323
1324#endif /* HOSTAPD */