2 * WPA Supplicant - Driver event processing
3 * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #include "eapol_supp/eapol_supp_sm.h"
19 #include "rsn_supp/wpa.h"
22 #include "l2_packet/l2_packet.h"
23 #include "wpa_supplicant_i.h"
25 #include "pcsc_funcs.h"
26 #include "rsn_supp/preauth.h"
27 #include "rsn_supp/pmksa_cache.h"
28 #include "common/wpa_ctrl.h"
29 #include "eap_peer/eap.h"
31 #include "common/ieee802_11_defs.h"
32 #include "blacklist.h"
33 #include "wpas_glue.h"
34 #include "wps_supplicant.h"
42 static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
44 struct wpa_ssid *ssid, *old_ssid;
46 if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid)
49 wpa_printf(MSG_DEBUG, "Select network based on association "
51 ssid = wpa_supplicant_get_ssid(wpa_s);
53 wpa_printf(MSG_INFO, "No network configuration found for the "
59 wpa_printf(MSG_DEBUG, "Selected network is disabled");
63 wpa_printf(MSG_DEBUG, "Network configuration found for the current "
65 if (ssid->key_mgmt & (WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_IEEE8021X |
66 WPA_KEY_MGMT_WPA_NONE |
67 WPA_KEY_MGMT_FT_PSK | WPA_KEY_MGMT_FT_IEEE8021X |
68 WPA_KEY_MGMT_PSK_SHA256 |
69 WPA_KEY_MGMT_IEEE8021X_SHA256)) {
71 size_t wpa_ie_len = sizeof(wpa_ie);
72 wpa_supplicant_set_suites(wpa_s, NULL, ssid,
75 wpa_supplicant_set_non_wpa_policy(wpa_s, ssid);
78 if (wpa_s->current_ssid && wpa_s->current_ssid != ssid)
79 eapol_sm_invalidate_cached_session(wpa_s->eapol);
80 old_ssid = wpa_s->current_ssid;
81 wpa_s->current_ssid = ssid;
82 wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
83 wpa_supplicant_initiate_eapol(wpa_s);
84 if (old_ssid != wpa_s->current_ssid)
85 wpas_notify_network_changed(wpa_s);
91 static void wpa_supplicant_stop_countermeasures(void *eloop_ctx,
94 struct wpa_supplicant *wpa_s = eloop_ctx;
96 if (wpa_s->countermeasures) {
97 wpa_s->countermeasures = 0;
98 wpa_drv_set_countermeasures(wpa_s, 0);
99 wpa_msg(wpa_s, MSG_INFO, "WPA: TKIP countermeasures stopped");
100 wpa_supplicant_req_scan(wpa_s, 0, 0);
105 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
109 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
110 bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
111 os_memset(wpa_s->bssid, 0, ETH_ALEN);
112 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
114 wpas_notify_bssid_changed(wpa_s);
116 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
117 eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
118 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt))
119 eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);
120 wpa_s->ap_ies_from_associnfo = 0;
124 static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s)
126 struct wpa_ie_data ie;
130 if (wpa_sm_parse_own_wpa_ie(wpa_s->wpa, &ie) < 0 ||
134 for (i = 0; i < ie.num_pmkid; i++) {
135 pmksa_set = pmksa_cache_set_current(wpa_s->wpa,
136 ie.pmkid + i * PMKID_LEN,
138 if (pmksa_set == 0) {
139 eapol_sm_notify_pmkid_attempt(wpa_s->eapol, 1);
144 wpa_printf(MSG_DEBUG, "RSN: PMKID from assoc IE %sfound from PMKSA "
145 "cache", pmksa_set == 0 ? "" : "not ");
149 static void wpa_supplicant_event_pmkid_candidate(struct wpa_supplicant *wpa_s,
150 union wpa_event_data *data)
153 wpa_printf(MSG_DEBUG, "RSN: No data in PMKID candidate event");
156 wpa_printf(MSG_DEBUG, "RSN: PMKID candidate event - bssid=" MACSTR
157 " index=%d preauth=%d",
158 MAC2STR(data->pmkid_candidate.bssid),
159 data->pmkid_candidate.index,
160 data->pmkid_candidate.preauth);
162 pmksa_candidate_add(wpa_s->wpa, data->pmkid_candidate.bssid,
163 data->pmkid_candidate.index,
164 data->pmkid_candidate.preauth);
168 static int wpa_supplicant_dynamic_keys(struct wpa_supplicant *wpa_s)
170 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
171 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE)
174 #ifdef IEEE8021X_EAPOL
175 if (wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA &&
176 wpa_s->current_ssid &&
177 !(wpa_s->current_ssid->eapol_flags &
178 (EAPOL_FLAG_REQUIRE_KEY_UNICAST |
179 EAPOL_FLAG_REQUIRE_KEY_BROADCAST))) {
180 /* IEEE 802.1X, but not using dynamic WEP keys (i.e., either
181 * plaintext or static WEP keys). */
184 #endif /* IEEE8021X_EAPOL */
191 * wpa_supplicant_scard_init - Initialize SIM/USIM access with PC/SC
192 * @wpa_s: pointer to wpa_supplicant data
193 * @ssid: Configuration data for the network
194 * Returns: 0 on success, -1 on failure
196 * This function is called when starting authentication with a network that is
197 * configured to use PC/SC for SIM/USIM access (EAP-SIM or EAP-AKA).
199 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
200 struct wpa_ssid *ssid)
202 #ifdef IEEE8021X_EAPOL
203 int aka = 0, sim = 0, type;
205 if (ssid->eap.pcsc == NULL || wpa_s->scard != NULL)
208 if (ssid->eap.eap_methods == NULL) {
212 struct eap_method_type *eap = ssid->eap.eap_methods;
213 while (eap->vendor != EAP_VENDOR_IETF ||
214 eap->method != EAP_TYPE_NONE) {
215 if (eap->vendor == EAP_VENDOR_IETF) {
216 if (eap->method == EAP_TYPE_SIM)
218 else if (eap->method == EAP_TYPE_AKA)
225 if (eap_peer_get_eap_method(EAP_VENDOR_IETF, EAP_TYPE_SIM) == NULL)
227 if (eap_peer_get_eap_method(EAP_VENDOR_IETF, EAP_TYPE_AKA) == NULL)
231 wpa_printf(MSG_DEBUG, "Selected network is configured to use "
232 "SIM, but neither EAP-SIM nor EAP-AKA are enabled");
236 wpa_printf(MSG_DEBUG, "Selected network is configured to use SIM "
237 "(sim=%d aka=%d) - initialize PCSC", sim, aka);
239 type = SCARD_TRY_BOTH;
241 type = SCARD_USIM_ONLY;
243 type = SCARD_GSM_SIM_ONLY;
245 wpa_s->scard = scard_init(type);
246 if (wpa_s->scard == NULL) {
247 wpa_printf(MSG_WARNING, "Failed to initialize SIM "
251 wpa_sm_set_scard_ctx(wpa_s->wpa, wpa_s->scard);
252 eapol_sm_register_scard_ctx(wpa_s->eapol, wpa_s->scard);
253 #endif /* IEEE8021X_EAPOL */
259 #ifndef CONFIG_NO_SCAN_PROCESSING
260 static int wpa_supplicant_match_privacy(struct wpa_scan_res *bss,
261 struct wpa_ssid *ssid)
265 if (ssid->mixed_cell)
269 if (ssid->key_mgmt & WPA_KEY_MGMT_WPS)
271 #endif /* CONFIG_WPS */
273 for (i = 0; i < NUM_WEP_KEYS; i++) {
274 if (ssid->wep_key_len[i]) {
279 #ifdef IEEE8021X_EAPOL
280 if ((ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) &&
281 ssid->eapol_flags & (EAPOL_FLAG_REQUIRE_KEY_UNICAST |
282 EAPOL_FLAG_REQUIRE_KEY_BROADCAST))
284 #endif /* IEEE8021X_EAPOL */
286 if (bss->caps & IEEE80211_CAP_PRIVACY)
292 static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
293 struct wpa_ssid *ssid,
294 struct wpa_scan_res *bss)
296 struct wpa_ie_data ie;
298 const u8 *rsn_ie, *wpa_ie;
301 ret = wpas_wps_ssid_bss_match(wpa_s, ssid, bss);
305 rsn_ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
306 while ((ssid->proto & WPA_PROTO_RSN) && rsn_ie) {
309 if (wpa_parse_wpa_ie(rsn_ie, 2 + rsn_ie[1], &ie)) {
310 wpa_printf(MSG_DEBUG, " skip RSN IE - parse failed");
313 if (!(ie.proto & ssid->proto)) {
314 wpa_printf(MSG_DEBUG, " skip RSN IE - proto "
319 if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) {
320 wpa_printf(MSG_DEBUG, " skip RSN IE - PTK cipher "
325 if (!(ie.group_cipher & ssid->group_cipher)) {
326 wpa_printf(MSG_DEBUG, " skip RSN IE - GTK cipher "
331 if (!(ie.key_mgmt & ssid->key_mgmt)) {
332 wpa_printf(MSG_DEBUG, " skip RSN IE - key mgmt "
337 #ifdef CONFIG_IEEE80211W
338 if (!(ie.capabilities & WPA_CAPABILITY_MFPC) &&
339 ssid->ieee80211w == IEEE80211W_REQUIRED) {
340 wpa_printf(MSG_DEBUG, " skip RSN IE - no mgmt frame "
344 #endif /* CONFIG_IEEE80211W */
346 wpa_printf(MSG_DEBUG, " selected based on RSN IE");
350 wpa_ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
351 while ((ssid->proto & WPA_PROTO_WPA) && wpa_ie) {
354 if (wpa_parse_wpa_ie(wpa_ie, 2 + wpa_ie[1], &ie)) {
355 wpa_printf(MSG_DEBUG, " skip WPA IE - parse failed");
358 if (!(ie.proto & ssid->proto)) {
359 wpa_printf(MSG_DEBUG, " skip WPA IE - proto "
364 if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) {
365 wpa_printf(MSG_DEBUG, " skip WPA IE - PTK cipher "
370 if (!(ie.group_cipher & ssid->group_cipher)) {
371 wpa_printf(MSG_DEBUG, " skip WPA IE - GTK cipher "
376 if (!(ie.key_mgmt & ssid->key_mgmt)) {
377 wpa_printf(MSG_DEBUG, " skip WPA IE - key mgmt "
382 wpa_printf(MSG_DEBUG, " selected based on WPA IE");
386 if (proto_match == 0)
387 wpa_printf(MSG_DEBUG, " skip - no WPA/RSN proto match");
393 static struct wpa_bss *
394 wpa_supplicant_select_bss_wpa(struct wpa_supplicant *wpa_s,
395 struct wpa_ssid *group,
396 struct wpa_ssid **selected_ssid)
398 struct wpa_ssid *ssid;
399 struct wpa_scan_res *bss;
401 struct wpa_blacklist *e;
404 wpa_printf(MSG_DEBUG, "Try to find WPA-enabled AP");
405 for (i = 0; i < wpa_s->scan_res->num; i++) {
407 u8 wpa_ie_len, rsn_ie_len, ssid_len;
408 bss = wpa_s->scan_res->res[i];
410 ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
411 ssid_ = ie ? ie + 2 : (u8 *) "";
412 ssid_len = ie ? ie[1] : 0;
414 ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
415 wpa_ie_len = ie ? ie[1] : 0;
417 ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
418 rsn_ie_len = ie ? ie[1] : 0;
420 wpa_printf(MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
421 "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x",
422 (int) i, MAC2STR(bss->bssid),
423 wpa_ssid_txt(ssid_, ssid_len),
424 wpa_ie_len, rsn_ie_len, bss->caps);
426 e = wpa_blacklist_get(wpa_s, bss->bssid);
427 if (e && e->count > 1) {
428 wpa_printf(MSG_DEBUG, " skip - blacklisted");
433 wpa_printf(MSG_DEBUG, " skip - SSID not known");
437 if (wpa_ie_len == 0 && rsn_ie_len == 0) {
438 wpa_printf(MSG_DEBUG, " skip - no WPA/RSN IE");
442 for (ssid = group; ssid; ssid = ssid->pnext) {
445 if (ssid->disabled) {
446 wpa_printf(MSG_DEBUG, " skip - disabled");
451 if (ssid->ssid_len == 0 &&
452 wpas_wps_ssid_wildcard_ok(wpa_s, ssid, bss))
454 #endif /* CONFIG_WPS */
457 (ssid_len != ssid->ssid_len ||
458 os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
459 wpa_printf(MSG_DEBUG, " skip - "
464 if (ssid->bssid_set &&
465 os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) != 0)
467 wpa_printf(MSG_DEBUG, " skip - "
472 if (!wpa_supplicant_ssid_bss_match(wpa_s, ssid, bss))
475 wpa_printf(MSG_DEBUG, " selected WPA AP "
478 wpa_ssid_txt(ssid_, ssid_len));
479 *selected_ssid = ssid;
480 return wpa_bss_get(wpa_s, bss->bssid, ssid_, ssid_len);
488 static struct wpa_bss *
489 wpa_supplicant_select_bss_non_wpa(struct wpa_supplicant *wpa_s,
490 struct wpa_ssid *group,
491 struct wpa_ssid **selected_ssid)
493 struct wpa_ssid *ssid;
494 struct wpa_scan_res *bss;
496 struct wpa_blacklist *e;
499 wpa_printf(MSG_DEBUG, "Try to find non-WPA AP");
500 for (i = 0; i < wpa_s->scan_res->num; i++) {
502 u8 wpa_ie_len, rsn_ie_len, ssid_len;
503 bss = wpa_s->scan_res->res[i];
505 ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
506 ssid_ = ie ? ie + 2 : (u8 *) "";
507 ssid_len = ie ? ie[1] : 0;
509 ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
510 wpa_ie_len = ie ? ie[1] : 0;
512 ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
513 rsn_ie_len = ie ? ie[1] : 0;
515 wpa_printf(MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
516 "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x",
517 (int) i, MAC2STR(bss->bssid),
518 wpa_ssid_txt(ssid_, ssid_len),
519 wpa_ie_len, rsn_ie_len, bss->caps);
521 e = wpa_blacklist_get(wpa_s, bss->bssid);
522 if (e && e->count > 1) {
523 wpa_printf(MSG_DEBUG, " skip - blacklisted");
528 wpa_printf(MSG_DEBUG, " skip - SSID not known");
532 for (ssid = group; ssid; ssid = ssid->pnext) {
533 int check_ssid = ssid->ssid_len != 0;
535 if (ssid->disabled) {
536 wpa_printf(MSG_DEBUG, " skip - disabled");
541 if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
542 /* Only allow wildcard SSID match if an AP
543 * advertises active WPS operation that matches
546 if (ssid->ssid_len == 0 &&
547 wpas_wps_ssid_wildcard_ok(wpa_s, ssid,
551 #endif /* CONFIG_WPS */
554 (ssid_len != ssid->ssid_len ||
555 os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
556 wpa_printf(MSG_DEBUG, " skip - "
561 if (ssid->bssid_set &&
562 os_memcmp(bss->bssid, ssid->bssid, ETH_ALEN) != 0)
564 wpa_printf(MSG_DEBUG, " skip - "
569 if (!(ssid->key_mgmt & WPA_KEY_MGMT_NONE) &&
570 !(ssid->key_mgmt & WPA_KEY_MGMT_WPS) &&
571 !(ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA))
573 wpa_printf(MSG_DEBUG, " skip - "
574 "non-WPA network not allowed");
578 if ((ssid->key_mgmt &
579 (WPA_KEY_MGMT_IEEE8021X | WPA_KEY_MGMT_PSK |
580 WPA_KEY_MGMT_FT_IEEE8021X | WPA_KEY_MGMT_FT_PSK |
581 WPA_KEY_MGMT_IEEE8021X_SHA256 |
582 WPA_KEY_MGMT_PSK_SHA256)) &&
583 (wpa_ie_len != 0 || rsn_ie_len != 0)) {
584 wpa_printf(MSG_DEBUG, " skip - "
589 if (!wpa_supplicant_match_privacy(bss, ssid)) {
590 wpa_printf(MSG_DEBUG, " skip - "
595 if (bss->caps & IEEE80211_CAP_IBSS) {
596 wpa_printf(MSG_DEBUG, " skip - "
597 "IBSS (adhoc) network");
601 wpa_printf(MSG_DEBUG, " selected non-WPA AP "
604 wpa_ssid_txt(ssid_, ssid_len));
605 *selected_ssid = ssid;
606 return wpa_bss_get(wpa_s, bss->bssid, ssid_, ssid_len);
614 static struct wpa_bss *
615 wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, struct wpa_ssid *group,
616 struct wpa_ssid **selected_ssid)
618 struct wpa_bss *selected;
620 wpa_printf(MSG_DEBUG, "Selecting BSS from priority group %d",
623 /* First, try to find WPA-enabled AP */
624 selected = wpa_supplicant_select_bss_wpa(wpa_s, group, selected_ssid);
628 /* If no WPA-enabled AP found, try to find non-WPA AP, if configuration
630 return wpa_supplicant_select_bss_non_wpa(wpa_s, group, selected_ssid);
634 static struct wpa_bss *
635 wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
636 struct wpa_ssid **selected_ssid)
638 struct wpa_bss *selected = NULL;
641 while (selected == NULL) {
642 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
643 selected = wpa_supplicant_select_bss(
644 wpa_s, wpa_s->conf->pssid[prio],
650 if (selected == NULL && wpa_s->blacklist) {
651 wpa_printf(MSG_DEBUG, "No APs found - clear blacklist "
653 wpa_blacklist_clear(wpa_s);
654 wpa_s->blacklist_cleared++;
655 } else if (selected == NULL)
663 static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s,
666 if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1) {
668 * Quick recovery if the initial scan results were not
669 * complete when fetched before the first scan request.
671 wpa_s->scan_res_tried++;
673 } else if (!wpa_supplicant_enabled_networks(wpa_s->conf)) {
675 * No networks are enabled; short-circuit request so
676 * we don't wait timeout seconds before transitioning
679 wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
682 wpa_supplicant_req_scan(wpa_s, timeout, 0);
686 static void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
687 struct wpa_bss *selected,
688 struct wpa_ssid *ssid)
690 if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) {
691 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP
692 "PBC session overlap");
693 wpa_supplicant_req_new_scan(wpa_s, 10);
698 * Do not trigger new association unless the BSSID has changed or if
699 * reassociation is requested. If we are in process of associating with
700 * the selected BSSID, do not trigger new attempt.
702 if (wpa_s->reassociate ||
703 (os_memcmp(selected->bssid, wpa_s->bssid, ETH_ALEN) != 0 &&
704 (wpa_s->wpa_state != WPA_ASSOCIATING ||
705 os_memcmp(selected->bssid, wpa_s->pending_bssid, ETH_ALEN) !=
707 if (wpa_supplicant_scard_init(wpa_s, ssid)) {
708 wpa_supplicant_req_new_scan(wpa_s, 10);
711 wpa_supplicant_associate(wpa_s, selected, ssid);
713 wpa_printf(MSG_DEBUG, "Already associated with the selected "
719 static struct wpa_ssid *
720 wpa_supplicant_pick_new_network(struct wpa_supplicant *wpa_s)
723 struct wpa_ssid *ssid;
725 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
726 for (ssid = wpa_s->conf->pssid[prio]; ssid; ssid = ssid->pnext)
730 if (ssid->mode == IEEE80211_MODE_IBSS ||
731 ssid->mode == IEEE80211_MODE_AP)
739 static void wpa_supplicant_rsn_preauth_scan_results(
740 struct wpa_supplicant *wpa_s)
744 if (rsn_preauth_scan_results(wpa_s->wpa) < 0)
747 for (i = wpa_s->scan_res->num - 1; i >= 0; i--) {
748 const u8 *ssid, *rsn;
749 struct wpa_scan_res *r;
751 r = wpa_s->scan_res->res[i];
753 ssid = wpa_scan_get_ie(r, WLAN_EID_SSID);
757 rsn = wpa_scan_get_ie(r, WLAN_EID_RSN);
761 rsn_preauth_scan_result(wpa_s->wpa, r->bssid, ssid, rsn);
767 static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
768 union wpa_event_data *data)
770 struct wpa_bss *selected;
771 struct wpa_ssid *ssid = NULL;
773 wpa_supplicant_notify_scanning(wpa_s, 0);
775 if (wpa_supplicant_get_scan_results(wpa_s, data ? &data->scan_info :
777 if (wpa_s->conf->ap_scan == 2)
779 wpa_printf(MSG_DEBUG, "Failed to get scan results - try "
781 wpa_supplicant_req_new_scan(wpa_s, 1);
786 * Don't post the results if this was the initial cached
787 * and there were no results.
789 if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1 &&
790 wpa_s->scan_res->num == 0) {
791 wpa_msg(wpa_s, MSG_DEBUG, "Cached scan results are "
792 "empty - not posting");
794 wpa_printf(MSG_DEBUG, "New scan results available");
795 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
796 wpas_notify_scan_results(wpa_s);
799 wpas_notify_scan_done(wpa_s, 1);
801 if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s)))
804 if (wpa_s->disconnected) {
805 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
809 if (bgscan_notify_scan(wpa_s) == 1)
812 wpa_supplicant_rsn_preauth_scan_results(wpa_s);
814 selected = wpa_supplicant_pick_network(wpa_s, &ssid);
816 wpa_supplicant_connect(wpa_s, selected, ssid);
818 wpa_printf(MSG_DEBUG, "No suitable network found");
819 ssid = wpa_supplicant_pick_new_network(wpa_s);
821 wpa_printf(MSG_DEBUG, "Setup a new network");
822 wpa_supplicant_associate(wpa_s, NULL, ssid);
824 wpa_supplicant_req_new_scan(wpa_s, 5);
827 #endif /* CONFIG_NO_SCAN_PROCESSING */
830 #ifdef CONFIG_IEEE80211R
831 static void wpa_assoc_set_ft_params(struct wpa_supplicant *wpa_s,
832 const u8 *ftie, const u8 *mdie)
834 const u8 *mobility_domain = NULL;
835 const u8 *r0kh_id = NULL;
836 size_t r0kh_id_len = 0;
837 const u8 *r1kh_id = NULL;
838 struct rsn_ftie *hdr;
841 if (mdie == NULL || ftie == NULL)
844 if (mdie[1] >= MOBILITY_DOMAIN_ID_LEN) {
845 mobility_domain = mdie + 2;
847 wpa_s->sme.ft_used = 1;
848 os_memcpy(wpa_s->sme.mobility_domain, mobility_domain, 2);
849 #endif /* CONFIG_SME */
851 if (ftie[1] >= sizeof(struct rsn_ftie)) {
852 end = ftie + 2 + ftie[1];
853 hdr = (struct rsn_ftie *) (ftie + 2);
854 pos = (const u8 *) (hdr + 1);
855 while (pos + 1 < end) {
856 if (pos + 2 + pos[1] > end)
858 if (pos[0] == FTIE_SUBELEM_R1KH_ID &&
859 pos[1] == FT_R1KH_ID_LEN)
861 else if (pos[0] == FTIE_SUBELEM_R0KH_ID &&
862 pos[1] >= 1 && pos[1] <= FT_R0KH_ID_MAX_LEN) {
864 r0kh_id_len = pos[1];
869 wpa_sm_set_ft_params(wpa_s->wpa, mobility_domain, r0kh_id,
870 r0kh_id_len, r1kh_id);
872 #endif /* CONFIG_IEEE80211R */
874 static void wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
875 union wpa_event_data *data)
877 int l, len, found = 0, wpa_found, rsn_found;
879 #ifdef CONFIG_IEEE80211R
880 const u8 *mdie = NULL, *ftie = NULL;
881 #endif /* CONFIG_IEEE80211R */
883 wpa_printf(MSG_DEBUG, "Association info event");
884 if (data->assoc_info.req_ies)
885 wpa_hexdump(MSG_DEBUG, "req_ies", data->assoc_info.req_ies,
886 data->assoc_info.req_ies_len);
887 if (data->assoc_info.resp_ies)
888 wpa_hexdump(MSG_DEBUG, "resp_ies", data->assoc_info.resp_ies,
889 data->assoc_info.resp_ies_len);
890 if (data->assoc_info.beacon_ies)
891 wpa_hexdump(MSG_DEBUG, "beacon_ies",
892 data->assoc_info.beacon_ies,
893 data->assoc_info.beacon_ies_len);
894 if (data->assoc_info.freq)
895 wpa_printf(MSG_DEBUG, "freq=%u MHz", data->assoc_info.freq);
897 p = data->assoc_info.req_ies;
898 l = data->assoc_info.req_ies_len;
900 /* Go through the IEs and make a copy of the WPA/RSN IE, if present. */
901 while (p && l >= 2) {
904 wpa_hexdump(MSG_DEBUG, "Truncated IE in assoc_info",
908 if ((p[0] == WLAN_EID_VENDOR_SPECIFIC && p[1] >= 6 &&
909 (os_memcmp(&p[2], "\x00\x50\xF2\x01\x01\x00", 6) == 0)) ||
910 (p[0] == WLAN_EID_RSN && p[1] >= 2)) {
911 if (wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, p, len))
914 wpa_find_assoc_pmkid(wpa_s);
920 if (!found && data->assoc_info.req_ies)
921 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
923 #ifdef CONFIG_IEEE80211R
924 p = data->assoc_info.resp_ies;
925 l = data->assoc_info.resp_ies_len;
927 /* Go through the IEs and make a copy of the FT/MD IE, if present. */
928 while (p && l >= 2) {
931 wpa_hexdump(MSG_DEBUG, "Truncated IE in assoc_info",
935 if (p[0] == WLAN_EID_FAST_BSS_TRANSITION)
937 else if (p[0] == WLAN_EID_MOBILITY_DOMAIN)
943 wpa_assoc_set_ft_params(wpa_s, ftie, mdie);
944 #endif /* CONFIG_IEEE80211R */
946 /* WPA/RSN IE from Beacon/ProbeResp */
947 p = data->assoc_info.beacon_ies;
948 l = data->assoc_info.beacon_ies_len;
950 /* Go through the IEs and make a copy of the WPA/RSN IEs, if present.
952 wpa_found = rsn_found = 0;
953 while (p && l >= 2) {
956 wpa_hexdump(MSG_DEBUG, "Truncated IE in beacon_ies",
961 p[0] == WLAN_EID_VENDOR_SPECIFIC && p[1] >= 6 &&
962 os_memcmp(&p[2], "\x00\x50\xF2\x01\x01\x00", 6) == 0) {
964 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, p, len);
968 p[0] == WLAN_EID_RSN && p[1] >= 2) {
970 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, p, len);
977 if (!wpa_found && data->assoc_info.beacon_ies)
978 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, NULL, 0);
979 if (!rsn_found && data->assoc_info.beacon_ies)
980 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, NULL, 0);
981 if (wpa_found || rsn_found)
982 wpa_s->ap_ies_from_associnfo = 1;
984 wpa_s->assoc_freq = data->assoc_info.freq;
988 static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
989 union wpa_event_data *data)
992 int ft_completed = wpa_ft_is_completed(wpa_s->wpa);
994 struct wpa_driver_capa capa;
997 wpa_supplicant_event_associnfo(wpa_s, data);
999 wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATED);
1000 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)
1001 os_memcpy(bssid, wpa_s->bssid, ETH_ALEN);
1002 if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) ||
1003 (wpa_drv_get_bssid(wpa_s, bssid) >= 0 &&
1004 os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0)) {
1005 wpa_msg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID="
1006 MACSTR, MAC2STR(bssid));
1007 bssid_changed = os_memcmp(wpa_s->bssid, bssid, ETH_ALEN);
1008 os_memcpy(wpa_s->bssid, bssid, ETH_ALEN);
1009 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
1011 wpas_notify_bssid_changed(wpa_s);
1013 if (wpa_supplicant_dynamic_keys(wpa_s) && !ft_completed) {
1014 wpa_clear_keys(wpa_s, bssid);
1016 if (wpa_supplicant_select_config(wpa_s) < 0) {
1017 wpa_supplicant_disassociate(
1018 wpa_s, WLAN_REASON_DEAUTH_LEAVING);
1024 os_memcpy(wpa_s->sme.prev_bssid, bssid, ETH_ALEN);
1025 wpa_s->sme.prev_bssid_set = 1;
1026 #endif /* CONFIG_SME */
1028 wpa_msg(wpa_s, MSG_INFO, "Associated with " MACSTR, MAC2STR(bssid));
1029 if (wpa_s->current_ssid) {
1030 /* When using scanning (ap_scan=1), SIM PC/SC interface can be
1031 * initialized before association, but for other modes,
1032 * initialize PC/SC here, if the current configuration needs
1033 * smartcard or SIM/USIM. */
1034 wpa_supplicant_scard_init(wpa_s, wpa_s->current_ssid);
1036 wpa_sm_notify_assoc(wpa_s->wpa, bssid);
1037 l2_packet_notify_auth_start(wpa_s->l2);
1040 * Set portEnabled first to FALSE in order to get EAP state machine out
1041 * of the SUCCESS state and eapSuccess cleared. Without this, EAPOL PAE
1042 * state machine may transit to AUTHENTICATING state based on obsolete
1043 * eapSuccess and then trigger BE_AUTH to SUCCESS and PAE to
1044 * AUTHENTICATED without ever giving chance to EAP state machine to
1047 if (!ft_completed) {
1048 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
1049 eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
1051 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || ft_completed)
1052 eapol_sm_notify_eap_success(wpa_s->eapol, FALSE);
1053 /* 802.1X::portControl = Auto */
1054 eapol_sm_notify_portEnabled(wpa_s->eapol, TRUE);
1055 wpa_s->eapol_received = 0;
1056 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
1057 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE ||
1058 (wpa_s->current_ssid &&
1059 wpa_s->current_ssid->mode == IEEE80211_MODE_IBSS)) {
1060 wpa_supplicant_cancel_auth_timeout(wpa_s);
1061 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
1062 } else if (!ft_completed) {
1063 /* Timeout for receiving the first EAPOL packet */
1064 wpa_supplicant_req_auth_timeout(wpa_s, 10, 0);
1066 wpa_supplicant_cancel_scan(wpa_s);
1068 if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE) &&
1069 wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
1071 * We are done; the driver will take care of RSN 4-way
1074 wpa_supplicant_cancel_auth_timeout(wpa_s);
1075 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
1076 eapol_sm_notify_portValid(wpa_s->eapol, TRUE);
1077 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE);
1080 if (wpa_s->pending_eapol_rx) {
1081 struct os_time now, age;
1083 os_time_sub(&now, &wpa_s->pending_eapol_rx_time, &age);
1084 if (age.sec == 0 && age.usec < 100000 &&
1085 os_memcmp(wpa_s->pending_eapol_rx_src, bssid, ETH_ALEN) ==
1087 wpa_printf(MSG_DEBUG, "Process pending EAPOL frame "
1088 "that was received just before association "
1090 wpa_supplicant_rx_eapol(
1091 wpa_s, wpa_s->pending_eapol_rx_src,
1092 wpabuf_head(wpa_s->pending_eapol_rx),
1093 wpabuf_len(wpa_s->pending_eapol_rx));
1095 wpabuf_free(wpa_s->pending_eapol_rx);
1096 wpa_s->pending_eapol_rx = NULL;
1099 #ifdef CONFIG_BGSCAN
1100 if (wpa_s->current_ssid != wpa_s->bgscan_ssid) {
1101 bgscan_deinit(wpa_s);
1102 if (wpa_s->current_ssid && wpa_s->current_ssid->bgscan) {
1103 if (bgscan_init(wpa_s, wpa_s->current_ssid)) {
1104 wpa_printf(MSG_DEBUG, "Failed to initialize "
1107 * Live without bgscan; it is only used as a
1108 * roaming optimization, so the initial
1109 * connection is not affected.
1112 wpa_s->bgscan_ssid = wpa_s->current_ssid;
1114 wpa_s->bgscan_ssid = NULL;
1116 #endif /* CONFIG_BGSCAN */
1118 if ((wpa_s->key_mgmt == WPA_KEY_MGMT_NONE ||
1119 wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA) &&
1120 wpa_s->current_ssid && wpa_drv_get_capa(wpa_s, &capa) == 0 &&
1121 capa.flags & WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE) {
1122 /* Set static WEP keys again */
1123 wpa_set_wep_keys(wpa_s, wpa_s->current_ssid);
1128 static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s)
1133 u8 prev_pending_bssid[ETH_ALEN];
1135 authenticating = wpa_s->wpa_state == WPA_AUTHENTICATING;
1136 os_memcpy(prev_pending_bssid, wpa_s->pending_bssid, ETH_ALEN);
1137 #endif /* CONFIG_SME */
1139 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
1141 * At least Host AP driver and a Prism3 card seemed to be
1142 * generating streams of disconnected events when configuring
1143 * IBSS for WPA-None. Ignore them for now.
1145 wpa_printf(MSG_DEBUG, "Disconnect event - ignore in "
1146 "IBSS/WPA-None mode");
1150 if (wpa_s->wpa_state == WPA_4WAY_HANDSHAKE &&
1151 wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
1152 wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - "
1153 "pre-shared key may be incorrect");
1155 if (wpa_s->wpa_state >= WPA_ASSOCIATED)
1156 wpa_supplicant_req_scan(wpa_s, 0, 100000);
1157 bssid = wpa_s->bssid;
1158 if (is_zero_ether_addr(bssid))
1159 bssid = wpa_s->pending_bssid;
1160 wpa_blacklist_add(wpa_s, bssid);
1161 wpa_sm_notify_disassoc(wpa_s->wpa);
1162 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "- Disconnect event - "
1164 if (wpa_supplicant_dynamic_keys(wpa_s)) {
1165 wpa_s->keys_cleared = 0;
1166 wpa_clear_keys(wpa_s, wpa_s->bssid);
1168 wpa_supplicant_mark_disassoc(wpa_s);
1169 bgscan_deinit(wpa_s);
1171 if (authenticating &&
1172 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) {
1174 * mac80211-workaround to force deauth on failed auth cmd,
1175 * requires us to remain in authenticating state to allow the
1176 * second authentication attempt to be continued properly.
1178 wpa_printf(MSG_DEBUG, "SME: Allow pending authentication to "
1179 "proceed after disconnection event");
1180 wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING);
1181 os_memcpy(wpa_s->pending_bssid, prev_pending_bssid, ETH_ALEN);
1183 #endif /* CONFIG_SME */
1187 #ifdef CONFIG_DELAYED_MIC_ERROR_REPORT
1188 static void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx,
1191 struct wpa_supplicant *wpa_s = eloop_ctx;
1193 if (!wpa_s->pending_mic_error_report)
1196 wpa_printf(MSG_DEBUG, "WPA: Sending pending MIC error report");
1197 wpa_sm_key_request(wpa_s->wpa, 1, wpa_s->pending_mic_error_pairwise);
1198 wpa_s->pending_mic_error_report = 0;
1200 #endif /* CONFIG_DELAYED_MIC_ERROR_REPORT */
1204 wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s,
1205 union wpa_event_data *data)
1210 wpa_msg(wpa_s, MSG_WARNING, "Michael MIC failure detected");
1211 pairwise = (data && data->michael_mic_failure.unicast);
1213 if ((wpa_s->last_michael_mic_error &&
1214 t.sec - wpa_s->last_michael_mic_error <= 60) ||
1215 wpa_s->pending_mic_error_report) {
1216 if (wpa_s->pending_mic_error_report) {
1218 * Send the pending MIC error report immediately since
1219 * we are going to start countermeasures and AP better
1222 wpa_sm_key_request(wpa_s->wpa, 1,
1223 wpa_s->pending_mic_error_pairwise);
1226 /* Send the new MIC error report immediately since we are going
1227 * to start countermeasures and AP better do the same.
1229 wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
1231 /* initialize countermeasures */
1232 wpa_s->countermeasures = 1;
1233 wpa_msg(wpa_s, MSG_WARNING, "TKIP countermeasures started");
1236 * Need to wait for completion of request frame. We do not get
1237 * any callback for the message completion, so just wait a
1238 * short while and hope for the best. */
1241 wpa_drv_set_countermeasures(wpa_s, 1);
1242 wpa_supplicant_deauthenticate(wpa_s,
1243 WLAN_REASON_MICHAEL_MIC_FAILURE);
1244 eloop_cancel_timeout(wpa_supplicant_stop_countermeasures,
1246 eloop_register_timeout(60, 0,
1247 wpa_supplicant_stop_countermeasures,
1249 /* TODO: mark the AP rejected for 60 second. STA is
1250 * allowed to associate with another AP.. */
1252 #ifdef CONFIG_DELAYED_MIC_ERROR_REPORT
1253 if (wpa_s->mic_errors_seen) {
1255 * Reduce the effectiveness of Michael MIC error
1256 * reports as a means for attacking against TKIP if
1257 * more than one MIC failure is noticed with the same
1258 * PTK. We delay the transmission of the reports by a
1259 * random time between 0 and 60 seconds in order to
1260 * force the attacker wait 60 seconds before getting
1261 * the information on whether a frame resulted in a MIC
1267 if (os_get_random(rval, sizeof(rval)) < 0)
1268 sec = os_random() % 60;
1270 sec = WPA_GET_BE32(rval) % 60;
1271 wpa_printf(MSG_DEBUG, "WPA: Delay MIC error report %d "
1273 wpa_s->pending_mic_error_report = 1;
1274 wpa_s->pending_mic_error_pairwise = pairwise;
1275 eloop_cancel_timeout(
1276 wpa_supplicant_delayed_mic_error_report,
1278 eloop_register_timeout(
1279 sec, os_random() % 1000000,
1280 wpa_supplicant_delayed_mic_error_report,
1283 wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
1285 #else /* CONFIG_DELAYED_MIC_ERROR_REPORT */
1286 wpa_sm_key_request(wpa_s->wpa, 1, pairwise);
1287 #endif /* CONFIG_DELAYED_MIC_ERROR_REPORT */
1289 wpa_s->last_michael_mic_error = t.sec;
1290 wpa_s->mic_errors_seen++;
1294 #ifdef CONFIG_TERMINATE_ONLASTIF
1295 static int any_interfaces(struct wpa_supplicant *head)
1297 struct wpa_supplicant *wpa_s;
1299 for (wpa_s = head; wpa_s != NULL; wpa_s = wpa_s->next)
1300 if (!wpa_s->interface_removed)
1304 #endif /* CONFIG_TERMINATE_ONLASTIF */
1308 wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
1309 union wpa_event_data *data)
1311 if (os_strcmp(wpa_s->ifname, data->interface_status.ifname) != 0)
1314 switch (data->interface_status.ievent) {
1315 case EVENT_INTERFACE_ADDED:
1316 if (!wpa_s->interface_removed)
1318 wpa_s->interface_removed = 0;
1319 wpa_printf(MSG_DEBUG, "Configured interface was added.");
1320 if (wpa_supplicant_driver_init(wpa_s) < 0) {
1321 wpa_printf(MSG_INFO, "Failed to initialize the driver "
1322 "after interface was added.");
1325 case EVENT_INTERFACE_REMOVED:
1326 wpa_printf(MSG_DEBUG, "Configured interface was removed.");
1327 wpa_s->interface_removed = 1;
1328 wpa_supplicant_mark_disassoc(wpa_s);
1329 l2_packet_deinit(wpa_s->l2);
1331 #ifdef CONFIG_TERMINATE_ONLASTIF
1332 /* check if last interface */
1333 if (!any_interfaces(wpa_s->global->ifaces))
1335 #endif /* CONFIG_TERMINATE_ONLASTIF */
1341 #ifdef CONFIG_PEERKEY
1343 wpa_supplicant_event_stkstart(struct wpa_supplicant *wpa_s,
1344 union wpa_event_data *data)
1348 wpa_sm_stkstart(wpa_s->wpa, data->stkstart.peer);
1350 #endif /* CONFIG_PEERKEY */
1353 #ifdef CONFIG_IEEE80211R
1355 wpa_supplicant_event_ft_response(struct wpa_supplicant *wpa_s,
1356 union wpa_event_data *data)
1361 if (wpa_ft_process_response(wpa_s->wpa, data->ft_ies.ies,
1362 data->ft_ies.ies_len,
1363 data->ft_ies.ft_action,
1364 data->ft_ies.target_ap,
1365 data->ft_ies.ric_ies,
1366 data->ft_ies.ric_ies_len) < 0) {
1367 /* TODO: prevent MLME/driver from trying to associate? */
1370 #endif /* CONFIG_IEEE80211R */
1373 #ifdef CONFIG_IBSS_RSN
1374 static void wpa_supplicant_event_ibss_rsn_start(struct wpa_supplicant *wpa_s,
1375 union wpa_event_data *data)
1379 ibss_rsn_start(wpa_s->ibss_rsn, data->ibss_rsn_start.peer);
1381 #endif /* CONFIG_IBSS_RSN */
1384 void wpa_supplicant_event(void *ctx, wpa_event_type event,
1385 union wpa_event_data *data)
1387 struct wpa_supplicant *wpa_s = ctx;
1391 sme_event_auth(wpa_s, data);
1394 wpa_supplicant_event_assoc(wpa_s, data);
1396 case EVENT_DISASSOC:
1397 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
1398 sme_event_disassoc(wpa_s, data);
1401 wpa_supplicant_event_disassoc(wpa_s);
1403 case EVENT_MICHAEL_MIC_FAILURE:
1404 wpa_supplicant_event_michael_mic_failure(wpa_s, data);
1406 #ifndef CONFIG_NO_SCAN_PROCESSING
1407 case EVENT_SCAN_RESULTS:
1408 wpa_supplicant_event_scan_results(wpa_s, data);
1410 #endif /* CONFIG_NO_SCAN_PROCESSING */
1411 case EVENT_ASSOCINFO:
1412 wpa_supplicant_event_associnfo(wpa_s, data);
1414 case EVENT_INTERFACE_STATUS:
1415 wpa_supplicant_event_interface_status(wpa_s, data);
1417 case EVENT_PMKID_CANDIDATE:
1418 wpa_supplicant_event_pmkid_candidate(wpa_s, data);
1420 #ifdef CONFIG_PEERKEY
1421 case EVENT_STKSTART:
1422 wpa_supplicant_event_stkstart(wpa_s, data);
1424 #endif /* CONFIG_PEERKEY */
1425 #ifdef CONFIG_IEEE80211R
1426 case EVENT_FT_RESPONSE:
1427 wpa_supplicant_event_ft_response(wpa_s, data);
1429 #endif /* CONFIG_IEEE80211R */
1430 #ifdef CONFIG_IBSS_RSN
1431 case EVENT_IBSS_RSN_START:
1432 wpa_supplicant_event_ibss_rsn_start(wpa_s, data);
1434 #endif /* CONFIG_IBSS_RSN */
1435 case EVENT_ASSOC_REJECT:
1436 sme_event_assoc_reject(wpa_s, data);
1438 case EVENT_AUTH_TIMED_OUT:
1439 sme_event_auth_timed_out(wpa_s, data);
1441 case EVENT_ASSOC_TIMED_OUT:
1442 sme_event_assoc_timed_out(wpa_s, data);
1445 case EVENT_TX_STATUS:
1446 if (wpa_s->ap_iface == NULL)
1448 switch (data->tx_status.type) {
1449 case WLAN_FC_TYPE_MGMT:
1450 ap_mgmt_tx_cb(wpa_s, data->tx_status.data,
1451 data->tx_status.data_len,
1452 data->tx_status.stype,
1453 data->tx_status.ack);
1455 case WLAN_FC_TYPE_DATA:
1456 ap_tx_status(wpa_s, data->tx_status.dst,
1457 data->tx_status.data,
1458 data->tx_status.data_len,
1459 data->tx_status.ack);
1463 case EVENT_RX_FROM_UNKNOWN:
1464 if (wpa_s->ap_iface == NULL)
1466 ap_rx_from_unknown_sta(wpa_s, data->rx_from_unknown.hdr,
1467 data->rx_from_unknown.len);
1470 if (wpa_s->ap_iface == NULL)
1472 ap_mgmt_rx(wpa_s, data->rx_mgmt.frame,
1473 data->rx_mgmt.frame_len, data->rx_mgmt.fi);
1475 #endif /* CONFIG_AP */
1477 wpa_printf(MSG_INFO, "Unknown event %d", event);