2 * WPA Supplicant - Driver event processing
3 * Copyright (c) 2003-2006, Jouni Malinen <jkmaline@cc.hut.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.
25 #include "wpa_supplicant.h"
27 #include "l2_packet.h"
28 #include "wpa_supplicant_i.h"
29 #include "pcsc_funcs.h"
35 static int wpa_supplicant_select_config(struct wpa_supplicant
*wpa_s
)
37 struct wpa_ssid
*ssid
;
39 if (wpa_s
->conf
->ap_scan
== 1 && wpa_s
->current_ssid
)
42 ssid
= wpa_supplicant_get_ssid(wpa_s
);
44 wpa_printf(MSG_INFO
, "No network configuration found for the "
50 wpa_printf(MSG_DEBUG
, "Selected network is disabled");
54 wpa_printf(MSG_DEBUG
, "Network configuration found for the current "
56 if (ssid
->key_mgmt
& (WPA_KEY_MGMT_PSK
| WPA_KEY_MGMT_IEEE8021X
|
57 WPA_KEY_MGMT_WPA_NONE
)) {
59 size_t wpa_ie_len
= sizeof(wpa_ie
);
60 wpa_supplicant_set_suites(wpa_s
, NULL
, ssid
,
63 wpa_supplicant_set_non_wpa_policy(wpa_s
, ssid
);
66 wpa_s
->current_ssid
= ssid
;
67 wpa_sm_set_config(wpa_s
->wpa
, wpa_s
->current_ssid
);
68 wpa_supplicant_initiate_eapol(wpa_s
);
74 static void wpa_supplicant_stop_countermeasures(void *eloop_ctx
,
77 struct wpa_supplicant
*wpa_s
= eloop_ctx
;
79 if (wpa_s
->countermeasures
) {
80 wpa_s
->countermeasures
= 0;
81 wpa_drv_set_countermeasures(wpa_s
, 0);
82 wpa_msg(wpa_s
, MSG_INFO
, "WPA: TKIP countermeasures stopped");
83 wpa_supplicant_req_scan(wpa_s
, 0, 0);
88 static void wpa_supplicant_mark_disassoc(struct wpa_supplicant
*wpa_s
)
90 wpa_supplicant_set_state(wpa_s
, WPA_DISCONNECTED
);
91 memset(wpa_s
->bssid
, 0, ETH_ALEN
);
92 eapol_sm_notify_portEnabled(wpa_s
->eapol
, FALSE
);
93 eapol_sm_notify_portValid(wpa_s
->eapol
, FALSE
);
94 if (wpa_s
->key_mgmt
== WPA_KEY_MGMT_PSK
)
95 eapol_sm_notify_eap_success(wpa_s
->eapol
, FALSE
);
99 static void wpa_find_assoc_pmkid(struct wpa_supplicant
*wpa_s
)
101 struct wpa_ie_data ie
;
102 int i
, pmksa_set
= -1;
104 if (wpa_sm_parse_own_wpa_ie(wpa_s
->wpa
, &ie
) < 0 ||
108 for (i
= 0; i
< ie
.num_pmkid
; i
++) {
109 pmksa_set
= pmksa_cache_set_current(wpa_s
->wpa
,
110 ie
.pmkid
+ i
* PMKID_LEN
,
112 if (pmksa_set
== 0) {
113 eapol_sm_notify_pmkid_attempt(wpa_s
->eapol
, 1);
118 wpa_printf(MSG_DEBUG
, "RSN: PMKID from assoc IE %sfound from PMKSA "
119 "cache", pmksa_set
== 0 ? "" : "not ");
123 static void wpa_supplicant_event_pmkid_candidate(struct wpa_supplicant
*wpa_s
,
124 union wpa_event_data
*data
)
127 wpa_printf(MSG_DEBUG
, "RSN: No data in PMKID candidate event");
130 wpa_printf(MSG_DEBUG
, "RSN: PMKID candidate event - bssid=" MACSTR
131 " index=%d preauth=%d",
132 MAC2STR(data
->pmkid_candidate
.bssid
),
133 data
->pmkid_candidate
.index
,
134 data
->pmkid_candidate
.preauth
);
136 pmksa_candidate_add(wpa_s
->wpa
, data
->pmkid_candidate
.bssid
,
137 data
->pmkid_candidate
.index
,
138 data
->pmkid_candidate
.preauth
);
142 static int wpa_supplicant_dynamic_keys(struct wpa_supplicant
*wpa_s
)
144 if (wpa_s
->key_mgmt
== WPA_KEY_MGMT_NONE
||
145 wpa_s
->key_mgmt
== WPA_KEY_MGMT_WPA_NONE
)
148 if (wpa_s
->key_mgmt
== WPA_KEY_MGMT_IEEE8021X_NO_WPA
&&
149 wpa_s
->current_ssid
&&
150 !(wpa_s
->current_ssid
->eapol_flags
&
151 (EAPOL_FLAG_REQUIRE_KEY_UNICAST
|
152 EAPOL_FLAG_REQUIRE_KEY_BROADCAST
))) {
153 /* IEEE 802.1X, but not using dynamic WEP keys (i.e., either
154 * plaintext or static WEP keys). */
163 * wpa_supplicant_scard_init - Initialize SIM/USIM access with PC/SC
164 * @wpa_s: pointer to wpa_supplicant data
165 * @ssid: Configuration data for the network
166 * Returns: 0 on success, -1 on failure
168 * This function is called when starting authentication with a network that is
169 * configured to use PC/SC for SIM/USIM access (EAP-SIM or EAP-AKA).
171 int wpa_supplicant_scard_init(struct wpa_supplicant
*wpa_s
,
172 struct wpa_ssid
*ssid
)
174 int aka
= 0, sim
= 0, type
;
176 if (ssid
->pcsc
== NULL
|| wpa_s
->scard
!= NULL
)
179 if (ssid
->eap_methods
== NULL
) {
183 u8
*eap
= ssid
->eap_methods
;
184 while (*eap
!= EAP_TYPE_NONE
) {
185 if (*eap
== EAP_TYPE_SIM
)
187 else if (*eap
== EAP_TYPE_AKA
)
201 wpa_printf(MSG_DEBUG
, "Selected network is configured to use "
202 "SIM, but neither EAP-SIM nor EAP-AKA are enabled");
206 wpa_printf(MSG_DEBUG
, "Selected network is configured to use SIM "
207 "(sim=%d aka=%d) - initialize PCSC", sim
, aka
);
209 type
= SCARD_TRY_BOTH
;
211 type
= SCARD_USIM_ONLY
;
213 type
= SCARD_GSM_SIM_ONLY
;
215 wpa_s
->scard
= scard_init(type
);
216 if (wpa_s
->scard
== NULL
) {
217 wpa_printf(MSG_WARNING
, "Failed to initialize SIM "
221 wpa_sm_set_scard_ctx(wpa_s
->wpa
, wpa_s
->scard
);
222 eapol_sm_register_scard_ctx(wpa_s
->eapol
, wpa_s
->scard
);
228 static int wpa_supplicant_match_privacy(struct wpa_scan_result
*bss
,
229 struct wpa_ssid
*ssid
)
233 for (i
= 0; i
< NUM_WEP_KEYS
; i
++) {
234 if (ssid
->wep_key_len
[i
]) {
239 if ((ssid
->key_mgmt
& WPA_KEY_MGMT_IEEE8021X_NO_WPA
) &&
240 ssid
->eapol_flags
& (EAPOL_FLAG_REQUIRE_KEY_UNICAST
|
241 EAPOL_FLAG_REQUIRE_KEY_BROADCAST
))
244 if (bss
->caps
& IEEE80211_CAP_PRIVACY
)
250 static int wpa_supplicant_ssid_bss_match(struct wpa_ssid
*ssid
,
251 struct wpa_scan_result
*bss
)
253 struct wpa_ie_data ie
;
256 while ((ssid
->proto
& WPA_PROTO_RSN
) && bss
->rsn_ie_len
> 0) {
259 if (wpa_parse_wpa_ie(bss
->rsn_ie
, bss
->rsn_ie_len
, &ie
)) {
260 wpa_printf(MSG_DEBUG
, " skip RSN IE - parse failed");
263 if (!(ie
.proto
& ssid
->proto
)) {
264 wpa_printf(MSG_DEBUG
, " skip RSN IE - proto "
269 if (!(ie
.pairwise_cipher
& ssid
->pairwise_cipher
)) {
270 wpa_printf(MSG_DEBUG
, " skip RSN IE - PTK cipher "
275 if (!(ie
.group_cipher
& ssid
->group_cipher
)) {
276 wpa_printf(MSG_DEBUG
, " skip RSN IE - GTK cipher "
281 if (!(ie
.key_mgmt
& ssid
->key_mgmt
)) {
282 wpa_printf(MSG_DEBUG
, " skip RSN IE - key mgmt "
287 wpa_printf(MSG_DEBUG
, " selected based on RSN IE");
291 while ((ssid
->proto
& WPA_PROTO_WPA
) && bss
->wpa_ie_len
> 0) {
294 if (wpa_parse_wpa_ie(bss
->wpa_ie
, bss
->wpa_ie_len
, &ie
)) {
295 wpa_printf(MSG_DEBUG
, " skip WPA IE - parse failed");
298 if (!(ie
.proto
& ssid
->proto
)) {
299 wpa_printf(MSG_DEBUG
, " skip WPA IE - proto "
304 if (!(ie
.pairwise_cipher
& ssid
->pairwise_cipher
)) {
305 wpa_printf(MSG_DEBUG
, " skip WPA IE - PTK cipher "
310 if (!(ie
.group_cipher
& ssid
->group_cipher
)) {
311 wpa_printf(MSG_DEBUG
, " skip WPA IE - GTK cipher "
316 if (!(ie
.key_mgmt
& ssid
->key_mgmt
)) {
317 wpa_printf(MSG_DEBUG
, " skip WPA IE - key mgmt "
322 wpa_printf(MSG_DEBUG
, " selected based on WPA IE");
326 if (proto_match
== 0)
327 wpa_printf(MSG_DEBUG
, " skip - no WPA/RSN proto match");
333 static struct wpa_scan_result
*
334 wpa_supplicant_select_bss(struct wpa_supplicant
*wpa_s
, struct wpa_ssid
*group
,
335 struct wpa_scan_result
*results
, int num
,
336 struct wpa_ssid
**selected_ssid
)
338 struct wpa_ssid
*ssid
;
339 struct wpa_scan_result
*bss
, *selected
= NULL
;
341 struct wpa_blacklist
*e
;
343 wpa_printf(MSG_DEBUG
, "Selecting BSS from priority group %d",
348 /* First, try to find WPA-enabled AP */
349 for (i
= 0; i
< num
&& !selected
; i
++) {
351 wpa_printf(MSG_DEBUG
, "%d: " MACSTR
" ssid='%s' "
352 "wpa_ie_len=%lu rsn_ie_len=%lu caps=0x%x",
353 i
, MAC2STR(bss
->bssid
),
354 wpa_ssid_txt(bss
->ssid
, bss
->ssid_len
),
355 (unsigned long) bss
->wpa_ie_len
,
356 (unsigned long) bss
->rsn_ie_len
, bss
->caps
);
357 if ((e
= wpa_blacklist_get(wpa_s
, bss
->bssid
)) &&
359 wpa_printf(MSG_DEBUG
, " skip - blacklisted");
363 if (bss
->wpa_ie_len
== 0 && bss
->rsn_ie_len
== 0) {
364 wpa_printf(MSG_DEBUG
, " skip - no WPA/RSN IE");
368 for (ssid
= group
; ssid
; ssid
= ssid
->pnext
) {
371 if (bss
->ssid_len
!= ssid
->ssid_len
||
372 memcmp(bss
->ssid
, ssid
->ssid
,
373 bss
->ssid_len
) != 0) {
374 wpa_printf(MSG_DEBUG
, " skip - "
378 if (ssid
->bssid_set
&&
379 memcmp(bss
->bssid
, ssid
->bssid
, ETH_ALEN
) != 0) {
380 wpa_printf(MSG_DEBUG
, " skip - "
384 if (wpa_supplicant_ssid_bss_match(ssid
, bss
)) {
386 *selected_ssid
= ssid
;
392 /* If no WPA-enabled AP found, try to find non-WPA AP, if configuration
394 for (i
= 0; i
< num
&& !selected
; i
++) {
396 if ((e
= wpa_blacklist_get(wpa_s
, bss
->bssid
)) &&
400 for (ssid
= group
; ssid
; ssid
= ssid
->pnext
) {
401 if (!ssid
->disabled
&&
402 (ssid
->ssid_len
== 0 ||
403 (bss
->ssid_len
== ssid
->ssid_len
&&
404 memcmp(bss
->ssid
, ssid
->ssid
, bss
->ssid_len
) ==
407 memcmp(bss
->bssid
, ssid
->bssid
, ETH_ALEN
) == 0) &&
408 ((ssid
->key_mgmt
& WPA_KEY_MGMT_NONE
) ||
409 (ssid
->key_mgmt
& WPA_KEY_MGMT_IEEE8021X_NO_WPA
))
410 && bss
->wpa_ie_len
== 0 && bss
->rsn_ie_len
== 0 &&
411 wpa_supplicant_match_privacy(bss
, ssid
) &&
412 !(bss
->caps
& IEEE80211_CAP_IBSS
))
415 *selected_ssid
= ssid
;
416 wpa_printf(MSG_DEBUG
, " selected non-WPA AP "
419 wpa_ssid_txt(bss
->ssid
,
430 static void wpa_supplicant_event_scan_results(struct wpa_supplicant
*wpa_s
)
433 struct wpa_scan_result
*selected
= NULL
;
434 struct wpa_ssid
*ssid
= NULL
;
435 struct wpa_scan_result
*results
;
437 if (wpa_supplicant_get_scan_results(wpa_s
) < 0) {
438 if (wpa_s
->conf
->ap_scan
== 2)
440 wpa_printf(MSG_DEBUG
, "Failed to get scan results - try "
442 wpa_supplicant_req_scan(wpa_s
, 1, 0);
445 if (wpa_s
->conf
->ap_scan
== 2)
447 results
= wpa_s
->scan_results
;
448 num
= wpa_s
->num_scan_results
;
450 while (selected
== NULL
) {
451 for (prio
= 0; prio
< wpa_s
->conf
->num_prio
; prio
++) {
452 selected
= wpa_supplicant_select_bss(
453 wpa_s
, wpa_s
->conf
->pssid
[prio
], results
, num
,
459 if (selected
== NULL
&& wpa_s
->blacklist
) {
460 wpa_printf(MSG_DEBUG
, "No APs found - clear blacklist "
462 wpa_blacklist_clear(wpa_s
);
463 } else if (selected
== NULL
) {
469 if (wpa_s
->reassociate
||
470 memcmp(selected
->bssid
, wpa_s
->bssid
, ETH_ALEN
) != 0) {
471 if (wpa_supplicant_scard_init(wpa_s
, ssid
)) {
472 wpa_supplicant_req_scan(wpa_s
, 10, 0);
475 wpa_supplicant_associate(wpa_s
, selected
, ssid
);
477 wpa_printf(MSG_DEBUG
, "Already associated with the "
480 rsn_preauth_scan_results(wpa_s
->wpa
, results
, num
);
482 wpa_printf(MSG_DEBUG
, "No suitable AP found.");
483 wpa_supplicant_req_scan(wpa_s
, 5, 0);
488 static void wpa_supplicant_event_associnfo(struct wpa_supplicant
*wpa_s
,
489 union wpa_event_data
*data
)
491 int l
, len
, found
= 0, wpa_found
, rsn_found
;
494 wpa_printf(MSG_DEBUG
, "Association info event");
495 if (data
->assoc_info
.req_ies
)
496 wpa_hexdump(MSG_DEBUG
, "req_ies", data
->assoc_info
.req_ies
,
497 data
->assoc_info
.req_ies_len
);
498 if (data
->assoc_info
.resp_ies
)
499 wpa_hexdump(MSG_DEBUG
, "resp_ies", data
->assoc_info
.resp_ies
,
500 data
->assoc_info
.resp_ies_len
);
501 if (data
->assoc_info
.beacon_ies
)
502 wpa_hexdump(MSG_DEBUG
, "beacon_ies",
503 data
->assoc_info
.beacon_ies
,
504 data
->assoc_info
.beacon_ies_len
);
506 p
= data
->assoc_info
.req_ies
;
507 l
= data
->assoc_info
.req_ies_len
;
509 /* Go through the IEs and make a copy of the WPA/RSN IE, if present. */
510 while (p
&& l
>= 2) {
513 wpa_hexdump(MSG_DEBUG
, "Truncated IE in assoc_info",
517 if ((p
[0] == GENERIC_INFO_ELEM
&& p
[1] >= 6 &&
518 (memcmp(&p
[2], "\x00\x50\xF2\x01\x01\x00", 6) == 0)) ||
519 (p
[0] == RSN_INFO_ELEM
&& p
[1] >= 2)) {
520 if (wpa_sm_set_assoc_wpa_ie(wpa_s
->wpa
, p
, len
))
523 wpa_find_assoc_pmkid(wpa_s
);
529 if (!found
&& data
->assoc_info
.req_ies
)
530 wpa_sm_set_assoc_wpa_ie(wpa_s
->wpa
, NULL
, 0);
532 /* WPA/RSN IE from Beacon/ProbeResp */
533 p
= data
->assoc_info
.beacon_ies
;
534 l
= data
->assoc_info
.beacon_ies_len
;
536 /* Go through the IEs and make a copy of the WPA/RSN IEs, if present.
538 wpa_found
= rsn_found
= 0;
539 while (p
&& l
>= 2) {
542 wpa_hexdump(MSG_DEBUG
, "Truncated IE in beacon_ies",
547 p
[0] == GENERIC_INFO_ELEM
&& p
[1] >= 6 &&
548 memcmp(&p
[2], "\x00\x50\xF2\x01\x01\x00", 6) == 0) {
550 wpa_sm_set_ap_wpa_ie(wpa_s
->wpa
, p
, len
);
554 p
[0] == RSN_INFO_ELEM
&& p
[1] >= 2) {
556 wpa_sm_set_ap_rsn_ie(wpa_s
->wpa
, p
, len
);
563 if (!wpa_found
&& data
->assoc_info
.beacon_ies
)
564 wpa_sm_set_ap_wpa_ie(wpa_s
->wpa
, NULL
, 0);
565 if (!rsn_found
&& data
->assoc_info
.beacon_ies
)
566 wpa_sm_set_ap_rsn_ie(wpa_s
->wpa
, NULL
, 0);
570 static void wpa_supplicant_event_assoc(struct wpa_supplicant
*wpa_s
,
571 union wpa_event_data
*data
)
576 wpa_supplicant_event_associnfo(wpa_s
, data
);
578 wpa_supplicant_set_state(wpa_s
, WPA_ASSOCIATED
);
579 if (wpa_drv_get_bssid(wpa_s
, bssid
) >= 0 &&
580 memcmp(bssid
, wpa_s
->bssid
, ETH_ALEN
) != 0) {
581 wpa_msg(wpa_s
, MSG_DEBUG
, "Associated to a new BSS: BSSID="
582 MACSTR
, MAC2STR(bssid
));
583 memcpy(wpa_s
->bssid
, bssid
, ETH_ALEN
);
584 if (wpa_supplicant_dynamic_keys(wpa_s
)) {
585 wpa_clear_keys(wpa_s
, bssid
);
587 if (wpa_supplicant_select_config(wpa_s
) < 0) {
588 wpa_supplicant_disassociate(wpa_s
,
589 REASON_DEAUTH_LEAVING
);
594 wpa_msg(wpa_s
, MSG_INFO
, "Associated with " MACSTR
, MAC2STR(bssid
));
595 if (wpa_s
->current_ssid
) {
596 /* When using scanning (ap_scan=1), SIM PC/SC interface can be
597 * initialized before association, but for other modes,
598 * initialize PC/SC here, if the current configuration needs
599 * smartcard or SIM/USIM. */
600 wpa_supplicant_scard_init(wpa_s
, wpa_s
->current_ssid
);
602 wpa_sm_notify_assoc(wpa_s
->wpa
, bssid
);
603 l2_packet_notify_auth_start(wpa_s
->l2
);
606 * Set portEnabled first to FALSE in order to get EAP state machine out
607 * of the SUCCESS state and eapSuccess cleared. Without this, EAPOL PAE
608 * state machine may transit to AUTHENTICATING state based on obsolete
609 * eapSuccess and then trigger BE_AUTH to SUCCESS and PAE to
610 * AUTHENTICATED without ever giving chance to EAP state machine to
613 eapol_sm_notify_portEnabled(wpa_s
->eapol
, FALSE
);
614 eapol_sm_notify_portValid(wpa_s
->eapol
, FALSE
);
615 if (wpa_s
->key_mgmt
== WPA_KEY_MGMT_PSK
)
616 eapol_sm_notify_eap_success(wpa_s
->eapol
, FALSE
);
617 /* 802.1X::portControl = Auto */
618 eapol_sm_notify_portEnabled(wpa_s
->eapol
, TRUE
);
619 wpa_s
->eapol_received
= 0;
620 if (wpa_s
->key_mgmt
== WPA_KEY_MGMT_NONE
||
621 wpa_s
->key_mgmt
== WPA_KEY_MGMT_WPA_NONE
) {
622 wpa_supplicant_cancel_auth_timeout(wpa_s
);
623 wpa_supplicant_set_state(wpa_s
, WPA_COMPLETED
);
625 /* Timeout for receiving the first EAPOL packet */
626 wpa_supplicant_req_auth_timeout(wpa_s
, 10, 0);
631 static void wpa_supplicant_event_disassoc(struct wpa_supplicant
*wpa_s
)
633 if (wpa_s
->key_mgmt
== WPA_KEY_MGMT_WPA_NONE
) {
635 * At least Host AP driver and a Prism3 card seemed to be
636 * generating streams of disconnected events when configuring
637 * IBSS for WPA-None. Ignore them for now.
639 wpa_printf(MSG_DEBUG
, "Disconnect event - ignore in "
640 "IBSS/WPA-None mode");
644 if (wpa_s
->wpa_state
== WPA_4WAY_HANDSHAKE
&&
645 wpa_s
->key_mgmt
== WPA_KEY_MGMT_PSK
) {
646 wpa_msg(wpa_s
, MSG_INFO
, "WPA: 4-Way Handshake failed - "
647 "pre-shared key may be incorrect");
649 if (wpa_s
->wpa_state
>= WPA_ASSOCIATED
)
650 wpa_supplicant_req_scan(wpa_s
, 0, 100000);
651 wpa_blacklist_add(wpa_s
, wpa_s
->bssid
);
652 wpa_sm_notify_disassoc(wpa_s
->wpa
);
653 wpa_supplicant_mark_disassoc(wpa_s
);
654 wpa_msg(wpa_s
, MSG_INFO
, WPA_EVENT_DISCONNECTED
"- Disconnect event - "
656 if (wpa_supplicant_dynamic_keys(wpa_s
)) {
657 wpa_s
->keys_cleared
= 0;
658 wpa_clear_keys(wpa_s
, wpa_s
->bssid
);
664 wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant
*wpa_s
,
665 union wpa_event_data
*data
)
670 wpa_msg(wpa_s
, MSG_WARNING
, "Michael MIC failure detected");
671 pairwise
= (data
&& data
->michael_mic_failure
.unicast
);
672 wpa_sm_key_request(wpa_s
->wpa
, 1, pairwise
);
674 if (wpa_s
->last_michael_mic_error
&&
675 now
- wpa_s
->last_michael_mic_error
<= 60) {
676 /* initialize countermeasures */
677 wpa_s
->countermeasures
= 1;
678 wpa_msg(wpa_s
, MSG_WARNING
, "TKIP countermeasures started");
681 * Need to wait for completion of request frame. We do not get
682 * any callback for the message completion, so just wait a
683 * short while and hope for the best. */
686 wpa_drv_set_countermeasures(wpa_s
, 1);
687 wpa_supplicant_deauthenticate(wpa_s
,
688 REASON_MICHAEL_MIC_FAILURE
);
689 eloop_cancel_timeout(wpa_supplicant_stop_countermeasures
,
691 eloop_register_timeout(60, 0,
692 wpa_supplicant_stop_countermeasures
,
694 /* TODO: mark the AP rejected for 60 second. STA is
695 * allowed to associate with another AP.. */
697 wpa_s
->last_michael_mic_error
= now
;
702 wpa_supplicant_event_interface_status(struct wpa_supplicant
*wpa_s
,
703 union wpa_event_data
*data
)
705 if (strcmp(wpa_s
->ifname
, data
->interface_status
.ifname
) != 0)
708 switch (data
->interface_status
.ievent
) {
709 case EVENT_INTERFACE_ADDED
:
710 if (!wpa_s
->interface_removed
)
712 wpa_s
->interface_removed
= 0;
713 wpa_printf(MSG_DEBUG
, "Configured interface was added.");
714 if (wpa_supplicant_driver_init(wpa_s
, 1) < 0) {
715 wpa_printf(MSG_INFO
, "Failed to initialize the driver "
716 "after interface was added.");
719 case EVENT_INTERFACE_REMOVED
:
720 wpa_printf(MSG_DEBUG
, "Configured interface was removed.");
721 wpa_s
->interface_removed
= 1;
722 wpa_supplicant_mark_disassoc(wpa_s
);
723 l2_packet_deinit(wpa_s
->l2
);
730 void wpa_supplicant_event(struct wpa_supplicant
*wpa_s
, wpa_event_type event
,
731 union wpa_event_data
*data
)
735 wpa_supplicant_event_assoc(wpa_s
, data
);
738 wpa_supplicant_event_disassoc(wpa_s
);
740 case EVENT_MICHAEL_MIC_FAILURE
:
741 wpa_supplicant_event_michael_mic_failure(wpa_s
, data
);
743 case EVENT_SCAN_RESULTS
:
744 wpa_supplicant_event_scan_results(wpa_s
);
746 case EVENT_ASSOCINFO
:
747 wpa_supplicant_event_associnfo(wpa_s
, data
);
749 case EVENT_INTERFACE_STATUS
:
750 wpa_supplicant_event_interface_status(wpa_s
, data
);
752 case EVENT_PMKID_CANDIDATE
:
753 wpa_supplicant_event_pmkid_candidate(wpa_s
, data
);
756 wpa_printf(MSG_INFO
, "Unknown event %d", event
);