]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/ap/drv_callbacks.c
Make channel parameters available in set_ap() driver operation
[thirdparty/hostap.git] / src / ap / drv_callbacks.c
CommitLineData
b5b969e9
JM
1/*
2 * hostapd / Callback functions for driver wrappers
94ddef3e 3 * Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi>
b5b969e9 4 *
0f3d578e
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
b5b969e9
JM
7 */
8
6226e38d 9#include "utils/includes.h"
b5b969e9 10
6226e38d 11#include "utils/common.h"
b5b969e9 12#include "radius/radius.h"
6e6e8c31 13#include "drivers/driver.h"
81f4f619 14#include "common/ieee802_11_defs.h"
c41a1095 15#include "common/ieee802_11_common.h"
3140803b 16#include "common/wpa_ctrl.h"
bbb921da 17#include "crypto/random.h"
ef796391 18#include "p2p/p2p.h"
54f489be 19#include "wps/wps.h"
d32d94db 20#include "wnm_ap.h"
6226e38d
JM
21#include "hostapd.h"
22#include "ieee802_11.h"
23#include "sta_info.h"
24#include "accounting.h"
25#include "tkip_countermeasures.h"
6226e38d
JM
26#include "ieee802_1x.h"
27#include "wpa_auth.h"
6226e38d 28#include "wps_hostapd.h"
51e2a27a 29#include "ap_drv_ops.h"
8b06c1ed 30#include "ap_config.h"
1b487b8b 31#include "hw_features.h"
e76da505 32#include "dfs.h"
b5b969e9
JM
33
34
b5b969e9 35int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
2bb20281 36 const u8 *req_ies, size_t req_ies_len, int reassoc)
b5b969e9
JM
37{
38 struct sta_info *sta;
39 int new_assoc, res;
c41a1095 40 struct ieee802_11_elems elems;
2bb20281
JM
41 const u8 *ie;
42 size_t ielen;
88b32a99
SP
43#ifdef CONFIG_IEEE80211R
44 u8 buf[sizeof(struct ieee80211_mgmt) + 1024];
45 u8 *p = buf;
46#endif /* CONFIG_IEEE80211R */
08a74e6a 47 u16 reason = WLAN_REASON_UNSPECIFIED;
88b32a99 48 u16 status = WLAN_STATUS_SUCCESS;
94ddef3e 49 const u8 *p2p_dev_addr = NULL;
b5b969e9 50
68532a9c
JM
51 if (addr == NULL) {
52 /*
53 * This could potentially happen with unexpected event from the
54 * driver wrapper. This was seen at least in one case where the
55 * driver ended up being set to station mode while hostapd was
56 * running, so better make sure we stop processing such an
57 * event here.
58 */
59 wpa_printf(MSG_DEBUG, "hostapd_notif_assoc: Skip event with "
60 "no address");
61 return -1;
62 }
bbb921da 63 random_add_randomness(addr, ETH_ALEN);
68532a9c 64
b5b969e9
JM
65 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
66 HOSTAPD_LEVEL_INFO, "associated");
67
2bb20281 68 ieee802_11_parse_elems(req_ies, req_ies_len, &elems, 0);
c41a1095
JM
69 if (elems.wps_ie) {
70 ie = elems.wps_ie - 2;
71 ielen = elems.wps_ie_len + 2;
72 wpa_printf(MSG_DEBUG, "STA included WPS IE in (Re)AssocReq");
73 } else if (elems.rsn_ie) {
74 ie = elems.rsn_ie - 2;
75 ielen = elems.rsn_ie_len + 2;
76 wpa_printf(MSG_DEBUG, "STA included RSN IE in (Re)AssocReq");
77 } else if (elems.wpa_ie) {
78 ie = elems.wpa_ie - 2;
79 ielen = elems.wpa_ie_len + 2;
80 wpa_printf(MSG_DEBUG, "STA included WPA IE in (Re)AssocReq");
a14896e8
JM
81#ifdef CONFIG_HS20
82 } else if (elems.osen) {
83 ie = elems.osen - 2;
84 ielen = elems.osen_len + 2;
85 wpa_printf(MSG_DEBUG, "STA included OSEN IE in (Re)AssocReq");
86#endif /* CONFIG_HS20 */
c41a1095
JM
87 } else {
88 ie = NULL;
89 ielen = 0;
90 wpa_printf(MSG_DEBUG, "STA did not include WPS/RSN/WPA IE in "
91 "(Re)AssocReq");
92 }
93
b5b969e9
JM
94 sta = ap_get_sta(hapd, addr);
95 if (sta) {
4331263b 96 ap_sta_no_session_timeout(hapd, sta);
b5b969e9 97 accounting_sta_stop(hapd, sta);
c72bd6d4
JM
98
99 /*
100 * Make sure that the previously registered inactivity timer
101 * will not remove the STA immediately.
102 */
103 sta->timeout_next = STA_NULLFUNC;
b5b969e9
JM
104 } else {
105 sta = ap_sta_add(hapd, addr);
8bd0fc0e
JM
106 if (sta == NULL) {
107 hostapd_drv_sta_disassoc(hapd, addr,
108 WLAN_REASON_DISASSOC_AP_BUSY);
b5b969e9 109 return -1;
8bd0fc0e 110 }
b5b969e9 111 }
17f6b900 112 sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS | WLAN_STA_WPS2);
b5b969e9 113
b305c684
JM
114#ifdef CONFIG_P2P
115 if (elems.p2p) {
116 wpabuf_free(sta->p2p_ie);
2bb20281 117 sta->p2p_ie = ieee802_11_vendor_ie_concat(req_ies, req_ies_len,
b305c684 118 P2P_IE_VENDOR_TYPE);
94ddef3e
JM
119 if (sta->p2p_ie)
120 p2p_dev_addr = p2p_get_go_dev_addr(sta->p2p_ie);
b305c684
JM
121 }
122#endif /* CONFIG_P2P */
123
c551700f
KP
124#ifdef CONFIG_INTERWORKING
125 if (elems.ext_capab && elems.ext_capab_len > 4) {
126 if (elems.ext_capab[4] & 0x01)
127 sta->qos_map_enabled = 1;
128 }
129#endif /* CONFIG_INTERWORKING */
130
f403dcd6
JM
131#ifdef CONFIG_HS20
132 wpabuf_free(sta->hs20_ie);
133 if (elems.hs20 && elems.hs20_len > 4) {
134 sta->hs20_ie = wpabuf_alloc_copy(elems.hs20 + 4,
135 elems.hs20_len - 4);
136 } else
137 sta->hs20_ie = NULL;
138#endif /* CONFIG_HS20 */
139
b5b969e9
JM
140 if (hapd->conf->wpa) {
141 if (ie == NULL || ielen == 0) {
633d4469 142#ifdef CONFIG_WPS
b5b969e9
JM
143 if (hapd->conf->wps_state) {
144 wpa_printf(MSG_DEBUG, "STA did not include "
145 "WPA/RSN IE in (Re)Association "
146 "Request - possible WPS use");
147 sta->flags |= WLAN_STA_MAYBE_WPS;
148 goto skip_wpa_check;
149 }
633d4469 150#endif /* CONFIG_WPS */
b5b969e9
JM
151
152 wpa_printf(MSG_DEBUG, "No WPA/RSN IE from STA");
153 return -1;
154 }
633d4469 155#ifdef CONFIG_WPS
b5b969e9
JM
156 if (hapd->conf->wps_state && ie[0] == 0xdd && ie[1] >= 4 &&
157 os_memcmp(ie + 2, "\x00\x50\xf2\x04", 4) == 0) {
17f6b900 158 struct wpabuf *wps;
b5b969e9 159 sta->flags |= WLAN_STA_WPS;
17f6b900
JM
160 wps = ieee802_11_vendor_ie_concat(ie, ielen,
161 WPS_IE_VENDOR_TYPE);
162 if (wps) {
163 if (wps_is_20(wps)) {
164 wpa_printf(MSG_DEBUG, "WPS: STA "
165 "supports WPS 2.0");
166 sta->flags |= WLAN_STA_WPS2;
167 }
168 wpabuf_free(wps);
169 }
b5b969e9
JM
170 goto skip_wpa_check;
171 }
633d4469 172#endif /* CONFIG_WPS */
b5b969e9
JM
173
174 if (sta->wpa_sm == NULL)
175 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
94ddef3e
JM
176 sta->addr,
177 p2p_dev_addr);
b5b969e9
JM
178 if (sta->wpa_sm == NULL) {
179 wpa_printf(MSG_ERROR, "Failed to initialize WPA state "
180 "machine");
181 return -1;
182 }
183 res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm,
88b32a99
SP
184 ie, ielen,
185 elems.mdie, elems.mdie_len);
b5b969e9
JM
186 if (res != WPA_IE_OK) {
187 wpa_printf(MSG_DEBUG, "WPA/RSN information element "
188 "rejected? (res %u)", res);
189 wpa_hexdump(MSG_DEBUG, "IE", ie, ielen);
88b32a99 190 if (res == WPA_INVALID_GROUP) {
08a74e6a 191 reason = WLAN_REASON_GROUP_CIPHER_NOT_VALID;
88b32a99
SP
192 status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID;
193 } else if (res == WPA_INVALID_PAIRWISE) {
08a74e6a 194 reason = WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID;
88b32a99
SP
195 status = WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID;
196 } else if (res == WPA_INVALID_AKMP) {
08a74e6a 197 reason = WLAN_REASON_AKMP_NOT_VALID;
88b32a99
SP
198 status = WLAN_STATUS_AKMP_NOT_VALID;
199 }
355d36a7 200#ifdef CONFIG_IEEE80211W
88b32a99 201 else if (res == WPA_MGMT_FRAME_PROTECTION_VIOLATION) {
08a74e6a 202 reason = WLAN_REASON_INVALID_IE;
88b32a99
SP
203 status = WLAN_STATUS_INVALID_IE;
204 } else if (res == WPA_INVALID_MGMT_GROUP_CIPHER) {
08a74e6a 205 reason = WLAN_REASON_GROUP_CIPHER_NOT_VALID;
88b32a99
SP
206 status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID;
207 }
355d36a7 208#endif /* CONFIG_IEEE80211W */
88b32a99 209 else {
08a74e6a 210 reason = WLAN_REASON_INVALID_IE;
88b32a99
SP
211 status = WLAN_STATUS_INVALID_IE;
212 }
08a74e6a 213 goto fail;
b5b969e9 214 }
7d9c0cd3
MP
215#ifdef CONFIG_IEEE80211W
216 if ((sta->flags & WLAN_STA_MFP) && !sta->sa_query_timed_out &&
217 sta->sa_query_count > 0)
218 ap_check_sa_query_timeout(hapd, sta);
219 if ((sta->flags & WLAN_STA_MFP) && !sta->sa_query_timed_out &&
220 (sta->auth_alg != WLAN_AUTH_FT)) {
221 /*
222 * STA has already been associated with MFP and SA
223 * Query timeout has not been reached. Reject the
224 * association attempt temporarily and start SA Query,
225 * if one is not pending.
226 */
227
228 if (sta->sa_query_count == 0)
229 ap_sta_start_sa_query(hapd, sta);
230
231#ifdef CONFIG_IEEE80211R
232 status = WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY;
233
234 p = hostapd_eid_assoc_comeback_time(hapd, sta, p);
235
236 hostapd_sta_assoc(hapd, addr, reassoc, status, buf,
237 p - buf);
238#endif /* CONFIG_IEEE80211R */
239 return 0;
240 }
241
242 if (wpa_auth_uses_mfp(sta->wpa_sm))
243 sta->flags |= WLAN_STA_MFP;
244 else
245 sta->flags &= ~WLAN_STA_MFP;
246#endif /* CONFIG_IEEE80211W */
247
88b32a99
SP
248#ifdef CONFIG_IEEE80211R
249 if (sta->auth_alg == WLAN_AUTH_FT) {
250 status = wpa_ft_validate_reassoc(sta->wpa_sm, req_ies,
251 req_ies_len);
252 if (status != WLAN_STATUS_SUCCESS) {
253 if (status == WLAN_STATUS_INVALID_PMKID)
254 reason = WLAN_REASON_INVALID_IE;
255 if (status == WLAN_STATUS_INVALID_MDIE)
256 reason = WLAN_REASON_INVALID_IE;
257 if (status == WLAN_STATUS_INVALID_FTIE)
258 reason = WLAN_REASON_INVALID_IE;
259 goto fail;
260 }
261 }
262#endif /* CONFIG_IEEE80211R */
a9aca28b 263 } else if (hapd->conf->wps_state) {
633d4469 264#ifdef CONFIG_WPS
17f6b900 265 struct wpabuf *wps;
2bb20281
JM
266 if (req_ies)
267 wps = ieee802_11_vendor_ie_concat(req_ies, req_ies_len,
fa15d405
JM
268 WPS_IE_VENDOR_TYPE);
269 else
270 wps = NULL;
54f489be 271#ifdef CONFIG_WPS_STRICT
fa15d405 272 if (wps && wps_validate_assoc_req(wps) < 0) {
08a74e6a 273 reason = WLAN_REASON_INVALID_IE;
88b32a99 274 status = WLAN_STATUS_INVALID_IE;
fa15d405 275 wpabuf_free(wps);
08a74e6a 276 goto fail;
54f489be 277 }
54f489be 278#endif /* CONFIG_WPS_STRICT */
fa15d405 279 if (wps) {
a9aca28b 280 sta->flags |= WLAN_STA_WPS;
fa15d405 281 if (wps_is_20(wps)) {
17f6b900
JM
282 wpa_printf(MSG_DEBUG, "WPS: STA supports "
283 "WPS 2.0");
284 sta->flags |= WLAN_STA_WPS2;
285 }
a9aca28b
JM
286 } else
287 sta->flags |= WLAN_STA_MAYBE_WPS;
17f6b900 288 wpabuf_free(wps);
633d4469 289#endif /* CONFIG_WPS */
a14896e8
JM
290#ifdef CONFIG_HS20
291 } else if (hapd->conf->osen) {
292 if (elems.osen == NULL) {
293 hostapd_logger(
294 hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
295 HOSTAPD_LEVEL_INFO,
296 "No HS 2.0 OSEN element in association request");
297 return WLAN_STATUS_INVALID_IE;
298 }
299
300 wpa_printf(MSG_DEBUG, "HS 2.0: OSEN association");
301 if (sta->wpa_sm == NULL)
302 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
303 sta->addr, NULL);
304 if (sta->wpa_sm == NULL) {
305 wpa_printf(MSG_WARNING, "Failed to initialize WPA "
306 "state machine");
307 return WLAN_STATUS_UNSPECIFIED_FAILURE;
308 }
309 if (wpa_validate_osen(hapd->wpa_auth, sta->wpa_sm,
310 elems.osen - 2, elems.osen_len + 2) < 0)
311 return WLAN_STATUS_INVALID_IE;
312#endif /* CONFIG_HS20 */
b5b969e9 313 }
633d4469 314#ifdef CONFIG_WPS
b5b969e9 315skip_wpa_check:
633d4469 316#endif /* CONFIG_WPS */
b5b969e9 317
88b32a99
SP
318#ifdef CONFIG_IEEE80211R
319 p = wpa_sm_write_assoc_resp_ies(sta->wpa_sm, buf, sizeof(buf),
320 sta->auth_alg, req_ies, req_ies_len);
321
322 hostapd_sta_assoc(hapd, addr, reassoc, status, buf, p - buf);
323#else /* CONFIG_IEEE80211R */
324 /* Keep compiler silent about unused variables */
325 if (status) {
326 }
327#endif /* CONFIG_IEEE80211R */
328
b5b969e9
JM
329 new_assoc = (sta->flags & WLAN_STA_ASSOC) == 0;
330 sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC;
3578e665 331 sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
88b32a99
SP
332
333 if (reassoc && (sta->auth_alg == WLAN_AUTH_FT))
334 wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC_FT);
335 else
336 wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC);
b5b969e9
JM
337
338 hostapd_new_assoc_sta(hapd, sta, !new_assoc);
339
340 ieee802_1x_notify_port_enabled(sta->eapol_sm, 1);
341
ef796391 342#ifdef CONFIG_P2P
99c01af9
JM
343 if (req_ies) {
344 p2p_group_notif_assoc(hapd->p2p_group, sta->addr,
345 req_ies, req_ies_len);
346 }
ef796391
JM
347#endif /* CONFIG_P2P */
348
b5b969e9 349 return 0;
08a74e6a
JM
350
351fail:
88b32a99
SP
352#ifdef CONFIG_IEEE80211R
353 hostapd_sta_assoc(hapd, addr, reassoc, status, buf, p - buf);
354#endif /* CONFIG_IEEE80211R */
08a74e6a
JM
355 hostapd_drv_sta_disassoc(hapd, sta->addr, reason);
356 ap_free_sta(hapd, sta);
357 return -1;
b5b969e9
JM
358}
359
360
361void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr)
362{
363 struct sta_info *sta;
364
83e843e8
JM
365 if (addr == NULL) {
366 /*
367 * This could potentially happen with unexpected event from the
368 * driver wrapper. This was seen at least in one case where the
369 * driver ended up reporting a station mode event while hostapd
370 * was running, so better make sure we stop processing such an
371 * event here.
372 */
373 wpa_printf(MSG_DEBUG, "hostapd_notif_disassoc: Skip event "
374 "with no address");
1f4c7b6b 375 return;
83e843e8
JM
376 }
377
b5b969e9
JM
378 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
379 HOSTAPD_LEVEL_INFO, "disassociated");
380
381 sta = ap_get_sta(hapd, addr);
382 if (sta == NULL) {
383 wpa_printf(MSG_DEBUG, "Disassociation notification for "
384 "unknown STA " MACSTR, MAC2STR(addr));
385 return;
386 }
387
ae055af4 388 ap_sta_set_authorized(hapd, sta, 0);
b5b969e9
JM
389 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
390 wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
391 sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
392 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
393 ap_free_sta(hapd, sta);
394}
395
396
0d7e5a3a
JB
397void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr)
398{
399 struct sta_info *sta = ap_get_sta(hapd, addr);
400
401 if (!sta || !hapd->conf->disassoc_low_ack)
402 return;
403
404 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
405 HOSTAPD_LEVEL_INFO, "disconnected due to excessive "
406 "missing ACKs");
407 hostapd_drv_sta_disassoc(hapd, addr, WLAN_REASON_DISASSOC_LOW_ACK);
408 if (sta)
409 ap_sta_disassociate(hapd, sta, WLAN_REASON_DISASSOC_LOW_ACK);
410}
411
412
1b487b8b 413void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
8d1fdde7 414 int offset, int width, int cf1, int cf2)
1b487b8b 415{
c7803a02 416#ifdef NEED_AP_MLME
8d1fdde7 417 int channel, chwidth, seg0_idx = 0, seg1_idx = 0;
1b487b8b
TP
418
419 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
420 HOSTAPD_LEVEL_INFO, "driver had channel switch: "
8d1fdde7
JD
421 "freq=%d, ht=%d, offset=%d, width=%d, cf1=%d, cf2=%d",
422 freq, ht, offset, width, cf1, cf2);
1b487b8b
TP
423
424 hapd->iface->freq = freq;
425
426 channel = hostapd_hw_get_channel(hapd, freq);
427 if (!channel) {
428 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
429 HOSTAPD_LEVEL_WARNING, "driver switched to "
430 "bad channel!");
431 return;
432 }
433
8d1fdde7
JD
434 switch (width) {
435 case CHAN_WIDTH_80:
436 chwidth = VHT_CHANWIDTH_80MHZ;
437 break;
438 case CHAN_WIDTH_80P80:
439 chwidth = VHT_CHANWIDTH_80P80MHZ;
440 break;
441 case CHAN_WIDTH_160:
442 chwidth = VHT_CHANWIDTH_160MHZ;
443 break;
444 case CHAN_WIDTH_20_NOHT:
445 case CHAN_WIDTH_20:
446 case CHAN_WIDTH_40:
447 default:
448 chwidth = VHT_CHANWIDTH_USE_HT;
449 break;
450 }
451
452 switch (hapd->iface->current_mode->mode) {
453 case HOSTAPD_MODE_IEEE80211A:
454 if (cf1 > 5000)
455 seg0_idx = (cf1 - 5000) / 5;
456 if (cf2 > 5000)
457 seg1_idx = (cf2 - 5000) / 5;
458 break;
459 default:
460 seg0_idx = hostapd_hw_get_channel(hapd, cf1);
461 seg1_idx = hostapd_hw_get_channel(hapd, cf2);
462 break;
463 }
464
1b487b8b
TP
465 hapd->iconf->channel = channel;
466 hapd->iconf->ieee80211n = ht;
467 hapd->iconf->secondary_channel = offset;
8d1fdde7
JD
468 hapd->iconf->vht_oper_chwidth = chwidth;
469 hapd->iconf->vht_oper_centr_freq_seg0_idx = seg0_idx;
470 hapd->iconf->vht_oper_centr_freq_seg1_idx = seg1_idx;
bf281c12 471
8f4713c5
AO
472 if (hapd->iface->csa_in_progress &&
473 freq == hapd->iface->cs_freq_params.freq) {
bf281c12
AO
474 hostapd_cleanup_cs_params(hapd);
475
476 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_CSA_FINISHED "freq=%d",
477 freq);
478 }
c7803a02 479#endif /* NEED_AP_MLME */
1b487b8b
TP
480}
481
482
3140803b
RM
483void hostapd_event_connect_failed_reason(struct hostapd_data *hapd,
484 const u8 *addr, int reason_code)
485{
486 switch (reason_code) {
487 case MAX_CLIENT_REACHED:
488 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_REJECTED_MAX_STA MACSTR,
489 MAC2STR(addr));
490 break;
491 case BLOCKED_CLIENT:
492 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_REJECTED_BLOCKED_STA MACSTR,
493 MAC2STR(addr));
494 break;
495 }
496}
497
498
04a85e44 499int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
baf513d6
JB
500 const u8 *bssid, const u8 *ie, size_t ie_len,
501 int ssi_signal)
e67b55fb
JM
502{
503 size_t i;
504 int ret = 0;
505
b211f3eb
JM
506 if (sa == NULL || ie == NULL)
507 return -1;
508
509 random_add_randomness(sa, ETH_ALEN);
e67b55fb
JM
510 for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++) {
511 if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
baf513d6
JB
512 sa, da, bssid, ie, ie_len,
513 ssi_signal) > 0) {
e67b55fb
JM
514 ret = 1;
515 break;
516 }
517 }
518 return ret;
519}
520
521
5c61a282
JM
522#ifdef HOSTAPD
523
88b32a99
SP
524#ifdef CONFIG_IEEE80211R
525static void hostapd_notify_auth_ft_finish(void *ctx, const u8 *dst,
526 const u8 *bssid,
527 u16 auth_transaction, u16 status,
528 const u8 *ies, size_t ies_len)
529{
530 struct hostapd_data *hapd = ctx;
531 struct sta_info *sta;
532
533 sta = ap_get_sta(hapd, dst);
534 if (sta == NULL)
535 return;
536
537 hostapd_logger(hapd, dst, HOSTAPD_MODULE_IEEE80211,
538 HOSTAPD_LEVEL_DEBUG, "authentication OK (FT)");
539 sta->flags |= WLAN_STA_AUTH;
540
541 hostapd_sta_auth(hapd, dst, auth_transaction, status, ies, ies_len);
542}
543#endif /* CONFIG_IEEE80211R */
544
545
88b32a99
SP
546static void hostapd_notif_auth(struct hostapd_data *hapd,
547 struct auth_info *rx_auth)
548{
549 struct sta_info *sta;
550 u16 status = WLAN_STATUS_SUCCESS;
551 u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN];
552 size_t resp_ies_len = 0;
553
554 sta = ap_get_sta(hapd, rx_auth->peer);
555 if (!sta) {
556 sta = ap_sta_add(hapd, rx_auth->peer);
557 if (sta == NULL) {
728d9717 558 status = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
88b32a99
SP
559 goto fail;
560 }
561 }
562 sta->flags &= ~WLAN_STA_PREAUTH;
563 ieee802_1x_notify_pre_auth(sta->eapol_sm, 0);
564#ifdef CONFIG_IEEE80211R
565 if (rx_auth->auth_type == WLAN_AUTH_FT && hapd->wpa_auth) {
566 sta->auth_alg = WLAN_AUTH_FT;
567 if (sta->wpa_sm == NULL)
568 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
94ddef3e 569 sta->addr, NULL);
88b32a99
SP
570 if (sta->wpa_sm == NULL) {
571 wpa_printf(MSG_DEBUG, "FT: Failed to initialize WPA "
572 "state machine");
573 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
574 goto fail;
575 }
576 wpa_ft_process_auth(sta->wpa_sm, rx_auth->bssid,
577 rx_auth->auth_transaction, rx_auth->ies,
578 rx_auth->ies_len,
579 hostapd_notify_auth_ft_finish, hapd);
580 return;
581 }
582#endif /* CONFIG_IEEE80211R */
583fail:
584 hostapd_sta_auth(hapd, rx_auth->peer, rx_auth->auth_transaction + 1,
585 status, resp_ies, resp_ies_len);
586}
587
588
589static void hostapd_action_rx(struct hostapd_data *hapd,
dbfb8e82 590 struct rx_mgmt *drv_mgmt)
88b32a99 591{
dbfb8e82 592 struct ieee80211_mgmt *mgmt;
88b32a99 593 struct sta_info *sta;
dbfb8e82
JM
594 size_t plen __maybe_unused;
595 u16 fc;
596
597 if (drv_mgmt->frame_len < 24 + 1)
598 return;
599
600 plen = drv_mgmt->frame_len - 24 - 1;
601
602 mgmt = (struct ieee80211_mgmt *) drv_mgmt->frame;
603 fc = le_to_host16(mgmt->frame_control);
604 if (WLAN_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ACTION)
605 return; /* handled by the driver */
88b32a99 606
7d9c0cd3 607 wpa_printf(MSG_DEBUG, "RX_ACTION cat %d action plen %d",
dbfb8e82 608 mgmt->u.action.category, (int) plen);
7d9c0cd3 609
dbfb8e82 610 sta = ap_get_sta(hapd, mgmt->sa);
88b32a99
SP
611 if (sta == NULL) {
612 wpa_printf(MSG_DEBUG, "%s: station not found", __func__);
613 return;
614 }
615#ifdef CONFIG_IEEE80211R
dbfb8e82
JM
616 if (mgmt->u.action.category == WLAN_ACTION_FT) {
617 const u8 *payload = drv_mgmt->frame + 24 + 1;
618 wpa_ft_action_rx(sta->wpa_sm, payload, plen);
88b32a99
SP
619 }
620#endif /* CONFIG_IEEE80211R */
7d9c0cd3 621#ifdef CONFIG_IEEE80211W
dbfb8e82
JM
622 if (mgmt->u.action.category == WLAN_ACTION_SA_QUERY && plen >= 4) {
623 ieee802_11_sa_query_action(
624 hapd, mgmt->sa,
625 mgmt->u.action.u.sa_query_resp.action,
626 mgmt->u.action.u.sa_query_resp.trans_id);
7d9c0cd3
MP
627 }
628#endif /* CONFIG_IEEE80211W */
ad3872a3 629#ifdef CONFIG_WNM
dbfb8e82
JM
630 if (mgmt->u.action.category == WLAN_ACTION_WNM) {
631 ieee802_11_rx_wnm_action_ap(hapd, mgmt, drv_mgmt->frame_len);
d32d94db 632 }
ad3872a3 633#endif /* CONFIG_WNM */
88b32a99
SP
634}
635
636
fe6bdb77 637#ifdef NEED_AP_MLME
f8b1f695 638
f8b1f695
JM
639#define HAPD_BROADCAST ((struct hostapd_data *) -1)
640
641static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface,
642 const u8 *bssid)
643{
644 size_t i;
645
646 if (bssid == NULL)
647 return NULL;
648 if (bssid[0] == 0xff && bssid[1] == 0xff && bssid[2] == 0xff &&
649 bssid[3] == 0xff && bssid[4] == 0xff && bssid[5] == 0xff)
650 return HAPD_BROADCAST;
651
652 for (i = 0; i < iface->num_bss; i++) {
653 if (os_memcmp(bssid, iface->bss[i]->own_addr, ETH_ALEN) == 0)
654 return iface->bss[i];
655 }
656
657 return NULL;
658}
659
660
661static void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
9b90955e
JB
662 const u8 *bssid, const u8 *addr,
663 int wds)
f8b1f695 664{
9b90955e 665 hapd = get_hapd_bssid(hapd->iface, bssid);
f8b1f695
JM
666 if (hapd == NULL || hapd == HAPD_BROADCAST)
667 return;
668
9b90955e 669 ieee802_11_rx_from_unknown(hapd, addr, wds);
f8b1f695
JM
670}
671
672
912b34f0 673static int hostapd_mgmt_rx(struct hostapd_data *hapd, struct rx_mgmt *rx_mgmt)
b5b969e9 674{
4b9841d3 675 struct hostapd_iface *iface = hapd->iface;
b57e086c 676 const struct ieee80211_hdr *hdr;
4b9841d3 677 const u8 *bssid;
2a8b7416 678 struct hostapd_frame_info fi;
912b34f0 679 int ret;
4b9841d3 680
5f7e1c06
JM
681#ifdef CONFIG_TESTING_OPTIONS
682 if (hapd->ext_mgmt_frame_handling) {
683 size_t hex_len = 2 * rx_mgmt->frame_len + 1;
684 char *hex = os_malloc(hex_len);
685 if (hex) {
686 wpa_snprintf_hex(hex, hex_len, rx_mgmt->frame,
687 rx_mgmt->frame_len);
688 wpa_msg(hapd->msg_ctx, MSG_INFO, "MGMT-RX %s", hex);
689 os_free(hex);
690 }
691 return 1;
692 }
693#endif /* CONFIG_TESTING_OPTIONS */
694
2a8b7416
JM
695 hdr = (const struct ieee80211_hdr *) rx_mgmt->frame;
696 bssid = get_hdr_bssid(hdr, rx_mgmt->frame_len);
4b9841d3 697 if (bssid == NULL)
912b34f0 698 return 0;
4b9841d3
JM
699
700 hapd = get_hapd_bssid(iface, bssid);
701 if (hapd == NULL) {
702 u16 fc;
703 fc = le_to_host16(hdr->frame_control);
704
705 /*
706 * Drop frames to unknown BSSIDs except for Beacon frames which
707 * could be used to update neighbor information.
708 */
709 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
710 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
711 hapd = iface->bss[0];
712 else
912b34f0 713 return 0;
4b9841d3
JM
714 }
715
2a8b7416
JM
716 os_memset(&fi, 0, sizeof(fi));
717 fi.datarate = rx_mgmt->datarate;
718 fi.ssi_signal = rx_mgmt->ssi_signal;
719
4b9841d3
JM
720 if (hapd == HAPD_BROADCAST) {
721 size_t i;
912b34f0
JM
722 ret = 0;
723 for (i = 0; i < iface->num_bss; i++) {
1d91f504
SW
724 /* if bss is set, driver will call this function for
725 * each bss individually. */
726 if (rx_mgmt->drv_priv &&
727 (iface->bss[i]->drv_priv != rx_mgmt->drv_priv))
728 continue;
729
912b34f0
JM
730 if (ieee802_11_mgmt(iface->bss[i], rx_mgmt->frame,
731 rx_mgmt->frame_len, &fi) > 0)
732 ret = 1;
733 }
4b9841d3 734 } else
912b34f0
JM
735 ret = ieee802_11_mgmt(hapd, rx_mgmt->frame, rx_mgmt->frame_len,
736 &fi);
bbb921da
JM
737
738 random_add_randomness(&fi, sizeof(fi));
912b34f0
JM
739
740 return ret;
b5b969e9
JM
741}
742
743
f8b1f695
JM
744static void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, const u8 *buf,
745 size_t len, u16 stype, int ok)
b5b969e9 746{
4b9841d3
JM
747 struct ieee80211_hdr *hdr;
748 hdr = (struct ieee80211_hdr *) buf;
749 hapd = get_hapd_bssid(hapd->iface, get_hdr_bssid(hdr, len));
750 if (hapd == NULL || hapd == HAPD_BROADCAST)
751 return;
b5b969e9
JM
752 ieee802_11_mgmt_cb(hapd, buf, len, stype, ok);
753}
f82ef4d8 754
f8b1f695 755#endif /* NEED_AP_MLME */
ad1e68e6
JM
756
757
a8e0505b
JM
758static int hostapd_event_new_sta(struct hostapd_data *hapd, const u8 *addr)
759{
760 struct sta_info *sta = ap_get_sta(hapd, addr);
761 if (sta)
762 return 0;
763
764 wpa_printf(MSG_DEBUG, "Data frame from unknown STA " MACSTR
765 " - adding a new STA", MAC2STR(addr));
766 sta = ap_sta_add(hapd, addr);
767 if (sta) {
768 hostapd_new_assoc_sta(hapd, sta, 0);
769 } else {
770 wpa_printf(MSG_DEBUG, "Failed to add STA entry for " MACSTR,
771 MAC2STR(addr));
772 return -1;
773 }
774
775 return 0;
776}
777
778
779static void hostapd_event_eapol_rx(struct hostapd_data *hapd, const u8 *src,
780 const u8 *data, size_t data_len)
781{
782 struct hostapd_iface *iface = hapd->iface;
f826635c 783 struct sta_info *sta;
a8e0505b
JM
784 size_t j;
785
786 for (j = 0; j < iface->num_bss; j++) {
f826635c
DB
787 if ((sta = ap_get_sta(iface->bss[j], src))) {
788 if (sta->flags & WLAN_STA_ASSOC) {
789 hapd = iface->bss[j];
790 break;
791 }
a8e0505b
JM
792 }
793 }
794
795 ieee802_1x_receive(hapd, src, data, data_len);
796}
797
798
0185007c
MK
799static struct hostapd_channel_data * hostapd_get_mode_channel(
800 struct hostapd_iface *iface, unsigned int freq)
801{
802 int i;
803 struct hostapd_channel_data *chan;
804
805 for (i = 0; i < iface->current_mode->num_channels; i++) {
806 chan = &iface->current_mode->channels[i];
807 if (!chan)
808 return NULL;
809 if ((unsigned int) chan->freq == freq)
810 return chan;
811 }
812
813 return NULL;
814}
815
816
817static void hostapd_update_nf(struct hostapd_iface *iface,
818 struct hostapd_channel_data *chan,
819 struct freq_survey *survey)
820{
821 if (!iface->chans_surveyed) {
822 chan->min_nf = survey->nf;
823 iface->lowest_nf = survey->nf;
824 } else {
825 if (dl_list_empty(&chan->survey_list))
826 chan->min_nf = survey->nf;
827 else if (survey->nf < chan->min_nf)
828 chan->min_nf = survey->nf;
829 if (survey->nf < iface->lowest_nf)
830 iface->lowest_nf = survey->nf;
831 }
832}
833
834
835static void hostapd_event_get_survey(struct hostapd_data *hapd,
836 struct survey_results *survey_results)
837{
838 struct hostapd_iface *iface = hapd->iface;
839 struct freq_survey *survey, *tmp;
840 struct hostapd_channel_data *chan;
841
842 if (dl_list_empty(&survey_results->survey_list)) {
843 wpa_printf(MSG_DEBUG, "No survey data received");
844 return;
845 }
846
847 dl_list_for_each_safe(survey, tmp, &survey_results->survey_list,
848 struct freq_survey, list) {
849 chan = hostapd_get_mode_channel(iface, survey->freq);
850 if (!chan)
851 continue;
852 if (chan->flag & HOSTAPD_CHAN_DISABLED)
853 continue;
854
855 dl_list_del(&survey->list);
856 dl_list_add_tail(&chan->survey_list, &survey->list);
857
858 hostapd_update_nf(iface, chan, survey);
859
860 iface->chans_surveyed++;
861 }
862}
863
864
e76da505
JD
865#ifdef NEED_AP_MLME
866
867static void hostapd_event_dfs_radar_detected(struct hostapd_data *hapd,
868 struct dfs_event *radar)
869{
e76da505 870 wpa_printf(MSG_DEBUG, "DFS radar detected on %d MHz", radar->freq);
dc036d9e 871 hostapd_dfs_radar_detected(hapd->iface, radar->freq, radar->ht_enabled,
58b73e3d
JD
872 radar->chan_offset, radar->chan_width,
873 radar->cf1, radar->cf2);
e76da505
JD
874}
875
876
877static void hostapd_event_dfs_cac_finished(struct hostapd_data *hapd,
878 struct dfs_event *radar)
879{
880 wpa_printf(MSG_DEBUG, "DFS CAC finished on %d MHz", radar->freq);
dc036d9e 881 hostapd_dfs_complete_cac(hapd->iface, 1, radar->freq, radar->ht_enabled,
58b73e3d
JD
882 radar->chan_offset, radar->chan_width,
883 radar->cf1, radar->cf2);
e76da505
JD
884}
885
886
887static void hostapd_event_dfs_cac_aborted(struct hostapd_data *hapd,
888 struct dfs_event *radar)
889{
890 wpa_printf(MSG_DEBUG, "DFS CAC aborted on %d MHz", radar->freq);
dc036d9e 891 hostapd_dfs_complete_cac(hapd->iface, 0, radar->freq, radar->ht_enabled,
58b73e3d
JD
892 radar->chan_offset, radar->chan_width,
893 radar->cf1, radar->cf2);
e76da505
JD
894}
895
896
897static void hostapd_event_dfs_nop_finished(struct hostapd_data *hapd,
898 struct dfs_event *radar)
899{
900 wpa_printf(MSG_DEBUG, "DFS NOP finished on %d MHz", radar->freq);
dc036d9e 901 hostapd_dfs_nop_finished(hapd->iface, radar->freq, radar->ht_enabled,
58b73e3d
JD
902 radar->chan_offset, radar->chan_width,
903 radar->cf1, radar->cf2);
e76da505
JD
904}
905
906#endif /* NEED_AP_MLME */
907
908
9646a8ab 909void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
ad1e68e6
JM
910 union wpa_event_data *data)
911{
912 struct hostapd_data *hapd = ctx;
74781dfc
JM
913#ifndef CONFIG_NO_STDOUT_DEBUG
914 int level = MSG_DEBUG;
ad1e68e6 915
34caf71a 916 if (event == EVENT_RX_MGMT && data->rx_mgmt.frame &&
74781dfc
JM
917 data->rx_mgmt.frame_len >= 24) {
918 const struct ieee80211_hdr *hdr;
919 u16 fc;
920 hdr = (const struct ieee80211_hdr *) data->rx_mgmt.frame;
921 fc = le_to_host16(hdr->frame_control);
922 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
923 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
924 level = MSG_EXCESSIVE;
cc2ada86
JM
925 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
926 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_PROBE_REQ)
927 level = MSG_EXCESSIVE;
74781dfc
JM
928 }
929
930 wpa_dbg(hapd->msg_ctx, level, "Event %s (%d) received",
e26cd1a1 931 event_to_string(event), event);
74781dfc 932#endif /* CONFIG_NO_STDOUT_DEBUG */
e26cd1a1 933
ad1e68e6
JM
934 switch (event) {
935 case EVENT_MICHAEL_MIC_FAILURE:
936 michael_mic_failure(hapd, data->michael_mic_failure.src, 1);
937 break;
938 case EVENT_SCAN_RESULTS:
939 if (hapd->iface->scan_cb)
940 hapd->iface->scan_cb(hapd->iface);
941 break;
08fd8c15 942#ifdef CONFIG_IEEE80211R
f2dab64e 943 case EVENT_FT_RRB_RX:
08fd8c15
JM
944 wpa_ft_rrb_rx(hapd->wpa_auth, data->ft_rrb_rx.src,
945 data->ft_rrb_rx.data, data->ft_rrb_rx.data_len);
946 break;
947#endif /* CONFIG_IEEE80211R */
fcf0f87d 948 case EVENT_WPS_BUTTON_PUSHED:
d601247c 949 hostapd_wps_button_pushed(hapd, NULL);
fcf0f87d 950 break;
f8b1f695
JM
951#ifdef NEED_AP_MLME
952 case EVENT_TX_STATUS:
953 switch (data->tx_status.type) {
954 case WLAN_FC_TYPE_MGMT:
955 hostapd_mgmt_tx_cb(hapd, data->tx_status.data,
956 data->tx_status.data_len,
957 data->tx_status.stype,
958 data->tx_status.ack);
959 break;
960 case WLAN_FC_TYPE_DATA:
961 hostapd_tx_status(hapd, data->tx_status.dst,
962 data->tx_status.data,
963 data->tx_status.data_len,
964 data->tx_status.ack);
965 break;
966 }
967 break;
dd840f79
JB
968 case EVENT_EAPOL_TX_STATUS:
969 hostapd_eapol_tx_status(hapd, data->eapol_tx_status.dst,
970 data->eapol_tx_status.data,
971 data->eapol_tx_status.data_len,
972 data->eapol_tx_status.ack);
973 break;
bcf24348
JB
974 case EVENT_DRIVER_CLIENT_POLL_OK:
975 hostapd_client_poll_ok(hapd, data->client_poll.addr);
976 break;
f8b1f695 977 case EVENT_RX_FROM_UNKNOWN:
9b90955e
JB
978 hostapd_rx_from_unknown_sta(hapd, data->rx_from_unknown.bssid,
979 data->rx_from_unknown.addr,
980 data->rx_from_unknown.wds);
f8b1f695 981 break;
dbfb8e82 982#endif /* NEED_AP_MLME */
f8b1f695 983 case EVENT_RX_MGMT:
dbfb8e82
JM
984#ifdef NEED_AP_MLME
985 if (hostapd_mgmt_rx(hapd, &data->rx_mgmt) > 0)
986 break;
f8b1f695 987#endif /* NEED_AP_MLME */
dbfb8e82
JM
988 hostapd_action_rx(hapd, &data->rx_mgmt);
989 break;
a0e0d3bb 990 case EVENT_RX_PROBE_REQ:
b211f3eb
JM
991 if (data->rx_probe_req.sa == NULL ||
992 data->rx_probe_req.ie == NULL)
993 break;
a0e0d3bb 994 hostapd_probe_req_rx(hapd, data->rx_probe_req.sa,
04a85e44
JM
995 data->rx_probe_req.da,
996 data->rx_probe_req.bssid,
a0e0d3bb 997 data->rx_probe_req.ie,
baf513d6
JB
998 data->rx_probe_req.ie_len,
999 data->rx_probe_req.ssi_signal);
a0e0d3bb 1000 break;
a70a5d6d 1001 case EVENT_NEW_STA:
a8e0505b
JM
1002 hostapd_event_new_sta(hapd, data->new_sta.addr);
1003 break;
1004 case EVENT_EAPOL_RX:
1005 hostapd_event_eapol_rx(hapd, data->eapol_rx.src,
1006 data->eapol_rx.data,
1007 data->eapol_rx.data_len);
1008 break;
1d041bec
JM
1009 case EVENT_ASSOC:
1010 hostapd_notif_assoc(hapd, data->assoc_info.addr,
1011 data->assoc_info.req_ies,
39b08b5f
SP
1012 data->assoc_info.req_ies_len,
1013 data->assoc_info.reassoc);
1d041bec
JM
1014 break;
1015 case EVENT_DISASSOC:
1016 if (data)
1017 hostapd_notif_disassoc(hapd, data->disassoc_info.addr);
1018 break;
1019 case EVENT_DEAUTH:
1020 if (data)
1021 hostapd_notif_disassoc(hapd, data->deauth_info.addr);
1022 break;
0d7e5a3a
JB
1023 case EVENT_STATION_LOW_ACK:
1024 if (!data)
1025 break;
1026 hostapd_event_sta_low_ack(hapd, data->low_ack.addr);
1027 break;
88b32a99
SP
1028 case EVENT_AUTH:
1029 hostapd_notif_auth(hapd, &data->auth);
1030 break;
1b487b8b
TP
1031 case EVENT_CH_SWITCH:
1032 if (!data)
1033 break;
1034 hostapd_event_ch_switch(hapd, data->ch_switch.freq,
1035 data->ch_switch.ht_enabled,
8d1fdde7
JD
1036 data->ch_switch.ch_offset,
1037 data->ch_switch.ch_width,
1038 data->ch_switch.cf1,
1039 data->ch_switch.cf2);
1b487b8b 1040 break;
3140803b
RM
1041 case EVENT_CONNECT_FAILED_REASON:
1042 if (!data)
1043 break;
1044 hostapd_event_connect_failed_reason(
1045 hapd, data->connect_failed_reason.addr,
1046 data->connect_failed_reason.code);
1047 break;
0185007c
MK
1048 case EVENT_SURVEY:
1049 hostapd_event_get_survey(hapd, &data->survey_results);
1050 break;
e76da505
JD
1051#ifdef NEED_AP_MLME
1052 case EVENT_DFS_RADAR_DETECTED:
1053 if (!data)
1054 break;
1055 hostapd_event_dfs_radar_detected(hapd, &data->dfs_event);
1056 break;
1057 case EVENT_DFS_CAC_FINISHED:
1058 if (!data)
1059 break;
1060 hostapd_event_dfs_cac_finished(hapd, &data->dfs_event);
1061 break;
1062 case EVENT_DFS_CAC_ABORTED:
1063 if (!data)
1064 break;
1065 hostapd_event_dfs_cac_aborted(hapd, &data->dfs_event);
1066 break;
1067 case EVENT_DFS_NOP_FINISHED:
1068 if (!data)
1069 break;
1070 hostapd_event_dfs_nop_finished(hapd, &data->dfs_event);
1071 break;
1072 case EVENT_CHANNEL_LIST_CHANGED:
1073 /* channel list changed (regulatory?), update channel list */
1074 /* TODO: check this. hostapd_get_hw_features() initializes
1075 * too much stuff. */
1076 /* hostapd_get_hw_features(hapd->iface); */
795baf77
AS
1077 hostapd_channel_list_updated(
1078 hapd->iface, data->channel_list_changed.initiator);
e76da505
JD
1079 break;
1080#endif /* NEED_AP_MLME */
ad1e68e6
JM
1081 default:
1082 wpa_printf(MSG_DEBUG, "Unknown event %d", event);
1083 break;
1084 }
1085}
f8b1f695
JM
1086
1087#endif /* HOSTAPD */