]> git.ipfire.org Git - thirdparty/hostap.git/blob - wpa_supplicant/events.c
Fix comment in wpa_supplicant_event_associnfo
[thirdparty/hostap.git] / wpa_supplicant / events.c
1 /*
2 * WPA Supplicant - Driver event processing
3 * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
15 #include "includes.h"
16
17 #include "common.h"
18 #include "eapol_supp/eapol_supp_sm.h"
19 #include "wpa.h"
20 #include "eloop.h"
21 #include "config.h"
22 #include "l2_packet/l2_packet.h"
23 #include "wpa_supplicant_i.h"
24 #include "driver_i.h"
25 #include "pcsc_funcs.h"
26 #include "preauth.h"
27 #include "pmksa_cache.h"
28 #include "wpa_ctrl.h"
29 #include "eap_peer/eap.h"
30 #include "ctrl_iface_dbus.h"
31 #include "ieee802_11_defs.h"
32 #include "blacklist.h"
33 #include "wpas_glue.h"
34 #include "wps_supplicant.h"
35 #include "ibss_rsn.h"
36 #include "sme.h"
37
38
39 static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
40 {
41 struct wpa_ssid *ssid;
42
43 if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid)
44 return 0;
45
46 wpa_printf(MSG_DEBUG, "Select network based on association "
47 "information");
48 ssid = wpa_supplicant_get_ssid(wpa_s);
49 if (ssid == NULL) {
50 wpa_printf(MSG_INFO, "No network configuration found for the "
51 "current AP");
52 return -1;
53 }
54
55 if (ssid->disabled) {
56 wpa_printf(MSG_DEBUG, "Selected network is disabled");
57 return -1;
58 }
59
60 wpa_printf(MSG_DEBUG, "Network configuration found for the current "
61 "AP");
62 if (ssid->key_mgmt & (WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_IEEE8021X |
63 WPA_KEY_MGMT_WPA_NONE |
64 WPA_KEY_MGMT_FT_PSK | WPA_KEY_MGMT_FT_IEEE8021X |
65 WPA_KEY_MGMT_PSK_SHA256 |
66 WPA_KEY_MGMT_IEEE8021X_SHA256)) {
67 u8 wpa_ie[80];
68 size_t wpa_ie_len = sizeof(wpa_ie);
69 wpa_supplicant_set_suites(wpa_s, NULL, ssid,
70 wpa_ie, &wpa_ie_len);
71 } else {
72 wpa_supplicant_set_non_wpa_policy(wpa_s, ssid);
73 }
74
75 if (wpa_s->current_ssid && wpa_s->current_ssid != ssid)
76 eapol_sm_invalidate_cached_session(wpa_s->eapol);
77 wpa_s->current_ssid = ssid;
78 wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
79 wpa_supplicant_initiate_eapol(wpa_s);
80
81 return 0;
82 }
83
84
85 static void wpa_supplicant_stop_countermeasures(void *eloop_ctx,
86 void *sock_ctx)
87 {
88 struct wpa_supplicant *wpa_s = eloop_ctx;
89
90 if (wpa_s->countermeasures) {
91 wpa_s->countermeasures = 0;
92 wpa_drv_set_countermeasures(wpa_s, 0);
93 wpa_msg(wpa_s, MSG_INFO, "WPA: TKIP countermeasures stopped");
94 wpa_supplicant_req_scan(wpa_s, 0, 0);
95 }
96 }
97
98
99 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
100 {
101 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
102 os_memset(wpa_s->bssid, 0, ETH_ALEN);
103 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
104 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
105 eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
106 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt))
107 eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);
108 wpa_s->ap_ies_from_associnfo = 0;
109 }
110
111
112 static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s)
113 {
114 struct wpa_ie_data ie;
115 int pmksa_set = -1;
116 size_t i;
117
118 if (wpa_sm_parse_own_wpa_ie(wpa_s->wpa, &ie) < 0 ||
119 ie.pmkid == NULL)
120 return;
121
122 for (i = 0; i < ie.num_pmkid; i++) {
123 pmksa_set = pmksa_cache_set_current(wpa_s->wpa,
124 ie.pmkid + i * PMKID_LEN,
125 NULL, NULL, 0);
126 if (pmksa_set == 0) {
127 eapol_sm_notify_pmkid_attempt(wpa_s->eapol, 1);
128 break;
129 }
130 }
131
132 wpa_printf(MSG_DEBUG, "RSN: PMKID from assoc IE %sfound from PMKSA "
133 "cache", pmksa_set == 0 ? "" : "not ");
134 }
135
136
137 static void wpa_supplicant_event_pmkid_candidate(struct wpa_supplicant *wpa_s,
138 union wpa_event_data *data)
139 {
140 if (data == NULL) {
141 wpa_printf(MSG_DEBUG, "RSN: No data in PMKID candidate event");
142 return;
143 }
144 wpa_printf(MSG_DEBUG, "RSN: PMKID candidate event - bssid=" MACSTR
145 " index=%d preauth=%d",
146 MAC2STR(data->pmkid_candidate.bssid),
147 data->pmkid_candidate.index,
148 data->pmkid_candidate.preauth);
149
150 pmksa_candidate_add(wpa_s->wpa, data->pmkid_candidate.bssid,
151 data->pmkid_candidate.index,
152 data->pmkid_candidate.preauth);
153 }
154
155
156 static int wpa_supplicant_dynamic_keys(struct wpa_supplicant *wpa_s)
157 {
158 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
159 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE)
160 return 0;
161
162 #ifdef IEEE8021X_EAPOL
163 if (wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA &&
164 wpa_s->current_ssid &&
165 !(wpa_s->current_ssid->eapol_flags &
166 (EAPOL_FLAG_REQUIRE_KEY_UNICAST |
167 EAPOL_FLAG_REQUIRE_KEY_BROADCAST))) {
168 /* IEEE 802.1X, but not using dynamic WEP keys (i.e., either
169 * plaintext or static WEP keys). */
170 return 0;
171 }
172 #endif /* IEEE8021X_EAPOL */
173
174 return 1;
175 }
176
177
178 /**
179 * wpa_supplicant_scard_init - Initialize SIM/USIM access with PC/SC
180 * @wpa_s: pointer to wpa_supplicant data
181 * @ssid: Configuration data for the network
182 * Returns: 0 on success, -1 on failure
183 *
184 * This function is called when starting authentication with a network that is
185 * configured to use PC/SC for SIM/USIM access (EAP-SIM or EAP-AKA).
186 */
187 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
188 struct wpa_ssid *ssid)
189 {
190 #ifdef IEEE8021X_EAPOL
191 int aka = 0, sim = 0, type;
192
193 if (ssid->eap.pcsc == NULL || wpa_s->scard != NULL)
194 return 0;
195
196 if (ssid->eap.eap_methods == NULL) {
197 sim = 1;
198 aka = 1;
199 } else {
200 struct eap_method_type *eap = ssid->eap.eap_methods;
201 while (eap->vendor != EAP_VENDOR_IETF ||
202 eap->method != EAP_TYPE_NONE) {
203 if (eap->vendor == EAP_VENDOR_IETF) {
204 if (eap->method == EAP_TYPE_SIM)
205 sim = 1;
206 else if (eap->method == EAP_TYPE_AKA)
207 aka = 1;
208 }
209 eap++;
210 }
211 }
212
213 if (eap_peer_get_eap_method(EAP_VENDOR_IETF, EAP_TYPE_SIM) == NULL)
214 sim = 0;
215 if (eap_peer_get_eap_method(EAP_VENDOR_IETF, EAP_TYPE_AKA) == NULL)
216 aka = 0;
217
218 if (!sim && !aka) {
219 wpa_printf(MSG_DEBUG, "Selected network is configured to use "
220 "SIM, but neither EAP-SIM nor EAP-AKA are enabled");
221 return 0;
222 }
223
224 wpa_printf(MSG_DEBUG, "Selected network is configured to use SIM "
225 "(sim=%d aka=%d) - initialize PCSC", sim, aka);
226 if (sim && aka)
227 type = SCARD_TRY_BOTH;
228 else if (aka)
229 type = SCARD_USIM_ONLY;
230 else
231 type = SCARD_GSM_SIM_ONLY;
232
233 wpa_s->scard = scard_init(type);
234 if (wpa_s->scard == NULL) {
235 wpa_printf(MSG_WARNING, "Failed to initialize SIM "
236 "(pcsc-lite)");
237 return -1;
238 }
239 wpa_sm_set_scard_ctx(wpa_s->wpa, wpa_s->scard);
240 eapol_sm_register_scard_ctx(wpa_s->eapol, wpa_s->scard);
241 #endif /* IEEE8021X_EAPOL */
242
243 return 0;
244 }
245
246
247 #ifndef CONFIG_NO_SCAN_PROCESSING
248 static int wpa_supplicant_match_privacy(struct wpa_scan_res *bss,
249 struct wpa_ssid *ssid)
250 {
251 int i, privacy = 0;
252
253 if (ssid->mixed_cell)
254 return 1;
255
256 #ifdef CONFIG_WPS
257 if (ssid->key_mgmt & WPA_KEY_MGMT_WPS)
258 return 1;
259 #endif /* CONFIG_WPS */
260
261 for (i = 0; i < NUM_WEP_KEYS; i++) {
262 if (ssid->wep_key_len[i]) {
263 privacy = 1;
264 break;
265 }
266 }
267 #ifdef IEEE8021X_EAPOL
268 if ((ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) &&
269 ssid->eapol_flags & (EAPOL_FLAG_REQUIRE_KEY_UNICAST |
270 EAPOL_FLAG_REQUIRE_KEY_BROADCAST))
271 privacy = 1;
272 #endif /* IEEE8021X_EAPOL */
273
274 if (bss->caps & IEEE80211_CAP_PRIVACY)
275 return privacy;
276 return !privacy;
277 }
278
279
280 static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
281 struct wpa_ssid *ssid,
282 struct wpa_scan_res *bss)
283 {
284 struct wpa_ie_data ie;
285 int proto_match = 0;
286 const u8 *rsn_ie, *wpa_ie;
287 int ret;
288
289 ret = wpas_wps_ssid_bss_match(wpa_s, ssid, bss);
290 if (ret >= 0)
291 return ret;
292
293 rsn_ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
294 while ((ssid->proto & WPA_PROTO_RSN) && rsn_ie) {
295 proto_match++;
296
297 if (wpa_parse_wpa_ie(rsn_ie, 2 + rsn_ie[1], &ie)) {
298 wpa_printf(MSG_DEBUG, " skip RSN IE - parse failed");
299 break;
300 }
301 if (!(ie.proto & ssid->proto)) {
302 wpa_printf(MSG_DEBUG, " skip RSN IE - proto "
303 "mismatch");
304 break;
305 }
306
307 if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) {
308 wpa_printf(MSG_DEBUG, " skip RSN IE - PTK cipher "
309 "mismatch");
310 break;
311 }
312
313 if (!(ie.group_cipher & ssid->group_cipher)) {
314 wpa_printf(MSG_DEBUG, " skip RSN IE - GTK cipher "
315 "mismatch");
316 break;
317 }
318
319 if (!(ie.key_mgmt & ssid->key_mgmt)) {
320 wpa_printf(MSG_DEBUG, " skip RSN IE - key mgmt "
321 "mismatch");
322 break;
323 }
324
325 #ifdef CONFIG_IEEE80211W
326 if (!(ie.capabilities & WPA_CAPABILITY_MFPC) &&
327 ssid->ieee80211w == IEEE80211W_REQUIRED) {
328 wpa_printf(MSG_DEBUG, " skip RSN IE - no mgmt frame "
329 "protection");
330 break;
331 }
332 #endif /* CONFIG_IEEE80211W */
333
334 wpa_printf(MSG_DEBUG, " selected based on RSN IE");
335 return 1;
336 }
337
338 wpa_ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
339 while ((ssid->proto & WPA_PROTO_WPA) && wpa_ie) {
340 proto_match++;
341
342 if (wpa_parse_wpa_ie(wpa_ie, 2 + wpa_ie[1], &ie)) {
343 wpa_printf(MSG_DEBUG, " skip WPA IE - parse failed");
344 break;
345 }
346 if (!(ie.proto & ssid->proto)) {
347 wpa_printf(MSG_DEBUG, " skip WPA IE - proto "
348 "mismatch");
349 break;
350 }
351
352 if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) {
353 wpa_printf(MSG_DEBUG, " skip WPA IE - PTK cipher "
354 "mismatch");
355 break;
356 }
357
358 if (!(ie.group_cipher & ssid->group_cipher)) {
359 wpa_printf(MSG_DEBUG, " skip WPA IE - GTK cipher "
360 "mismatch");
361 break;
362 }
363
364 if (!(ie.key_mgmt & ssid->key_mgmt)) {
365 wpa_printf(MSG_DEBUG, " skip WPA IE - key mgmt "
366 "mismatch");
367 break;
368 }
369
370 wpa_printf(MSG_DEBUG, " selected based on WPA IE");
371 return 1;
372 }
373
374 if (proto_match == 0)
375 wpa_printf(MSG_DEBUG, " skip - no WPA/RSN proto match");
376
377 return 0;
378 }
379
380
381 static struct wpa_scan_res *
382 wpa_supplicant_select_bss_wpa(struct wpa_supplicant *wpa_s,
383 struct wpa_ssid *group,
384 struct wpa_ssid **selected_ssid)
385 {
386 struct wpa_ssid *ssid;
387 struct wpa_scan_res *bss;
388 size_t i;
389 struct wpa_blacklist *e;
390 const u8 *ie;
391
392 wpa_printf(MSG_DEBUG, "Try to find WPA-enabled AP");
393 for (i = 0; i < wpa_s->scan_res->num; i++) {
394 const u8 *ssid_;
395 u8 wpa_ie_len, rsn_ie_len, ssid_len;
396 bss = wpa_s->scan_res->res[i];
397
398 ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
399 ssid_ = ie ? ie + 2 : (u8 *) "";
400 ssid_len = ie ? ie[1] : 0;
401
402 ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
403 wpa_ie_len = ie ? ie[1] : 0;
404
405 ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
406 rsn_ie_len = ie ? ie[1] : 0;
407
408 wpa_printf(MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
409 "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x",
410 (int) i, MAC2STR(bss->bssid),
411 wpa_ssid_txt(ssid_, ssid_len),
412 wpa_ie_len, rsn_ie_len, bss->caps);
413
414 e = wpa_blacklist_get(wpa_s, bss->bssid);
415 if (e && e->count > 1) {
416 wpa_printf(MSG_DEBUG, " skip - blacklisted");
417 continue;
418 }
419
420 if (wpa_ie_len == 0 && rsn_ie_len == 0) {
421 wpa_printf(MSG_DEBUG, " skip - no WPA/RSN IE");
422 continue;
423 }
424
425 for (ssid = group; ssid; ssid = ssid->pnext) {
426 int check_ssid = 1;
427
428 if (ssid->disabled) {
429 wpa_printf(MSG_DEBUG, " skip - disabled");
430 continue;
431 }
432
433 #ifdef CONFIG_WPS
434 if (ssid->ssid_len == 0 &&
435 wpas_wps_ssid_wildcard_ok(wpa_s, ssid, bss))
436 check_ssid = 0;
437 #endif /* CONFIG_WPS */
438
439 if (check_ssid &&
440 (ssid_len != ssid->ssid_len ||
441 os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
442 wpa_printf(MSG_DEBUG, " skip - "
443 "SSID mismatch");
444 continue;
445 }
446
447 if (ssid->bssid_set &&
448 os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) != 0)
449 {
450 wpa_printf(MSG_DEBUG, " skip - "
451 "BSSID mismatch");
452 continue;
453 }
454
455 if (!wpa_supplicant_ssid_bss_match(wpa_s, ssid, bss))
456 continue;
457
458 wpa_printf(MSG_DEBUG, " selected WPA AP "
459 MACSTR " ssid='%s'",
460 MAC2STR(bss->bssid),
461 wpa_ssid_txt(ssid_, ssid_len));
462 *selected_ssid = ssid;
463 return bss;
464 }
465 }
466
467 return NULL;
468 }
469
470
471 static struct wpa_scan_res *
472 wpa_supplicant_select_bss_non_wpa(struct wpa_supplicant *wpa_s,
473 struct wpa_ssid *group,
474 struct wpa_ssid **selected_ssid)
475 {
476 struct wpa_ssid *ssid;
477 struct wpa_scan_res *bss;
478 size_t i;
479 struct wpa_blacklist *e;
480 const u8 *ie;
481
482 wpa_printf(MSG_DEBUG, "Try to find non-WPA AP");
483 for (i = 0; i < wpa_s->scan_res->num; i++) {
484 const u8 *ssid_;
485 u8 wpa_ie_len, rsn_ie_len, ssid_len;
486 bss = wpa_s->scan_res->res[i];
487
488 ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
489 ssid_ = ie ? ie + 2 : (u8 *) "";
490 ssid_len = ie ? ie[1] : 0;
491
492 ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
493 wpa_ie_len = ie ? ie[1] : 0;
494
495 ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
496 rsn_ie_len = ie ? ie[1] : 0;
497
498 wpa_printf(MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
499 "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x",
500 (int) i, MAC2STR(bss->bssid),
501 wpa_ssid_txt(ssid_, ssid_len),
502 wpa_ie_len, rsn_ie_len, bss->caps);
503
504 e = wpa_blacklist_get(wpa_s, bss->bssid);
505 if (e && e->count > 1) {
506 wpa_printf(MSG_DEBUG, " skip - blacklisted");
507 continue;
508 }
509
510 for (ssid = group; ssid; ssid = ssid->pnext) {
511 int check_ssid = ssid->ssid_len != 0;
512
513 if (ssid->disabled) {
514 wpa_printf(MSG_DEBUG, " skip - disabled");
515 continue;
516 }
517
518 #ifdef CONFIG_WPS
519 if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
520 /* Only allow wildcard SSID match if an AP
521 * advertises active WPS operation that matches
522 * with our mode. */
523 check_ssid = 1;
524 if (ssid->ssid_len == 0 &&
525 wpas_wps_ssid_wildcard_ok(wpa_s, ssid,
526 bss))
527 check_ssid = 0;
528 }
529 #endif /* CONFIG_WPS */
530
531 if (check_ssid &&
532 (ssid_len != ssid->ssid_len ||
533 os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
534 wpa_printf(MSG_DEBUG, " skip - "
535 "SSID mismatch");
536 continue;
537 }
538
539 if (ssid->bssid_set &&
540 os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) != 0)
541 {
542 wpa_printf(MSG_DEBUG, " skip - "
543 "BSSID mismatch");
544 continue;
545 }
546
547 if (!(ssid->key_mgmt & WPA_KEY_MGMT_NONE) &&
548 !(ssid->key_mgmt & WPA_KEY_MGMT_WPS) &&
549 !(ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA))
550 {
551 wpa_printf(MSG_DEBUG, " skip - "
552 "non-WPA network not allowed");
553 continue;
554 }
555
556 if ((ssid->key_mgmt &
557 (WPA_KEY_MGMT_IEEE8021X | WPA_KEY_MGMT_PSK |
558 WPA_KEY_MGMT_FT_IEEE8021X | WPA_KEY_MGMT_FT_PSK |
559 WPA_KEY_MGMT_IEEE8021X_SHA256 |
560 WPA_KEY_MGMT_PSK_SHA256)) &&
561 (wpa_ie_len != 0 || rsn_ie_len != 0)) {
562 wpa_printf(MSG_DEBUG, " skip - "
563 "WPA network");
564 continue;
565 }
566
567 if (!wpa_supplicant_match_privacy(bss, ssid)) {
568 wpa_printf(MSG_DEBUG, " skip - "
569 "privacy mismatch");
570 continue;
571 }
572
573 if (bss->caps & IEEE80211_CAP_IBSS) {
574 wpa_printf(MSG_DEBUG, " skip - "
575 "IBSS (adhoc) network");
576 continue;
577 }
578
579 wpa_printf(MSG_DEBUG, " selected non-WPA AP "
580 MACSTR " ssid='%s'",
581 MAC2STR(bss->bssid),
582 wpa_ssid_txt(ssid_, ssid_len));
583 *selected_ssid = ssid;
584 return bss;
585 }
586 }
587
588 return NULL;
589 }
590
591
592 static struct wpa_scan_res *
593 wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, struct wpa_ssid *group,
594 struct wpa_ssid **selected_ssid)
595 {
596 struct wpa_scan_res *selected;
597
598 wpa_printf(MSG_DEBUG, "Selecting BSS from priority group %d",
599 group->priority);
600
601 /* First, try to find WPA-enabled AP */
602 selected = wpa_supplicant_select_bss_wpa(wpa_s, group, selected_ssid);
603 if (selected)
604 return selected;
605
606 /* If no WPA-enabled AP found, try to find non-WPA AP, if configuration
607 * allows this. */
608 return wpa_supplicant_select_bss_non_wpa(wpa_s, group, selected_ssid);
609 }
610
611
612 static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s)
613 {
614 int prio, timeout;
615 struct wpa_scan_res *selected = NULL;
616 struct wpa_ssid *ssid = NULL;
617
618 wpa_supplicant_notify_scanning(wpa_s, 0);
619
620 if (wpa_supplicant_get_scan_results(wpa_s) < 0) {
621 if (wpa_s->conf->ap_scan == 2)
622 return;
623 wpa_printf(MSG_DEBUG, "Failed to get scan results - try "
624 "scanning again");
625 timeout = 1;
626 goto req_scan;
627 }
628
629 /*
630 * Don't post the results if this was the initial cached
631 * and there were no results.
632 */
633 if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1 &&
634 wpa_s->scan_res->num == 0) {
635 wpa_msg(wpa_s, MSG_DEBUG, "Cached scan results are "
636 "empty - not posting");
637 } else {
638 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
639 wpa_supplicant_dbus_notify_scan_results(wpa_s);
640 wpas_wps_notify_scan_results(wpa_s);
641 }
642
643 if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s)) ||
644 wpa_s->disconnected)
645 return;
646
647 while (selected == NULL) {
648 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
649 selected = wpa_supplicant_select_bss(
650 wpa_s, wpa_s->conf->pssid[prio], &ssid);
651 if (selected)
652 break;
653 }
654
655 if (selected == NULL && wpa_s->blacklist) {
656 wpa_printf(MSG_DEBUG, "No APs found - clear blacklist "
657 "and try again");
658 wpa_blacklist_clear(wpa_s);
659 wpa_s->blacklist_cleared++;
660 } else if (selected == NULL) {
661 break;
662 }
663 }
664
665 if (selected) {
666 if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) {
667 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP
668 "PBC session overlap");
669 timeout = 10;
670 goto req_scan;
671 }
672
673 /* Do not trigger new association unless the BSSID has changed
674 * or if reassociation is requested. If we are in process of
675 * associating with the selected BSSID, do not trigger new
676 * attempt. */
677 if (wpa_s->reassociate ||
678 (os_memcmp(selected->bssid, wpa_s->bssid, ETH_ALEN) != 0 &&
679 (wpa_s->wpa_state != WPA_ASSOCIATING ||
680 os_memcmp(selected->bssid, wpa_s->pending_bssid,
681 ETH_ALEN) != 0))) {
682 if (wpa_supplicant_scard_init(wpa_s, ssid)) {
683 wpa_supplicant_req_scan(wpa_s, 10, 0);
684 return;
685 }
686 wpa_supplicant_associate(wpa_s, selected, ssid);
687 } else {
688 wpa_printf(MSG_DEBUG, "Already associated with the "
689 "selected AP.");
690 }
691 rsn_preauth_scan_results(wpa_s->wpa, wpa_s->scan_res);
692 } else {
693 wpa_printf(MSG_DEBUG, "No suitable AP found.");
694 timeout = 5;
695 goto req_scan;
696 }
697
698 return;
699
700 req_scan:
701 if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1) {
702 /*
703 * Quick recovery if the initial scan results were not
704 * complete when fetched before the first scan request.
705 */
706 wpa_s->scan_res_tried++;
707 timeout = 0;
708 }
709 wpa_supplicant_req_scan(wpa_s, timeout, 0);
710 }
711 #endif /* CONFIG_NO_SCAN_PROCESSING */
712
713
714 #ifdef CONFIG_IEEE80211R
715 static void wpa_assoc_set_ft_params(struct wpa_supplicant *wpa_s,
716 const u8 *ftie, const u8 *mdie)
717 {
718 const u8 *mobility_domain = NULL;
719 const u8 *r0kh_id = NULL;
720 size_t r0kh_id_len = 0;
721 const u8 *r1kh_id = NULL;
722 struct rsn_ftie *hdr;
723 const u8 *pos, *end;
724
725 if (mdie == NULL || ftie == NULL)
726 return;
727
728 if (mdie[1] >= MOBILITY_DOMAIN_ID_LEN) {
729 mobility_domain = mdie + 2;
730 #ifdef CONFIG_SME
731 wpa_s->sme.ft_used = 1;
732 os_memcpy(wpa_s->sme.mobility_domain, mobility_domain, 2);
733 #endif /* CONFIG_SME */
734 }
735 if (ftie[1] >= sizeof(struct rsn_ftie)) {
736 end = ftie + 2 + ftie[1];
737 hdr = (struct rsn_ftie *) (ftie + 2);
738 pos = (const u8 *) (hdr + 1);
739 while (pos + 1 < end) {
740 if (pos + 2 + pos[1] > end)
741 break;
742 if (pos[0] == FTIE_SUBELEM_R1KH_ID &&
743 pos[1] == FT_R1KH_ID_LEN)
744 r1kh_id = pos + 2;
745 else if (pos[0] == FTIE_SUBELEM_R0KH_ID &&
746 pos[1] >= 1 && pos[1] <= FT_R0KH_ID_MAX_LEN) {
747 r0kh_id = pos + 2;
748 r0kh_id_len = pos[1];
749 }
750 pos += 2 + pos[1];
751 }
752 }
753 wpa_sm_set_ft_params(wpa_s->wpa, mobility_domain, r0kh_id,
754 r0kh_id_len, r1kh_id);
755 }
756 #endif /* CONFIG_IEEE80211R */
757
758 static void wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
759 union wpa_event_data *data)
760 {
761 int l, len, found = 0, wpa_found, rsn_found;
762 const u8 *p;
763 #ifdef CONFIG_IEEE80211R
764 const u8 *mdie = NULL, *ftie = NULL;
765 #endif /* CONFIG_IEEE80211R */
766
767 wpa_printf(MSG_DEBUG, "Association info event");
768 if (data->assoc_info.req_ies)
769 wpa_hexdump(MSG_DEBUG, "req_ies", data->assoc_info.req_ies,
770 data->assoc_info.req_ies_len);
771 if (data->assoc_info.resp_ies)
772 wpa_hexdump(MSG_DEBUG, "resp_ies", data->assoc_info.resp_ies,
773 data->assoc_info.resp_ies_len);
774 if (data->assoc_info.beacon_ies)
775 wpa_hexdump(MSG_DEBUG, "beacon_ies",
776 data->assoc_info.beacon_ies,
777 data->assoc_info.beacon_ies_len);
778
779 p = data->assoc_info.req_ies;
780 l = data->assoc_info.req_ies_len;
781
782 /* Go through the IEs and make a copy of the WPA/RSN IE, if present. */
783 while (p && l >= 2) {
784 len = p[1] + 2;
785 if (len > l) {
786 wpa_hexdump(MSG_DEBUG, "Truncated IE in assoc_info",
787 p, l);
788 break;
789 }
790 if ((p[0] == WLAN_EID_VENDOR_SPECIFIC && p[1] >= 6 &&
791 (os_memcmp(&p[2], "\x00\x50\xF2\x01\x01\x00", 6) == 0)) ||
792 (p[0] == WLAN_EID_RSN && p[1] >= 2)) {
793 if (wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, p, len))
794 break;
795 found = 1;
796 wpa_find_assoc_pmkid(wpa_s);
797 break;
798 }
799 l -= len;
800 p += len;
801 }
802 if (!found && data->assoc_info.req_ies)
803 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
804
805 #ifdef CONFIG_IEEE80211R
806 p = data->assoc_info.resp_ies;
807 l = data->assoc_info.resp_ies_len;
808
809 /* Go through the IEs and make a copy of the FT/MD IE, if present. */
810 while (p && l >= 2) {
811 len = p[1] + 2;
812 if (len > l) {
813 wpa_hexdump(MSG_DEBUG, "Truncated IE in assoc_info",
814 p, l);
815 break;
816 }
817 if (p[0] == WLAN_EID_FAST_BSS_TRANSITION)
818 ftie = p;
819 else if (p[0] == WLAN_EID_MOBILITY_DOMAIN)
820 mdie = p;
821 l -= len;
822 p += len;
823 }
824
825 wpa_assoc_set_ft_params(wpa_s, ftie, mdie);
826 #endif /* CONFIG_IEEE80211R */
827
828 /* WPA/RSN IE from Beacon/ProbeResp */
829 p = data->assoc_info.beacon_ies;
830 l = data->assoc_info.beacon_ies_len;
831
832 /* Go through the IEs and make a copy of the WPA/RSN IEs, if present.
833 */
834 wpa_found = rsn_found = 0;
835 while (p && l >= 2) {
836 len = p[1] + 2;
837 if (len > l) {
838 wpa_hexdump(MSG_DEBUG, "Truncated IE in beacon_ies",
839 p, l);
840 break;
841 }
842 if (!wpa_found &&
843 p[0] == WLAN_EID_VENDOR_SPECIFIC && p[1] >= 6 &&
844 os_memcmp(&p[2], "\x00\x50\xF2\x01\x01\x00", 6) == 0) {
845 wpa_found = 1;
846 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, p, len);
847 }
848
849 if (!rsn_found &&
850 p[0] == WLAN_EID_RSN && p[1] >= 2) {
851 rsn_found = 1;
852 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, p, len);
853 }
854
855 l -= len;
856 p += len;
857 }
858
859 if (!wpa_found && data->assoc_info.beacon_ies)
860 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, NULL, 0);
861 if (!rsn_found && data->assoc_info.beacon_ies)
862 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, NULL, 0);
863 if (wpa_found || rsn_found)
864 wpa_s->ap_ies_from_associnfo = 1;
865 }
866
867
868 static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
869 union wpa_event_data *data)
870 {
871 u8 bssid[ETH_ALEN];
872 int ft_completed = wpa_ft_is_completed(wpa_s->wpa);
873
874 if (data)
875 wpa_supplicant_event_associnfo(wpa_s, data);
876
877 wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATED);
878 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)
879 os_memcpy(bssid, wpa_s->bssid, ETH_ALEN);
880 if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) ||
881 (wpa_drv_get_bssid(wpa_s, bssid) >= 0 &&
882 os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0)) {
883 wpa_msg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID="
884 MACSTR, MAC2STR(bssid));
885 os_memcpy(wpa_s->bssid, bssid, ETH_ALEN);
886 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
887 if (wpa_supplicant_dynamic_keys(wpa_s) && !ft_completed) {
888 wpa_clear_keys(wpa_s, bssid);
889 }
890 if (wpa_supplicant_select_config(wpa_s) < 0) {
891 wpa_supplicant_disassociate(
892 wpa_s, WLAN_REASON_DEAUTH_LEAVING);
893 return;
894 }
895 }
896
897 wpa_msg(wpa_s, MSG_INFO, "Associated with " MACSTR, MAC2STR(bssid));
898 if (wpa_s->current_ssid) {
899 /* When using scanning (ap_scan=1), SIM PC/SC interface can be
900 * initialized before association, but for other modes,
901 * initialize PC/SC here, if the current configuration needs
902 * smartcard or SIM/USIM. */
903 wpa_supplicant_scard_init(wpa_s, wpa_s->current_ssid);
904 }
905 wpa_sm_notify_assoc(wpa_s->wpa, bssid);
906 l2_packet_notify_auth_start(wpa_s->l2);
907
908 /*
909 * Set portEnabled first to FALSE in order to get EAP state machine out
910 * of the SUCCESS state and eapSuccess cleared. Without this, EAPOL PAE
911 * state machine may transit to AUTHENTICATING state based on obsolete
912 * eapSuccess and then trigger BE_AUTH to SUCCESS and PAE to
913 * AUTHENTICATED without ever giving chance to EAP state machine to
914 * reset the state.
915 */
916 if (!ft_completed) {
917 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
918 eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
919 }
920 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || ft_completed)
921 eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);
922 /* 802.1X::portControl = Auto */
923 eapol_sm_notify_portEnabled(wpa_s->eapol, TRUE);
924 wpa_s->eapol_received = 0;
925 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
926 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
927 wpa_supplicant_cancel_auth_timeout(wpa_s);
928 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
929 } else if (!ft_completed) {
930 /* Timeout for receiving the first EAPOL packet */
931 wpa_supplicant_req_auth_timeout(wpa_s, 10, 0);
932 }
933 wpa_supplicant_cancel_scan(wpa_s);
934
935 if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE) &&
936 wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
937 /*
938 * We are done; the driver will take care of RSN 4-way
939 * handshake.
940 */
941 wpa_supplicant_cancel_auth_timeout(wpa_s);
942 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
943 eapol_sm_notify_portValid(wpa_s->eapol, TRUE);
944 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE);
945 }
946 }
947
948
949 static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s)
950 {
951 const u8 *bssid;
952
953 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
954 /*
955 * At least Host AP driver and a Prism3 card seemed to be
956 * generating streams of disconnected events when configuring
957 * IBSS for WPA-None. Ignore them for now.
958 */
959 wpa_printf(MSG_DEBUG, "Disconnect event - ignore in "
960 "IBSS/WPA-None mode");
961 return;
962 }
963
964 if (wpa_s->wpa_state == WPA_4WAY_HANDSHAKE &&
965 wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
966 wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - "
967 "pre-shared key may be incorrect");
968 }
969 if (wpa_s->wpa_state >= WPA_ASSOCIATED)
970 wpa_supplicant_req_scan(wpa_s, 0, 100000);
971 bssid = wpa_s->bssid;
972 if (is_zero_ether_addr(bssid))
973 bssid = wpa_s->pending_bssid;
974 wpa_blacklist_add(wpa_s, bssid);
975 wpa_sm_notify_disassoc(wpa_s->wpa);
976 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "- Disconnect event - "
977 "remove keys");
978 if (wpa_supplicant_dynamic_keys(wpa_s)) {
979 wpa_s->keys_cleared = 0;
980 wpa_clear_keys(wpa_s, wpa_s->bssid);
981 }
982 wpa_supplicant_mark_disassoc(wpa_s);
983 }
984
985
986 #ifdef CONFIG_DELAYED_MIC_ERROR_REPORT
987 static void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx,
988 void *sock_ctx)
989 {
990 struct wpa_supplicant *wpa_s = eloop_ctx;
991
992 if (!wpa_s->pending_mic_error_report)
993 return;
994
995 wpa_printf(MSG_DEBUG, "WPA: Sending pending MIC error report");
996 wpa_sm_key_request(wpa_s->wpa, 1, wpa_s->pending_mic_error_pairwise);
997 wpa_s->pending_mic_error_report = 0;
998 }
999 #endif /* CONFIG_DELAYED_MIC_ERROR_REPORT */
1000
1001
1002 static void
1003 wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s,
1004 union wpa_event_data *data)
1005 {
1006 int pairwise;
1007 struct os_time t;
1008
1009 wpa_msg(wpa_s, MSG_WARNING, "Michael MIC failure detected");
1010 pairwise = (data && data->michael_mic_failure.unicast);
1011 os_get_time(&t);
1012 if ((wpa_s->last_michael_mic_error &&
1013 t.sec - wpa_s->last_michael_mic_error <= 60) ||
1014 wpa_s->pending_mic_error_report) {
1015 if (wpa_s->pending_mic_error_report) {
1016 /*
1017 * Send the pending MIC error report immediately since
1018 * we are going to start countermeasures and AP better
1019 * do the same.
1020 */
1021 wpa_sm_key_request(wpa_s->wpa, 1,
1022 wpa_s->pending_mic_error_pairwise);
1023 }
1024
1025 /* Send the new MIC error report immediately since we are going
1026 * to start countermeasures and AP better do the same.
1027 */
1028 wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
1029
1030 /* initialize countermeasures */
1031 wpa_s->countermeasures = 1;
1032 wpa_msg(wpa_s, MSG_WARNING, "TKIP countermeasures started");
1033
1034 /*
1035 * Need to wait for completion of request frame. We do not get
1036 * any callback for the message completion, so just wait a
1037 * short while and hope for the best. */
1038 os_sleep(0, 10000);
1039
1040 wpa_drv_set_countermeasures(wpa_s, 1);
1041 wpa_supplicant_deauthenticate(wpa_s,
1042 WLAN_REASON_MICHAEL_MIC_FAILURE);
1043 eloop_cancel_timeout(wpa_supplicant_stop_countermeasures,
1044 wpa_s, NULL);
1045 eloop_register_timeout(60, 0,
1046 wpa_supplicant_stop_countermeasures,
1047 wpa_s, NULL);
1048 /* TODO: mark the AP rejected for 60 second. STA is
1049 * allowed to associate with another AP.. */
1050 } else {
1051 #ifdef CONFIG_DELAYED_MIC_ERROR_REPORT
1052 if (wpa_s->mic_errors_seen) {
1053 /*
1054 * Reduce the effectiveness of Michael MIC error
1055 * reports as a means for attacking against TKIP if
1056 * more than one MIC failure is noticed with the same
1057 * PTK. We delay the transmission of the reports by a
1058 * random time between 0 and 60 seconds in order to
1059 * force the attacker wait 60 seconds before getting
1060 * the information on whether a frame resulted in a MIC
1061 * failure.
1062 */
1063 u8 rval[4];
1064 int sec;
1065
1066 if (os_get_random(rval, sizeof(rval)) < 0)
1067 sec = os_random() % 60;
1068 else
1069 sec = WPA_GET_BE32(rval) % 60;
1070 wpa_printf(MSG_DEBUG, "WPA: Delay MIC error report %d "
1071 "seconds", sec);
1072 wpa_s->pending_mic_error_report = 1;
1073 wpa_s->pending_mic_error_pairwise = pairwise;
1074 eloop_cancel_timeout(
1075 wpa_supplicant_delayed_mic_error_report,
1076 wpa_s, NULL);
1077 eloop_register_timeout(
1078 sec, os_random() % 1000000,
1079 wpa_supplicant_delayed_mic_error_report,
1080 wpa_s, NULL);
1081 } else {
1082 wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
1083 }
1084 #else /* CONFIG_DELAYED_MIC_ERROR_REPORT */
1085 wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
1086 #endif /* CONFIG_DELAYED_MIC_ERROR_REPORT */
1087 }
1088 wpa_s->last_michael_mic_error = t.sec;
1089 wpa_s->mic_errors_seen++;
1090 }
1091
1092
1093 #ifdef CONFIG_TERMINATE_ONLASTIF
1094 static int any_interfaces(struct wpa_supplicant *head)
1095 {
1096 struct wpa_supplicant *wpa_s;
1097
1098 for (wpa_s = head; wpa_s != NULL; wpa_s = wpa_s->next)
1099 if (!wpa_s->interface_removed)
1100 return 1;
1101 return 0;
1102 }
1103 #endif /* CONFIG_TERMINATE_ONLASTIF */
1104
1105
1106 static void
1107 wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
1108 union wpa_event_data *data)
1109 {
1110 if (os_strcmp(wpa_s->ifname, data->interface_status.ifname) != 0)
1111 return;
1112
1113 switch (data->interface_status.ievent) {
1114 case EVENT_INTERFACE_ADDED:
1115 if (!wpa_s->interface_removed)
1116 break;
1117 wpa_s->interface_removed = 0;
1118 wpa_printf(MSG_DEBUG, "Configured interface was added.");
1119 if (wpa_supplicant_driver_init(wpa_s) < 0) {
1120 wpa_printf(MSG_INFO, "Failed to initialize the driver "
1121 "after interface was added.");
1122 }
1123 break;
1124 case EVENT_INTERFACE_REMOVED:
1125 wpa_printf(MSG_DEBUG, "Configured interface was removed.");
1126 wpa_s->interface_removed = 1;
1127 wpa_supplicant_mark_disassoc(wpa_s);
1128 l2_packet_deinit(wpa_s->l2);
1129 wpa_s->l2 = NULL;
1130 #ifdef CONFIG_TERMINATE_ONLASTIF
1131 /* check if last interface */
1132 if (!any_interfaces(wpa_s->global->ifaces))
1133 eloop_terminate();
1134 #endif /* CONFIG_TERMINATE_ONLASTIF */
1135 break;
1136 }
1137 }
1138
1139
1140 #ifdef CONFIG_PEERKEY
1141 static void
1142 wpa_supplicant_event_stkstart(struct wpa_supplicant *wpa_s,
1143 union wpa_event_data *data)
1144 {
1145 if (data == NULL)
1146 return;
1147 wpa_sm_stkstart(wpa_s->wpa, data->stkstart.peer);
1148 }
1149 #endif /* CONFIG_PEERKEY */
1150
1151
1152 #ifdef CONFIG_IEEE80211R
1153 static void
1154 wpa_supplicant_event_ft_response(struct wpa_supplicant *wpa_s,
1155 union wpa_event_data *data)
1156 {
1157 if (data == NULL)
1158 return;
1159
1160 if (wpa_ft_process_response(wpa_s->wpa, data->ft_ies.ies,
1161 data->ft_ies.ies_len,
1162 data->ft_ies.ft_action,
1163 data->ft_ies.target_ap,
1164 data->ft_ies.ric_ies,
1165 data->ft_ies.ric_ies_len) < 0) {
1166 /* TODO: prevent MLME/driver from trying to associate? */
1167 }
1168 }
1169 #endif /* CONFIG_IEEE80211R */
1170
1171
1172 #ifdef CONFIG_IBSS_RSN
1173 static void wpa_supplicant_event_ibss_rsn_start(struct wpa_supplicant *wpa_s,
1174 union wpa_event_data *data)
1175 {
1176 if (data == NULL)
1177 return;
1178 ibss_rsn_start(wpa_s->ibss_rsn, data->ibss_rsn_start.peer);
1179 }
1180 #endif /* CONFIG_IBSS_RSN */
1181
1182
1183 void wpa_supplicant_event(void *ctx, wpa_event_type event,
1184 union wpa_event_data *data)
1185 {
1186 struct wpa_supplicant *wpa_s = ctx;
1187
1188 switch (event) {
1189 case EVENT_AUTH:
1190 sme_event_auth(wpa_s, data);
1191 break;
1192 case EVENT_ASSOC:
1193 wpa_supplicant_event_assoc(wpa_s, data);
1194 break;
1195 case EVENT_DEAUTH:
1196 case EVENT_DISASSOC:
1197 wpa_supplicant_event_disassoc(wpa_s);
1198 break;
1199 case EVENT_MICHAEL_MIC_FAILURE:
1200 wpa_supplicant_event_michael_mic_failure(wpa_s, data);
1201 break;
1202 #ifndef CONFIG_NO_SCAN_PROCESSING
1203 case EVENT_SCAN_RESULTS:
1204 wpa_supplicant_event_scan_results(wpa_s);
1205 break;
1206 #endif /* CONFIG_NO_SCAN_PROCESSING */
1207 case EVENT_ASSOCINFO:
1208 wpa_supplicant_event_associnfo(wpa_s, data);
1209 break;
1210 case EVENT_INTERFACE_STATUS:
1211 wpa_supplicant_event_interface_status(wpa_s, data);
1212 break;
1213 case EVENT_PMKID_CANDIDATE:
1214 wpa_supplicant_event_pmkid_candidate(wpa_s, data);
1215 break;
1216 #ifdef CONFIG_PEERKEY
1217 case EVENT_STKSTART:
1218 wpa_supplicant_event_stkstart(wpa_s, data);
1219 break;
1220 #endif /* CONFIG_PEERKEY */
1221 #ifdef CONFIG_IEEE80211R
1222 case EVENT_FT_RESPONSE:
1223 wpa_supplicant_event_ft_response(wpa_s, data);
1224 break;
1225 #endif /* CONFIG_IEEE80211R */
1226 #ifdef CONFIG_IBSS_RSN
1227 case EVENT_IBSS_RSN_START:
1228 wpa_supplicant_event_ibss_rsn_start(wpa_s, data);
1229 break;
1230 #endif /* CONFIG_IBSS_RSN */
1231 case EVENT_ASSOC_REJECT:
1232 sme_event_assoc_reject(wpa_s, data);
1233 break;
1234 case EVENT_AUTH_TIMED_OUT:
1235 sme_event_auth_timed_out(wpa_s, data);
1236 break;
1237 case EVENT_ASSOC_TIMED_OUT:
1238 sme_event_assoc_timed_out(wpa_s, data);
1239 break;
1240 default:
1241 wpa_printf(MSG_INFO, "Unknown event %d", event);
1242 break;
1243 }
1244 }