Lines Matching refs:wpa_s

52 static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
57 static int wpas_temp_disabled(struct wpa_supplicant *wpa_s, in wpas_temp_disabled() argument
69 wpas_clear_temp_disabled(wpa_s, ssid, 0); in wpas_temp_disabled()
86 static int wpas_reenabled_network_time(struct wpa_supplicant *wpa_s) in wpas_reenabled_network_time() argument
92 if (wpa_s->conf->auto_interworking && wpa_s->conf->interworking && in wpas_reenabled_network_time()
93 wpa_s->conf->cred) in wpas_reenabled_network_time()
97 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { in wpas_reenabled_network_time()
101 disabled_for = wpas_temp_disabled(wpa_s, ssid); in wpas_reenabled_network_time()
116 struct wpa_supplicant *wpa_s = eloop_ctx; in wpas_network_reenabled() local
118 if (wpa_s->disconnected || wpa_s->wpa_state != WPA_SCANNING) in wpas_network_reenabled()
121 wpa_dbg(wpa_s, MSG_DEBUG, in wpas_network_reenabled()
123 if (wpa_supplicant_fast_associate(wpa_s) != 1) { in wpas_network_reenabled()
124 wpa_supplicant_cancel_sched_scan(wpa_s); in wpas_network_reenabled()
125 wpa_supplicant_req_scan(wpa_s, 0, 0); in wpas_network_reenabled()
131 struct wpa_supplicant *wpa_s, const u8 *bssid) in wpa_supplicant_get_new_bss() argument
134 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpa_supplicant_get_new_bss()
137 bss = wpa_bss_get(wpa_s, bssid, ssid->ssid, ssid->ssid_len); in wpa_supplicant_get_new_bss()
139 bss = wpa_bss_get_bssid(wpa_s, bssid); in wpa_supplicant_get_new_bss()
145 static void wpa_supplicant_update_current_bss(struct wpa_supplicant *wpa_s) in wpa_supplicant_update_current_bss() argument
147 struct wpa_bss *bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); in wpa_supplicant_update_current_bss()
150 wpa_supplicant_update_scan_results(wpa_s); in wpa_supplicant_update_current_bss()
153 bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); in wpa_supplicant_update_current_bss()
157 wpa_s->current_bss = bss; in wpa_supplicant_update_current_bss()
161 static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s) in wpa_supplicant_select_config() argument
168 if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) { in wpa_supplicant_select_config()
169 wpa_supplicant_update_current_bss(wpa_s); in wpa_supplicant_select_config()
171 if (wpa_s->current_ssid->ssid_len == 0) in wpa_supplicant_select_config()
173 res = wpa_drv_get_ssid(wpa_s, drv_ssid); in wpa_supplicant_select_config()
175 wpa_msg(wpa_s, MSG_INFO, in wpa_supplicant_select_config()
181 if (drv_ssid_len == wpa_s->current_ssid->ssid_len && in wpa_supplicant_select_config()
182 os_memcmp(drv_ssid, wpa_s->current_ssid->ssid, in wpa_supplicant_select_config()
186 wpa_msg(wpa_s, MSG_DEBUG, in wpa_supplicant_select_config()
192 wpa_dbg(wpa_s, MSG_DEBUG, "Select network based on association " in wpa_supplicant_select_config()
194 ssid = wpa_supplicant_get_ssid(wpa_s); in wpa_supplicant_select_config()
196 wpa_msg(wpa_s, MSG_INFO, in wpa_supplicant_select_config()
201 if (wpas_network_disabled(wpa_s, ssid)) { in wpa_supplicant_select_config()
202 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is disabled"); in wpa_supplicant_select_config()
206 if (disallowed_bssid(wpa_s, wpa_s->bssid) || in wpa_supplicant_select_config()
207 disallowed_ssid(wpa_s, ssid->ssid, ssid->ssid_len)) { in wpa_supplicant_select_config()
208 wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS is disallowed"); in wpa_supplicant_select_config()
212 res = wpas_temp_disabled(wpa_s, ssid); in wpa_supplicant_select_config()
214 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is temporarily " in wpa_supplicant_select_config()
219 wpa_dbg(wpa_s, MSG_DEBUG, "Network configuration found for the " in wpa_supplicant_select_config()
224 if (wpa_supplicant_set_suites(wpa_s, NULL, ssid, in wpa_supplicant_select_config()
226 wpa_dbg(wpa_s, MSG_DEBUG, "Could not set WPA suites"); in wpa_supplicant_select_config()
228 wpa_supplicant_set_non_wpa_policy(wpa_s, ssid); in wpa_supplicant_select_config()
231 if (wpa_s->current_ssid && wpa_s->current_ssid != ssid) in wpa_supplicant_select_config()
232 eapol_sm_invalidate_cached_session(wpa_s->eapol); in wpa_supplicant_select_config()
233 old_ssid = wpa_s->current_ssid; in wpa_supplicant_select_config()
234 wpa_s->current_ssid = ssid; in wpa_supplicant_select_config()
236 wpa_supplicant_update_current_bss(wpa_s); in wpa_supplicant_select_config()
238 wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid); in wpa_supplicant_select_config()
239 wpa_supplicant_initiate_eapol(wpa_s); in wpa_supplicant_select_config()
240 if (old_ssid != wpa_s->current_ssid) in wpa_supplicant_select_config()
241 wpas_notify_network_changed(wpa_s); in wpa_supplicant_select_config()
249 struct wpa_supplicant *wpa_s = eloop_ctx; in wpa_supplicant_stop_countermeasures() local
251 if (wpa_s->countermeasures) { in wpa_supplicant_stop_countermeasures()
252 wpa_s->countermeasures = 0; in wpa_supplicant_stop_countermeasures()
253 wpa_drv_set_countermeasures(wpa_s, 0); in wpa_supplicant_stop_countermeasures()
254 wpa_msg(wpa_s, MSG_INFO, "WPA: TKIP countermeasures stopped"); in wpa_supplicant_stop_countermeasures()
263 wpa_supplicant_cancel_sched_scan(wpa_s); in wpa_supplicant_stop_countermeasures()
264 wpa_supplicant_req_scan(wpa_s, 0, 0); in wpa_supplicant_stop_countermeasures()
269 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s) in wpa_supplicant_mark_disassoc() argument
273 wnm_bss_keep_alive_deinit(wpa_s); in wpa_supplicant_mark_disassoc()
276 ibss_rsn_deinit(wpa_s->ibss_rsn); in wpa_supplicant_mark_disassoc()
277 wpa_s->ibss_rsn = NULL; in wpa_supplicant_mark_disassoc()
281 wpa_supplicant_ap_deinit(wpa_s); in wpa_supplicant_mark_disassoc()
286 wpa_drv_configure_frame_filters(wpa_s, 0); in wpa_supplicant_mark_disassoc()
289 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) in wpa_supplicant_mark_disassoc()
292 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); in wpa_supplicant_mark_disassoc()
293 bssid_changed = !is_zero_ether_addr(wpa_s->bssid); in wpa_supplicant_mark_disassoc()
294 os_memset(wpa_s->bssid, 0, ETH_ALEN); in wpa_supplicant_mark_disassoc()
295 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); in wpa_supplicant_mark_disassoc()
296 sme_clear_on_disassoc(wpa_s); in wpa_supplicant_mark_disassoc()
297 wpa_s->current_bss = NULL; in wpa_supplicant_mark_disassoc()
298 wpa_s->assoc_freq = 0; in wpa_supplicant_mark_disassoc()
301 wpas_notify_bssid_changed(wpa_s); in wpa_supplicant_mark_disassoc()
303 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); in wpa_supplicant_mark_disassoc()
304 eapol_sm_notify_portValid(wpa_s->eapol, FALSE); in wpa_supplicant_mark_disassoc()
305 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) in wpa_supplicant_mark_disassoc()
306 eapol_sm_notify_eap_success(wpa_s->eapol, FALSE); in wpa_supplicant_mark_disassoc()
307 wpa_s->ap_ies_from_associnfo = 0; in wpa_supplicant_mark_disassoc()
308 wpa_s->current_ssid = NULL; in wpa_supplicant_mark_disassoc()
309 eapol_sm_notify_config(wpa_s->eapol, NULL, NULL); in wpa_supplicant_mark_disassoc()
310 wpa_s->key_mgmt = 0; in wpa_supplicant_mark_disassoc()
312 wpas_rrm_reset(wpa_s); in wpa_supplicant_mark_disassoc()
313 wpa_s->wnmsleep_used = 0; in wpa_supplicant_mark_disassoc()
317 static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s) in wpa_find_assoc_pmkid() argument
323 if (wpa_sm_parse_own_wpa_ie(wpa_s->wpa, &ie) < 0 || in wpa_find_assoc_pmkid()
328 pmksa_set = pmksa_cache_set_current(wpa_s->wpa, in wpa_find_assoc_pmkid()
332 eapol_sm_notify_pmkid_attempt(wpa_s->eapol); in wpa_find_assoc_pmkid()
337 wpa_dbg(wpa_s, MSG_DEBUG, "RSN: PMKID from assoc IE %sfound from " in wpa_find_assoc_pmkid()
342 static void wpa_supplicant_event_pmkid_candidate(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_pmkid_candidate() argument
346 wpa_dbg(wpa_s, MSG_DEBUG, "RSN: No data in PMKID candidate " in wpa_supplicant_event_pmkid_candidate()
350 wpa_dbg(wpa_s, MSG_DEBUG, "RSN: PMKID candidate event - bssid=" MACSTR in wpa_supplicant_event_pmkid_candidate()
356 pmksa_candidate_add(wpa_s->wpa, data->pmkid_candidate.bssid, in wpa_supplicant_event_pmkid_candidate()
362 static int wpa_supplicant_dynamic_keys(struct wpa_supplicant *wpa_s) in wpa_supplicant_dynamic_keys() argument
364 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE || in wpa_supplicant_dynamic_keys()
365 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) in wpa_supplicant_dynamic_keys()
369 if (wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA && in wpa_supplicant_dynamic_keys()
370 wpa_s->current_ssid && in wpa_supplicant_dynamic_keys()
371 !(wpa_s->current_ssid->eapol_flags & in wpa_supplicant_dynamic_keys()
393 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s, in wpa_supplicant_scard_init() argument
401 wpa_s->scard != NULL || wpa_s->conf->external_sim) in wpa_supplicant_scard_init()
430 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is configured to " in wpa_supplicant_scard_init()
436 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is configured to use SIM " in wpa_supplicant_scard_init()
439 wpa_s->scard = scard_init(wpa_s->conf->pcsc_reader); in wpa_supplicant_scard_init()
440 if (wpa_s->scard == NULL) { in wpa_supplicant_scard_init()
441 wpa_msg(wpa_s, MSG_WARNING, "Failed to initialize SIM " in wpa_supplicant_scard_init()
445 wpa_sm_set_scard_ctx(wpa_s->wpa, wpa_s->scard); in wpa_supplicant_scard_init()
446 eapol_sm_register_scard_ctx(wpa_s->eapol, wpa_s->scard); in wpa_supplicant_scard_init()
504 static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s, in wpa_supplicant_ssid_bss_match() argument
514 ret = wpas_wps_ssid_bss_match(wpa_s, ssid, bss); in wpa_supplicant_ssid_bss_match()
530 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
539 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
546 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
553 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
560 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
567 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
574 wpas_get_ssid_pmf(wpa_s, ssid) == in wpa_supplicant_ssid_bss_match()
577 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
583 wpas_get_ssid_pmf(wpa_s, ssid) == in wpa_supplicant_ssid_bss_match()
586 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
593 wpas_get_ssid_pmf(wpa_s, ssid) != in wpa_supplicant_ssid_bss_match()
596 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
603 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
609 if (wpas_get_ssid_pmf(wpa_s, ssid) == MGMT_FRAME_PROTECTION_REQUIRED) { in wpa_supplicant_ssid_bss_match()
611 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
623 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
632 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
639 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
646 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
653 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
660 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
666 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
674 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
682 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
690 wpa_dbg(wpa_s, MSG_DEBUG, " allow in OSEN"); in wpa_supplicant_ssid_bss_match()
696 wpa_dbg(wpa_s, MSG_DEBUG, " allow in non-WPA/WPA2"); in wpa_supplicant_ssid_bss_match()
701 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
722 static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, in rate_match() argument
733 modes = wpa_s->hw.modes; in rate_match()
743 for (i = 0; i < wpa_s->hw.num_modes; i++) { in rate_match()
781 wpa_dbg(wpa_s, MSG_DEBUG, in rate_match()
793 wpa_dbg(wpa_s, MSG_DEBUG, in rate_match()
815 wpa_dbg(wpa_s, MSG_DEBUG, in rate_match()
871 struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s, in wpa_scan_res_match() argument
896 wpa_dbg(wpa_s, MSG_DEBUG, "%d: " MACSTR in wpa_scan_res_match()
910 e = wpa_blacklist_get(wpa_s, bss->bssid); in wpa_scan_res_match()
913 if (wpa_supplicant_enabled_networks(wpa_s) == 1) { in wpa_scan_res_match()
926 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
936 wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID not known"); in wpa_scan_res_match()
940 if (disallowed_bssid(wpa_s, bss->bssid)) { in wpa_scan_res_match()
942 wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID disallowed"); in wpa_scan_res_match()
946 if (disallowed_ssid(wpa_s, bss->ssid, bss->ssid_len)) { in wpa_scan_res_match()
948 wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID disallowed"); in wpa_scan_res_match()
958 if (wpas_network_disabled(wpa_s, ssid)) { in wpa_scan_res_match()
960 wpa_dbg(wpa_s, MSG_DEBUG, " skip - disabled"); in wpa_scan_res_match()
964 res = wpas_temp_disabled(wpa_s, ssid); in wpa_scan_res_match()
967 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
976 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
982 wpas_wps_ssid_wildcard_ok(wpa_s, ssid, bss)) in wpa_scan_res_match()
991 wpas_wps_ssid_wildcard_ok(wpa_s, ssid, bss)) in wpa_scan_res_match()
1004 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1012 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1022 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1032 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1037 if (!wpa_supplicant_ssid_bss_match(wpa_s, ssid, bss, in wpa_scan_res_match()
1046 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1054 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1061 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1068 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1076 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1083 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1091 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1100 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1106 if (!rate_match(wpa_s, bss, debug_print)) { in wpa_scan_res_match()
1108 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1118 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1129 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1141 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1149 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1158 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1173 if (os_reltime_before(&bss->last_update, &wpa_s->scan_min_time)) in wpa_scan_res_match()
1177 os_reltime_sub(&wpa_s->scan_min_time, in wpa_scan_res_match()
1180 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1188 if (wpa_s->ignore_assoc_disallow) in wpa_scan_res_match()
1195 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1201 if (wpa_is_bss_tmp_disallowed(wpa_s, bss->bssid)) { in wpa_scan_res_match()
1203 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1222 wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, in wpa_supplicant_select_bss() argument
1229 if (wpa_s->current_ssid) { in wpa_supplicant_select_bss()
1232 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_select_bss()
1234 for (i = 0; i < wpa_s->last_scan_res_used; i++) { in wpa_supplicant_select_bss()
1235 struct wpa_bss *bss = wpa_s->last_scan_res[i]; in wpa_supplicant_select_bss()
1237 ssid = wpa_scan_res_match(wpa_s, i, bss, group, in wpa_supplicant_select_bss()
1239 if (ssid != wpa_s->current_ssid) in wpa_supplicant_select_bss()
1241 wpa_dbg(wpa_s, MSG_DEBUG, "%u: " MACSTR in wpa_supplicant_select_bss()
1249 wpa_dbg(wpa_s, MSG_DEBUG, "Try to find BSS matching pre-selected network id=%d", in wpa_supplicant_select_bss()
1252 wpa_dbg(wpa_s, MSG_DEBUG, "Selecting BSS from priority group %d", in wpa_supplicant_select_bss()
1255 for (i = 0; i < wpa_s->last_scan_res_used; i++) { in wpa_supplicant_select_bss()
1256 struct wpa_bss *bss = wpa_s->last_scan_res[i]; in wpa_supplicant_select_bss()
1257 *selected_ssid = wpa_scan_res_match(wpa_s, i, bss, group, in wpa_supplicant_select_bss()
1261 wpa_dbg(wpa_s, MSG_DEBUG, " selected BSS " MACSTR in wpa_supplicant_select_bss()
1272 struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s, in wpa_supplicant_pick_network() argument
1280 if (wpa_s->last_scan_res == NULL || in wpa_supplicant_pick_network()
1281 wpa_s->last_scan_res_used == 0) in wpa_supplicant_pick_network()
1284 if (wpa_s->next_ssid) { in wpa_supplicant_pick_network()
1286 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { in wpa_supplicant_pick_network()
1287 if (ssid == wpa_s->next_ssid) in wpa_supplicant_pick_network()
1291 wpa_s->next_ssid = NULL; in wpa_supplicant_pick_network()
1295 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) { in wpa_supplicant_pick_network()
1297 wpa_s->conf->pssid[prio]->priority) { in wpa_supplicant_pick_network()
1299 wpa_s, next_ssid, selected_ssid, 1); in wpa_supplicant_pick_network()
1304 wpa_s, wpa_s->conf->pssid[prio], in wpa_supplicant_pick_network()
1310 if (selected == NULL && wpa_s->blacklist && in wpa_supplicant_pick_network()
1311 !wpa_s->countermeasures) { in wpa_supplicant_pick_network()
1312 wpa_dbg(wpa_s, MSG_DEBUG, "No APs found - clear " in wpa_supplicant_pick_network()
1314 wpa_blacklist_clear(wpa_s); in wpa_supplicant_pick_network()
1315 wpa_s->blacklist_cleared++; in wpa_supplicant_pick_network()
1325 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_pick_network()
1328 wpas_notify_network_request(wpa_s, ssid, in wpa_supplicant_pick_network()
1336 wpas_send_ctrl_req(wpa_s, ssid, field_name, txt); in wpa_supplicant_pick_network()
1345 static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s, in wpa_supplicant_req_new_scan() argument
1348 if (!wpa_supplicant_enabled_networks(wpa_s)) { in wpa_supplicant_req_new_scan()
1354 wpa_dbg(wpa_s, MSG_DEBUG, "Short-circuit new scan request " in wpa_supplicant_req_new_scan()
1356 wpa_supplicant_set_state(wpa_s, WPA_INACTIVE); in wpa_supplicant_req_new_scan()
1360 wpa_s->scan_for_connection = 1; in wpa_supplicant_req_new_scan()
1361 wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec); in wpa_supplicant_req_new_scan()
1365 int wpa_supplicant_connect(struct wpa_supplicant *wpa_s, in wpa_supplicant_connect() argument
1369 if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) { in wpa_supplicant_connect()
1370 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP in wpa_supplicant_connect()
1372 wpas_notify_wps_event_pbc_overlap(wpa_s); in wpa_supplicant_connect()
1374 if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT || in wpa_supplicant_connect()
1375 wpa_s->p2p_in_provisioning) { in wpa_supplicant_connect()
1377 wpa_s, NULL); in wpa_supplicant_connect()
1383 wpas_wps_pbc_overlap(wpa_s); in wpa_supplicant_connect()
1384 wpas_wps_cancel(wpa_s); in wpa_supplicant_connect()
1389 wpa_msg(wpa_s, MSG_DEBUG, in wpa_supplicant_connect()
1393 wpa_s->reassociate, MAC2STR(selected->bssid), in wpa_supplicant_connect()
1394 MAC2STR(wpa_s->bssid), MAC2STR(wpa_s->pending_bssid), in wpa_supplicant_connect()
1395 wpa_supplicant_state_txt(wpa_s->wpa_state), in wpa_supplicant_connect()
1396 ssid, wpa_s->current_ssid); in wpa_supplicant_connect()
1403 if (wpa_s->reassociate || in wpa_supplicant_connect()
1404 (os_memcmp(selected->bssid, wpa_s->bssid, ETH_ALEN) != 0 && in wpa_supplicant_connect()
1405 ((wpa_s->wpa_state != WPA_ASSOCIATING && in wpa_supplicant_connect()
1406 wpa_s->wpa_state != WPA_AUTHENTICATING) || in wpa_supplicant_connect()
1407 (!is_zero_ether_addr(wpa_s->pending_bssid) && in wpa_supplicant_connect()
1408 os_memcmp(selected->bssid, wpa_s->pending_bssid, ETH_ALEN) != in wpa_supplicant_connect()
1410 (is_zero_ether_addr(wpa_s->pending_bssid) && in wpa_supplicant_connect()
1411 ssid != wpa_s->current_ssid)))) { in wpa_supplicant_connect()
1412 if (wpa_supplicant_scard_init(wpa_s, ssid)) { in wpa_supplicant_connect()
1413 wpa_supplicant_req_new_scan(wpa_s, 10, 0); in wpa_supplicant_connect()
1416 wpa_msg(wpa_s, MSG_DEBUG, "Request association with " MACSTR, in wpa_supplicant_connect()
1418 wpa_supplicant_associate(wpa_s, selected, ssid); in wpa_supplicant_connect()
1420 wpa_dbg(wpa_s, MSG_DEBUG, "Already associated or trying to " in wpa_supplicant_connect()
1429 wpa_supplicant_pick_new_network(struct wpa_supplicant *wpa_s) in wpa_supplicant_pick_new_network() argument
1434 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) { in wpa_supplicant_pick_new_network()
1435 for (ssid = wpa_s->conf->pssid[prio]; ssid; ssid = ssid->pnext) in wpa_supplicant_pick_new_network()
1437 if (wpas_network_disabled(wpa_s, ssid)) in wpa_supplicant_pick_new_network()
1443 wpa_msg(wpa_s, MSG_INFO, in wpa_supplicant_pick_new_network()
1463 struct wpa_supplicant *wpa_s) in wpa_supplicant_rsn_preauth_scan_results() argument
1467 if (rsn_preauth_scan_results(wpa_s->wpa) < 0) in wpa_supplicant_rsn_preauth_scan_results()
1470 dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) { in wpa_supplicant_rsn_preauth_scan_results()
1481 rsn_preauth_scan_result(wpa_s->wpa, bss->bssid, ssid, rsn); in wpa_supplicant_rsn_preauth_scan_results()
1487 static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s, in wpa_supplicant_need_to_roam() argument
1498 if (wpa_s->reassociate) in wpa_supplicant_need_to_roam()
1500 if (wpa_s->wpa_state < WPA_ASSOCIATED) in wpa_supplicant_need_to_roam()
1502 if (wpa_s->current_ssid == NULL) in wpa_supplicant_need_to_roam()
1504 if (wpa_s->current_ssid != ssid) in wpa_supplicant_need_to_roam()
1507 if (wpas_driver_bss_selection(wpa_s)) in wpa_supplicant_need_to_roam()
1510 if (wpa_s->current_ssid->ssid) in wpa_supplicant_need_to_roam()
1511 current_bss = wpa_bss_get(wpa_s, wpa_s->bssid, in wpa_supplicant_need_to_roam()
1512 wpa_s->current_ssid->ssid, in wpa_supplicant_need_to_roam()
1513 wpa_s->current_ssid->ssid_len); in wpa_supplicant_need_to_roam()
1515 current_bss = wpa_bss_get_bssid(wpa_s, wpa_s->bssid); in wpa_supplicant_need_to_roam()
1527 wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation"); in wpa_supplicant_need_to_roam()
1528 wpa_dbg(wpa_s, MSG_DEBUG, "Current BSS: " MACSTR in wpa_supplicant_need_to_roam()
1533 wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS: " MACSTR in wpa_supplicant_need_to_roam()
1538 if (wpa_s->current_ssid->bssid_set && in wpa_supplicant_need_to_roam()
1539 os_memcmp(selected->bssid, wpa_s->current_ssid->bssid, ETH_ALEN) == in wpa_supplicant_need_to_roam()
1541 wpa_dbg(wpa_s, MSG_DEBUG, "Allow reassociation - selected BSS " in wpa_supplicant_need_to_roam()
1547 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_need_to_roam()
1556 wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - Current BSS has better " in wpa_supplicant_need_to_roam()
1562 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_need_to_roam()
1608 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_need_to_roam()
1614 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_need_to_roam()
1633 static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, in _wpa_supplicant_event_scan_results() argument
1645 if (wpa_s->ap_iface) in _wpa_supplicant_event_scan_results()
1649 wpa_supplicant_notify_scanning(wpa_s, 0); in _wpa_supplicant_event_scan_results()
1651 scan_res = wpa_supplicant_get_scan_results(wpa_s, in _wpa_supplicant_event_scan_results()
1655 if (wpa_s->conf->ap_scan == 2 || ap || in _wpa_supplicant_event_scan_results()
1656 wpa_s->scan_res_handler == scan_only_handler) in _wpa_supplicant_event_scan_results()
1662 wpa_dbg(wpa_s, MSG_DEBUG, "Failed to get scan results - try " in _wpa_supplicant_event_scan_results()
1664 wpa_supplicant_req_new_scan(wpa_s, 1, 0); in _wpa_supplicant_event_scan_results()
1690 if (own_request && wpa_s->scan_res_handler && in _wpa_supplicant_event_scan_results()
1692 void (*scan_res_handler)(struct wpa_supplicant *wpa_s, in _wpa_supplicant_event_scan_results()
1695 scan_res_handler = wpa_s->scan_res_handler; in _wpa_supplicant_event_scan_results()
1696 wpa_s->scan_res_handler = NULL; in _wpa_supplicant_event_scan_results()
1697 scan_res_handler(wpa_s, scan_res); in _wpa_supplicant_event_scan_results()
1703 wpa_dbg(wpa_s, MSG_DEBUG, "Ignore scan results in AP mode"); in _wpa_supplicant_event_scan_results()
1705 if (wpa_s->ap_iface->scan_cb) in _wpa_supplicant_event_scan_results()
1706 wpa_s->ap_iface->scan_cb(wpa_s->ap_iface); in _wpa_supplicant_event_scan_results()
1711 wpa_dbg(wpa_s, MSG_DEBUG, "New scan results available (own=%u ext=%u)", in _wpa_supplicant_event_scan_results()
1712 wpa_s->own_scan_running, in _wpa_supplicant_event_scan_results()
1714 if (wpa_s->last_scan_req == MANUAL_SCAN_REQ && in _wpa_supplicant_event_scan_results()
1715 wpa_s->manual_scan_use_id && wpa_s->own_scan_running && in _wpa_supplicant_event_scan_results()
1717 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS "id=%u", in _wpa_supplicant_event_scan_results()
1718 wpa_s->manual_scan_id); in _wpa_supplicant_event_scan_results()
1719 wpa_s->manual_scan_use_id = 0; in _wpa_supplicant_event_scan_results()
1721 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS); in _wpa_supplicant_event_scan_results()
1723 wpas_notify_scan_results(wpa_s); in _wpa_supplicant_event_scan_results()
1725 wpas_notify_scan_done(wpa_s, 1); in _wpa_supplicant_event_scan_results()
1728 …wpa_dbg(wpa_s, MSG_DEBUG, "Do not use results from externally requested scan operation for network… in _wpa_supplicant_event_scan_results()
1733 if (wnm_scan_process(wpa_s, 1) > 0) in _wpa_supplicant_event_scan_results()
1736 if (sme_proc_obss_scan(wpa_s) > 0) in _wpa_supplicant_event_scan_results()
1740 wpas_beacon_rep_scan_process(wpa_s, scan_res, &data->scan_info) > 0) in _wpa_supplicant_event_scan_results()
1743 if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s))) in _wpa_supplicant_event_scan_results()
1746 if (autoscan_notify_scan(wpa_s, scan_res)) in _wpa_supplicant_event_scan_results()
1749 if (wpa_s->disconnected) { in _wpa_supplicant_event_scan_results()
1750 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); in _wpa_supplicant_event_scan_results()
1754 if (!wpas_driver_bss_selection(wpa_s) && in _wpa_supplicant_event_scan_results()
1755 bgscan_notify_scan(wpa_s, scan_res) == 1) in _wpa_supplicant_event_scan_results()
1758 wpas_wps_update_ap_info(wpa_s, scan_res); in _wpa_supplicant_event_scan_results()
1760 if (wpa_s->wpa_state >= WPA_AUTHENTICATING && in _wpa_supplicant_event_scan_results()
1761 wpa_s->wpa_state < WPA_COMPLETED) in _wpa_supplicant_event_scan_results()
1766 if (own_request && wpa_s->scan_work) { in _wpa_supplicant_event_scan_results()
1767 struct wpa_radio_work *work = wpa_s->scan_work; in _wpa_supplicant_event_scan_results()
1768 wpa_s->scan_work = NULL; in _wpa_supplicant_event_scan_results()
1772 return wpas_select_network_from_last_scan(wpa_s, 1, own_request); in _wpa_supplicant_event_scan_results()
1776 if (own_request && wpa_s->scan_work) { in _wpa_supplicant_event_scan_results()
1777 struct wpa_radio_work *work = wpa_s->scan_work; in _wpa_supplicant_event_scan_results()
1778 wpa_s->scan_work = NULL; in _wpa_supplicant_event_scan_results()
1785 static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s, in wpas_select_network_from_last_scan() argument
1790 int time_to_reenable = wpas_reenabled_network_time(wpa_s); in wpas_select_network_from_last_scan()
1793 wpa_dbg(wpa_s, MSG_DEBUG, in wpas_select_network_from_last_scan()
1796 eloop_cancel_timeout(wpas_network_reenabled, wpa_s, NULL); in wpas_select_network_from_last_scan()
1798 wpas_network_reenabled, wpa_s, NULL); in wpas_select_network_from_last_scan()
1802 if (wpa_s->p2p_mgmt) in wpas_select_network_from_last_scan()
1805 selected = wpa_supplicant_pick_network(wpa_s, &ssid); in wpas_select_network_from_last_scan()
1808 if (wpa_s->ifmsh) { in wpas_select_network_from_last_scan()
1809 wpa_msg(wpa_s, MSG_INFO, in wpas_select_network_from_last_scan()
1817 skip = !wpa_supplicant_need_to_roam(wpa_s, selected, ssid); in wpas_select_network_from_last_scan()
1820 wpa_supplicant_rsn_preauth_scan_results(wpa_s); in wpas_select_network_from_last_scan()
1824 if (ssid != wpa_s->current_ssid && in wpas_select_network_from_last_scan()
1825 wpa_s->wpa_state >= WPA_AUTHENTICATING) { in wpas_select_network_from_last_scan()
1826 wpa_s->own_disconnect_req = 1; in wpas_select_network_from_last_scan()
1828 wpa_s, WLAN_REASON_DEAUTH_LEAVING); in wpas_select_network_from_last_scan()
1831 if (wpa_supplicant_connect(wpa_s, selected, ssid) < 0) { in wpas_select_network_from_last_scan()
1832 wpa_dbg(wpa_s, MSG_DEBUG, "Connect failed"); in wpas_select_network_from_last_scan()
1836 wpa_supplicant_rsn_preauth_scan_results(wpa_s); in wpas_select_network_from_last_scan()
1844 wpa_dbg(wpa_s, MSG_DEBUG, "No suitable network found"); in wpas_select_network_from_last_scan()
1845 ssid = wpa_supplicant_pick_new_network(wpa_s); in wpas_select_network_from_last_scan()
1847 wpa_dbg(wpa_s, MSG_DEBUG, "Setup a new network"); in wpas_select_network_from_last_scan()
1848 wpa_supplicant_associate(wpa_s, NULL, ssid); in wpas_select_network_from_last_scan()
1850 wpa_supplicant_rsn_preauth_scan_results(wpa_s); in wpas_select_network_from_last_scan()
1857 int timeout_sec = wpa_s->scan_interval; in wpas_select_network_from_last_scan()
1862 res = wpas_p2p_scan_no_go_seen(wpa_s); in wpas_select_network_from_last_scan()
1868 if (wpa_s->p2p_in_provisioning || in wpas_select_network_from_last_scan()
1869 wpa_s->show_group_started || in wpas_select_network_from_last_scan()
1870 wpa_s->p2p_in_invitation) { in wpas_select_network_from_last_scan()
1878 wpa_supplicant_req_new_scan(wpa_s, timeout_sec, in wpas_select_network_from_last_scan()
1884 if (wpa_s->conf->auto_interworking && in wpas_select_network_from_last_scan()
1885 wpa_s->conf->interworking && in wpas_select_network_from_last_scan()
1886 wpa_s->conf->cred) { in wpas_select_network_from_last_scan()
1887 wpa_dbg(wpa_s, MSG_DEBUG, "Interworking: " in wpas_select_network_from_last_scan()
1890 wpa_s->network_select = 1; in wpas_select_network_from_last_scan()
1891 wpa_s->auto_network_select = 1; in wpas_select_network_from_last_scan()
1892 interworking_start_fetch_anqp(wpa_s); in wpas_select_network_from_last_scan()
1897 if (wpa_s->after_wps > 0 || wpas_wps_searching(wpa_s)) { in wpas_select_network_from_last_scan()
1898 wpa_dbg(wpa_s, MSG_DEBUG, "Use shorter wait during WPS processing"); in wpas_select_network_from_last_scan()
1901 wpa_supplicant_req_new_scan(wpa_s, timeout_sec, in wpas_select_network_from_last_scan()
1906 if (wpa_supplicant_req_sched_scan(wpa_s)) in wpas_select_network_from_last_scan()
1907 wpa_supplicant_req_new_scan(wpa_s, timeout_sec, in wpas_select_network_from_last_scan()
1910 wpa_msg_ctrl(wpa_s, MSG_INFO, in wpas_select_network_from_last_scan()
1918 static int wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_scan_results() argument
1924 res = _wpa_supplicant_event_scan_results(wpa_s, data, 1, 0); in wpa_supplicant_event_scan_results()
1948 dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant, in wpa_supplicant_event_scan_results()
1950 if (ifs != wpa_s) { in wpa_supplicant_event_scan_results()
1966 int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s) in wpa_supplicant_fast_associate() argument
1973 wpa_s->ignore_post_flush_scan_res = 0; in wpa_supplicant_fast_associate()
1975 if (wpa_s->last_scan_res_used == 0) in wpa_supplicant_fast_associate()
1979 if (os_reltime_expired(&now, &wpa_s->last_scan, 5)) { in wpa_supplicant_fast_associate()
1984 return wpas_select_network_from_last_scan(wpa_s, 0, 1); in wpa_supplicant_fast_associate()
1992 struct wpa_supplicant *wpa_s = eloop_ctx; in wnm_bss_keep_alive() local
1994 if (wpa_s->wpa_state < WPA_ASSOCIATED) in wnm_bss_keep_alive()
1997 if (!wpa_s->no_keep_alive) { in wnm_bss_keep_alive()
1999 MAC2STR(wpa_s->bssid)); in wnm_bss_keep_alive()
2003 if (wpa_s->l2) in wnm_bss_keep_alive()
2004 l2_packet_send(wpa_s->l2, wpa_s->bssid, 0x0800, in wnm_bss_keep_alive()
2009 if (wpa_s->sme.bss_max_idle_period) { in wnm_bss_keep_alive()
2011 msec = wpa_s->sme.bss_max_idle_period * 1024; /* times 1000 */ in wnm_bss_keep_alive()
2015 wnm_bss_keep_alive, wpa_s, NULL); in wnm_bss_keep_alive()
2021 static void wnm_process_assoc_resp(struct wpa_supplicant *wpa_s, in wnm_process_assoc_resp() argument
2035 wpa_s->sme.bss_max_idle_period = in wnm_process_assoc_resp()
2038 "TU)%s", wpa_s->sme.bss_max_idle_period, in wnm_process_assoc_resp()
2041 if (wpa_s->sme.bss_max_idle_period == 0) in wnm_process_assoc_resp()
2042 wpa_s->sme.bss_max_idle_period = 1; in wnm_process_assoc_resp()
2043 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) { in wnm_process_assoc_resp()
2044 eloop_cancel_timeout(wnm_bss_keep_alive, wpa_s, NULL); in wnm_process_assoc_resp()
2046 msec = wpa_s->sme.bss_max_idle_period * 1024; in wnm_process_assoc_resp()
2050 wnm_bss_keep_alive, wpa_s, in wnm_process_assoc_resp()
2060 void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s) in wnm_bss_keep_alive_deinit() argument
2063 eloop_cancel_timeout(wnm_bss_keep_alive, wpa_s, NULL); in wnm_bss_keep_alive_deinit()
2070 static int wpas_qos_map_set(struct wpa_supplicant *wpa_s, const u8 *qos_map, in wpas_qos_map_set() argument
2076 res = wpa_drv_set_qos_map(wpa_s, qos_map, len); in wpas_qos_map_set()
2085 static void interworking_process_assoc_resp(struct wpa_supplicant *wpa_s, in interworking_process_assoc_resp() argument
2097 wpas_qos_map_set(wpa_s, elems.qos_map_set, in interworking_process_assoc_resp()
2106 static int wpas_fst_update_mbie(struct wpa_supplicant *wpa_s, in wpas_fst_update_mbie() argument
2111 if (!ie || !ie_len || !wpa_s->fst) in wpas_fst_update_mbie()
2139 wpabuf_free(wpa_s->received_mb_ies); in wpas_fst_update_mbie()
2140 wpa_s->received_mb_ies = mb_ies_by_info(&mb_ies); in wpas_fst_update_mbie()
2149 static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_associnfo() argument
2158 wpa_dbg(wpa_s, MSG_DEBUG, "Association info event"); in wpa_supplicant_event_associnfo()
2166 wpa_tdls_assoc_resp_ies(wpa_s->wpa, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
2170 wnm_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
2174 interworking_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
2183 wpa_dbg(wpa_s, MSG_DEBUG, "freq=%u MHz", in wpa_supplicant_event_associnfo()
2202 if (wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, p, len)) in wpa_supplicant_event_associnfo()
2205 wpa_find_assoc_pmkid(wpa_s); in wpa_supplicant_event_associnfo()
2212 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
2216 if (wpa_s->sme.auth_alg == WPA_AUTH_ALG_FILS && in wpa_supplicant_event_associnfo()
2218 fils_process_assoc_resp(wpa_s->wpa, in wpa_supplicant_event_associnfo()
2221 wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_UNSPECIFIED); in wpa_supplicant_event_associnfo()
2229 if (wpa_s->sme.auth_alg == WPA_AUTH_ALG_FT) { in wpa_supplicant_event_associnfo()
2230 if (wpa_drv_get_bssid(wpa_s, bssid) < 0 || in wpa_supplicant_event_associnfo()
2231 wpa_ft_validate_reassoc_resp(wpa_s->wpa, in wpa_supplicant_event_associnfo()
2235 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Validation of " in wpa_supplicant_event_associnfo()
2238 wpa_s, WLAN_REASON_INVALID_IE); in wpa_supplicant_event_associnfo()
2247 if (p && wpa_s->current_ssid && in wpa_supplicant_event_associnfo()
2248 wpa_s->current_ssid->key_mgmt == WPA_KEY_MGMT_WPS) { in wpa_supplicant_event_associnfo()
2252 wpa_msg(wpa_s, MSG_INFO, "WPS-STRICT: AP did not " in wpa_supplicant_event_associnfo()
2260 wpa_s, WLAN_REASON_INVALID_IE); in wpa_supplicant_event_associnfo()
2277 wpa_s->sme.ft_used = 1; in wpa_supplicant_event_associnfo()
2278 os_memcpy(wpa_s->sme.mobility_domain, p + 2, in wpa_supplicant_event_associnfo()
2288 if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) && in wpa_supplicant_event_associnfo()
2289 wpa_ft_is_completed(wpa_s->wpa)) { in wpa_supplicant_event_associnfo()
2290 if (wpa_drv_get_bssid(wpa_s, bssid) < 0 || in wpa_supplicant_event_associnfo()
2291 wpa_ft_validate_reassoc_resp(wpa_s->wpa, in wpa_supplicant_event_associnfo()
2295 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Validation of " in wpa_supplicant_event_associnfo()
2298 wpa_s, WLAN_REASON_INVALID_IE); in wpa_supplicant_event_associnfo()
2301 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Reassociation Response done"); in wpa_supplicant_event_associnfo()
2304 wpa_sm_set_ft_params(wpa_s->wpa, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
2326 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, p, len); in wpa_supplicant_event_associnfo()
2332 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, p, len); in wpa_supplicant_event_associnfo()
2340 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
2342 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
2344 wpa_s->ap_ies_from_associnfo = 1; in wpa_supplicant_event_associnfo()
2346 if (wpa_s->assoc_freq && data->assoc_info.freq && in wpa_supplicant_event_associnfo()
2347 wpa_s->assoc_freq != data->assoc_info.freq) { in wpa_supplicant_event_associnfo()
2350 wpa_s->assoc_freq, data->assoc_info.freq); in wpa_supplicant_event_associnfo()
2351 wpa_supplicant_update_scan_results(wpa_s); in wpa_supplicant_event_associnfo()
2354 wpa_s->assoc_freq = data->assoc_info.freq; in wpa_supplicant_event_associnfo()
2360 static int wpa_supplicant_assoc_update_ie(struct wpa_supplicant *wpa_s) in wpa_supplicant_assoc_update_ie() argument
2364 if (!wpa_s->current_bss || !wpa_s->current_ssid) in wpa_supplicant_assoc_update_ie()
2367 if (!wpa_key_mgmt_wpa_any(wpa_s->current_ssid->key_mgmt)) in wpa_supplicant_assoc_update_ie()
2370 bss_wpa = wpa_bss_get_vendor_ie(wpa_s->current_bss, in wpa_supplicant_assoc_update_ie()
2372 bss_rsn = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_RSN); in wpa_supplicant_assoc_update_ie()
2374 if (wpa_sm_set_ap_wpa_ie(wpa_s->wpa, bss_wpa, in wpa_supplicant_assoc_update_ie()
2376 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, bss_rsn, in wpa_supplicant_assoc_update_ie()
2384 static void wpas_fst_update_mb_assoc(struct wpa_supplicant *wpa_s, in wpas_fst_update_mb_assoc() argument
2389 struct wpa_bss *bss = wpa_s->current_bss; in wpas_fst_update_mb_assoc()
2392 wpabuf_free(wpa_s->received_mb_ies); in wpas_fst_update_mb_assoc()
2393 wpa_s->received_mb_ies = NULL; in wpas_fst_update_mb_assoc()
2396 !wpas_fst_update_mbie(wpa_s, ai->resp_ies, ai->resp_ies_len)) { in wpas_fst_update_mb_assoc()
2403 !wpas_fst_update_mbie(wpa_s, ai->beacon_ies, ai->beacon_ies_len)) { in wpas_fst_update_mb_assoc()
2415 if (!wpas_fst_update_mbie(wpa_s, ieprb, bss->ie_len)) in wpas_fst_update_mb_assoc()
2417 else if (!wpas_fst_update_mbie(wpa_s, iebcn, bss->beacon_ie_len)) in wpas_fst_update_mb_assoc()
2423 static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_assoc() argument
2431 if (wpa_s->ap_iface) { in wpa_supplicant_event_assoc()
2434 hostapd_notif_assoc(wpa_s->ap_iface->bss[0], in wpa_supplicant_event_assoc()
2443 eloop_cancel_timeout(wpas_network_reenabled, wpa_s, NULL); in wpa_supplicant_event_assoc()
2445 ft_completed = wpa_ft_is_completed(wpa_s->wpa); in wpa_supplicant_event_assoc()
2446 if (data && wpa_supplicant_event_associnfo(wpa_s, data) < 0) in wpa_supplicant_event_assoc()
2454 ft_completed = wpa_fils_is_completed(wpa_s->wpa); in wpa_supplicant_event_assoc()
2456 if (wpa_drv_get_bssid(wpa_s, bssid) < 0) { in wpa_supplicant_event_assoc()
2457 wpa_dbg(wpa_s, MSG_ERROR, "Failed to get BSSID"); in wpa_supplicant_event_assoc()
2459 wpa_s, WLAN_REASON_DEAUTH_LEAVING); in wpa_supplicant_event_assoc()
2463 wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATED); in wpa_supplicant_event_assoc()
2464 if (os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0) { in wpa_supplicant_event_assoc()
2465 wpa_dbg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID=" in wpa_supplicant_event_assoc()
2469 os_memcpy(wpa_s->bssid, bssid, ETH_ALEN); in wpa_supplicant_event_assoc()
2470 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); in wpa_supplicant_event_assoc()
2471 wpas_notify_bssid_changed(wpa_s); in wpa_supplicant_event_assoc()
2473 if (wpa_supplicant_dynamic_keys(wpa_s) && !ft_completed) { in wpa_supplicant_event_assoc()
2474 wpa_clear_keys(wpa_s, bssid); in wpa_supplicant_event_assoc()
2476 if (wpa_supplicant_select_config(wpa_s) < 0) { in wpa_supplicant_event_assoc()
2478 wpa_s, WLAN_REASON_DEAUTH_LEAVING); in wpa_supplicant_event_assoc()
2483 if (wpa_s->conf->ap_scan == 1 && in wpa_supplicant_event_assoc()
2484 wpa_s->drv_flags & WPA_DRIVER_FLAGS_BSS_SELECTION) { in wpa_supplicant_event_assoc()
2485 if (wpa_supplicant_assoc_update_ie(wpa_s) < 0 && new_bss) in wpa_supplicant_event_assoc()
2486 wpa_msg(wpa_s, MSG_WARNING, in wpa_supplicant_event_assoc()
2490 wpas_fst_update_mb_assoc(wpa_s, data); in wpa_supplicant_event_assoc()
2493 os_memcpy(wpa_s->sme.prev_bssid, bssid, ETH_ALEN); in wpa_supplicant_event_assoc()
2494 wpa_s->sme.prev_bssid_set = 1; in wpa_supplicant_event_assoc()
2495 wpa_s->sme.last_unprot_disconnect.sec = 0; in wpa_supplicant_event_assoc()
2498 wpa_msg(wpa_s, MSG_INFO, "Associated with " MACSTR, MAC2STR(bssid)); in wpa_supplicant_event_assoc()
2499 if (wpa_s->current_ssid) { in wpa_supplicant_event_assoc()
2504 wpa_supplicant_scard_init(wpa_s, wpa_s->current_ssid); in wpa_supplicant_event_assoc()
2506 wpa_sm_notify_assoc(wpa_s->wpa, bssid); in wpa_supplicant_event_assoc()
2507 if (wpa_s->l2) in wpa_supplicant_event_assoc()
2508 l2_packet_notify_auth_start(wpa_s->l2); in wpa_supplicant_event_assoc()
2521 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); in wpa_supplicant_event_assoc()
2522 eapol_sm_notify_portValid(wpa_s->eapol, FALSE); in wpa_supplicant_event_assoc()
2524 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || ft_completed || in wpa_supplicant_event_assoc()
2526 eapol_sm_notify_eap_success(wpa_s->eapol, FALSE); in wpa_supplicant_event_assoc()
2528 eapol_sm_notify_portEnabled(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2529 wpa_s->eapol_received = 0; in wpa_supplicant_event_assoc()
2530 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE || in wpa_supplicant_event_assoc()
2531 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE || in wpa_supplicant_event_assoc()
2532 (wpa_s->current_ssid && in wpa_supplicant_event_assoc()
2533 wpa_s->current_ssid->mode == IEEE80211_MODE_IBSS)) { in wpa_supplicant_event_assoc()
2534 if (wpa_s->current_ssid && in wpa_supplicant_event_assoc()
2535 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE && in wpa_supplicant_event_assoc()
2536 (wpa_s->drv_flags & in wpa_supplicant_event_assoc()
2542 wpa_supplicant_set_wpa_none_key(wpa_s, in wpa_supplicant_event_assoc()
2543 wpa_s->current_ssid); in wpa_supplicant_event_assoc()
2545 wpa_supplicant_cancel_auth_timeout(wpa_s); in wpa_supplicant_event_assoc()
2546 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); in wpa_supplicant_event_assoc()
2549 wpa_supplicant_req_auth_timeout(wpa_s, 10, 0); in wpa_supplicant_event_assoc()
2551 wpa_supplicant_cancel_scan(wpa_s); in wpa_supplicant_event_assoc()
2553 if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE) && in wpa_supplicant_event_assoc()
2554 wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) { in wpa_supplicant_event_assoc()
2559 wpa_supplicant_cancel_auth_timeout(wpa_s); in wpa_supplicant_event_assoc()
2560 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); in wpa_supplicant_event_assoc()
2561 eapol_sm_notify_portValid(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2562 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2563 } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE) && in wpa_supplicant_event_assoc()
2564 wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt)) { in wpa_supplicant_event_assoc()
2570 eapol_sm_notify_portValid(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2576 wpa_supplicant_cancel_auth_timeout(wpa_s); in wpa_supplicant_event_assoc()
2577 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); in wpa_supplicant_event_assoc()
2578 eapol_sm_notify_portValid(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2579 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2582 wpa_s->last_eapol_matches_bssid = 0; in wpa_supplicant_event_assoc()
2584 if (wpa_s->pending_eapol_rx) { in wpa_supplicant_event_assoc()
2587 os_reltime_sub(&now, &wpa_s->pending_eapol_rx_time, &age); in wpa_supplicant_event_assoc()
2589 os_memcmp(wpa_s->pending_eapol_rx_src, bssid, ETH_ALEN) == in wpa_supplicant_event_assoc()
2591 wpa_dbg(wpa_s, MSG_DEBUG, "Process pending EAPOL " in wpa_supplicant_event_assoc()
2595 wpa_s, wpa_s->pending_eapol_rx_src, in wpa_supplicant_event_assoc()
2596 wpabuf_head(wpa_s->pending_eapol_rx), in wpa_supplicant_event_assoc()
2597 wpabuf_len(wpa_s->pending_eapol_rx)); in wpa_supplicant_event_assoc()
2599 wpabuf_free(wpa_s->pending_eapol_rx); in wpa_supplicant_event_assoc()
2600 wpa_s->pending_eapol_rx = NULL; in wpa_supplicant_event_assoc()
2603 if ((wpa_s->key_mgmt == WPA_KEY_MGMT_NONE || in wpa_supplicant_event_assoc()
2604 wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA) && in wpa_supplicant_event_assoc()
2605 wpa_s->current_ssid && in wpa_supplicant_event_assoc()
2606 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE)) { in wpa_supplicant_event_assoc()
2608 wpa_set_wep_keys(wpa_s, wpa_s->current_ssid); in wpa_supplicant_event_assoc()
2612 if (wpa_s->current_ssid && in wpa_supplicant_event_assoc()
2613 wpa_s->current_ssid->mode == WPAS_MODE_IBSS && in wpa_supplicant_event_assoc()
2614 wpa_s->key_mgmt != WPA_KEY_MGMT_NONE && in wpa_supplicant_event_assoc()
2615 wpa_s->key_mgmt != WPA_KEY_MGMT_WPA_NONE && in wpa_supplicant_event_assoc()
2616 wpa_s->ibss_rsn == NULL) { in wpa_supplicant_event_assoc()
2617 wpa_s->ibss_rsn = ibss_rsn_init(wpa_s, wpa_s->current_ssid); in wpa_supplicant_event_assoc()
2618 if (!wpa_s->ibss_rsn) { in wpa_supplicant_event_assoc()
2619 wpa_msg(wpa_s, MSG_INFO, "Failed to init IBSS RSN"); in wpa_supplicant_event_assoc()
2621 wpa_s, WLAN_REASON_DEAUTH_LEAVING); in wpa_supplicant_event_assoc()
2625 ibss_rsn_set_psk(wpa_s->ibss_rsn, wpa_s->current_ssid->psk); in wpa_supplicant_event_assoc()
2629 wpas_wps_notify_assoc(wpa_s, bssid); in wpa_supplicant_event_assoc()
2632 wmm_ac_notify_assoc(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_assoc()
2636 if (wpa_s->reassoc_same_bss) in wpa_supplicant_event_assoc()
2637 wmm_ac_restore_tspecs(wpa_s); in wpa_supplicant_event_assoc()
2650 static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_disassoc() argument
2656 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) { in wpa_supplicant_event_disassoc()
2665 bssid = wpa_s->bssid; in wpa_supplicant_event_disassoc()
2667 bssid = wpa_s->pending_bssid; in wpa_supplicant_event_disassoc()
2670 wpa_s->wpa_state >= WPA_AUTHENTICATING) { in wpa_supplicant_event_disassoc()
2671 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" MACSTR in wpa_supplicant_event_disassoc()
2679 static int could_be_psk_mismatch(struct wpa_supplicant *wpa_s, u16 reason_code, in could_be_psk_mismatch() argument
2682 if (wpa_s->wpa_state != WPA_4WAY_HANDSHAKE || in could_be_psk_mismatch()
2683 !wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) in could_be_psk_mismatch()
2701 static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_disassoc_finish() argument
2713 authenticating = wpa_s->wpa_state == WPA_AUTHENTICATING; in wpa_supplicant_event_disassoc_finish()
2714 os_memcpy(prev_pending_bssid, wpa_s->pending_bssid, ETH_ALEN); in wpa_supplicant_event_disassoc_finish()
2716 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) { in wpa_supplicant_event_disassoc_finish()
2722 wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - ignore in " in wpa_supplicant_event_disassoc_finish()
2727 if (!wpa_s->disconnected && wpa_s->wpa_state >= WPA_AUTHENTICATING && in wpa_supplicant_event_disassoc_finish()
2738 curr = wpa_s->current_bss; in wpa_supplicant_event_disassoc_finish()
2740 if (could_be_psk_mismatch(wpa_s, reason_code, locally_generated)) { in wpa_supplicant_event_disassoc_finish()
2741 wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - " in wpa_supplicant_event_disassoc_finish()
2743 if (wpas_p2p_4way_hs_failed(wpa_s) > 0) in wpa_supplicant_event_disassoc_finish()
2745 wpas_auth_failed(wpa_s, "WRONG_KEY"); in wpa_supplicant_event_disassoc_finish()
2747 if (!wpa_s->disconnected && in wpa_supplicant_event_disassoc_finish()
2748 (!wpa_s->auto_reconnect_disabled || in wpa_supplicant_event_disassoc_finish()
2749 wpa_s->key_mgmt == WPA_KEY_MGMT_WPS || in wpa_supplicant_event_disassoc_finish()
2750 wpas_wps_searching(wpa_s) || in wpa_supplicant_event_disassoc_finish()
2751 wpas_wps_reenable_networks_pending(wpa_s))) { in wpa_supplicant_event_disassoc_finish()
2752 wpa_dbg(wpa_s, MSG_DEBUG, "Auto connect enabled: try to " in wpa_supplicant_event_disassoc_finish()
2754 wpa_s->key_mgmt == WPA_KEY_MGMT_WPS, in wpa_supplicant_event_disassoc_finish()
2755 wpas_wps_searching(wpa_s), in wpa_supplicant_event_disassoc_finish()
2756 wpa_s->wpa_state); in wpa_supplicant_event_disassoc_finish()
2757 if (wpa_s->wpa_state == WPA_COMPLETED && in wpa_supplicant_event_disassoc_finish()
2758 wpa_s->current_ssid && in wpa_supplicant_event_disassoc_finish()
2759 wpa_s->current_ssid->mode == WPAS_MODE_INFRA && in wpa_supplicant_event_disassoc_finish()
2768 fast_reconnect = wpa_s->current_bss; in wpa_supplicant_event_disassoc_finish()
2769 fast_reconnect_ssid = wpa_s->current_ssid; in wpa_supplicant_event_disassoc_finish()
2770 } else if (wpa_s->wpa_state >= WPA_ASSOCIATING) in wpa_supplicant_event_disassoc_finish()
2771 wpa_supplicant_req_scan(wpa_s, 0, 100000); in wpa_supplicant_event_disassoc_finish()
2773 wpa_dbg(wpa_s, MSG_DEBUG, "Do not request new " in wpa_supplicant_event_disassoc_finish()
2776 wpa_dbg(wpa_s, MSG_DEBUG, "Auto connect disabled: do not " in wpa_supplicant_event_disassoc_finish()
2778 wpa_s->reassociate = 0; in wpa_supplicant_event_disassoc_finish()
2779 wpa_s->disconnected = 1; in wpa_supplicant_event_disassoc_finish()
2780 if (!wpa_s->pno) in wpa_supplicant_event_disassoc_finish()
2781 wpa_supplicant_cancel_sched_scan(wpa_s); in wpa_supplicant_event_disassoc_finish()
2783 bssid = wpa_s->bssid; in wpa_supplicant_event_disassoc_finish()
2785 bssid = wpa_s->pending_bssid; in wpa_supplicant_event_disassoc_finish()
2786 if (wpa_s->wpa_state >= WPA_AUTHENTICATING) in wpa_supplicant_event_disassoc_finish()
2787 wpas_connection_failed(wpa_s, bssid); in wpa_supplicant_event_disassoc_finish()
2788 wpa_sm_notify_disassoc(wpa_s->wpa); in wpa_supplicant_event_disassoc_finish()
2790 wpa_s->disconnect_reason = -reason_code; in wpa_supplicant_event_disassoc_finish()
2792 wpa_s->disconnect_reason = reason_code; in wpa_supplicant_event_disassoc_finish()
2793 wpas_notify_disconnect_reason(wpa_s); in wpa_supplicant_event_disassoc_finish()
2794 if (wpa_supplicant_dynamic_keys(wpa_s)) { in wpa_supplicant_event_disassoc_finish()
2795 wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - remove keys"); in wpa_supplicant_event_disassoc_finish()
2796 wpa_clear_keys(wpa_s, wpa_s->bssid); in wpa_supplicant_event_disassoc_finish()
2798 last_ssid = wpa_s->current_ssid; in wpa_supplicant_event_disassoc_finish()
2799 wpa_supplicant_mark_disassoc(wpa_s); in wpa_supplicant_event_disassoc_finish()
2802 wpa_bss_remove(wpa_s, curr, "Connection to AP lost"); in wpa_supplicant_event_disassoc_finish()
2804 if (authenticating && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) { in wpa_supplicant_event_disassoc_finish()
2805 sme_disassoc_while_authenticating(wpa_s, prev_pending_bssid); in wpa_supplicant_event_disassoc_finish()
2806 wpa_s->current_ssid = last_ssid; in wpa_supplicant_event_disassoc_finish()
2810 !wpas_network_disabled(wpa_s, fast_reconnect_ssid) && in wpa_supplicant_event_disassoc_finish()
2811 !disallowed_bssid(wpa_s, fast_reconnect->bssid) && in wpa_supplicant_event_disassoc_finish()
2812 !disallowed_ssid(wpa_s, fast_reconnect->ssid, in wpa_supplicant_event_disassoc_finish()
2814 !wpas_temp_disabled(wpa_s, fast_reconnect_ssid) && in wpa_supplicant_event_disassoc_finish()
2815 !wpa_is_bss_tmp_disallowed(wpa_s, fast_reconnect->bssid)) { in wpa_supplicant_event_disassoc_finish()
2817 wpa_dbg(wpa_s, MSG_DEBUG, "Try to reconnect to the same BSS"); in wpa_supplicant_event_disassoc_finish()
2818 if (wpa_supplicant_connect(wpa_s, fast_reconnect, in wpa_supplicant_event_disassoc_finish()
2821 wpa_supplicant_req_scan(wpa_s, 0, 100000); in wpa_supplicant_event_disassoc_finish()
2831 wpa_supplicant_req_scan(wpa_s, 0, 100000); in wpa_supplicant_event_disassoc_finish()
2839 struct wpa_supplicant *wpa_s = eloop_ctx; in wpa_supplicant_delayed_mic_error_report() local
2841 if (!wpa_s->pending_mic_error_report) in wpa_supplicant_delayed_mic_error_report()
2844 wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Sending pending MIC error report"); in wpa_supplicant_delayed_mic_error_report()
2845 wpa_sm_key_request(wpa_s->wpa, 1, wpa_s->pending_mic_error_pairwise); in wpa_supplicant_delayed_mic_error_report()
2846 wpa_s->pending_mic_error_report = 0; in wpa_supplicant_delayed_mic_error_report()
2852 wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_michael_mic_failure() argument
2858 wpa_msg(wpa_s, MSG_WARNING, "Michael MIC failure detected"); in wpa_supplicant_event_michael_mic_failure()
2861 if ((wpa_s->last_michael_mic_error.sec && in wpa_supplicant_event_michael_mic_failure()
2862 !os_reltime_expired(&t, &wpa_s->last_michael_mic_error, 60)) || in wpa_supplicant_event_michael_mic_failure()
2863 wpa_s->pending_mic_error_report) { in wpa_supplicant_event_michael_mic_failure()
2864 if (wpa_s->pending_mic_error_report) { in wpa_supplicant_event_michael_mic_failure()
2870 wpa_sm_key_request(wpa_s->wpa, 1, in wpa_supplicant_event_michael_mic_failure()
2871 wpa_s->pending_mic_error_pairwise); in wpa_supplicant_event_michael_mic_failure()
2877 wpa_sm_key_request(wpa_s->wpa, 1, pairwise); in wpa_supplicant_event_michael_mic_failure()
2880 wpa_s->countermeasures = 1; in wpa_supplicant_event_michael_mic_failure()
2882 wpa_blacklist_add(wpa_s, wpa_s->bssid); in wpa_supplicant_event_michael_mic_failure()
2884 wpa_msg(wpa_s, MSG_WARNING, "TKIP countermeasures started"); in wpa_supplicant_event_michael_mic_failure()
2892 wpa_drv_set_countermeasures(wpa_s, 1); in wpa_supplicant_event_michael_mic_failure()
2893 wpa_supplicant_deauthenticate(wpa_s, in wpa_supplicant_event_michael_mic_failure()
2896 wpa_s, NULL); in wpa_supplicant_event_michael_mic_failure()
2899 wpa_s, NULL); in wpa_supplicant_event_michael_mic_failure()
2904 if (wpa_s->mic_errors_seen) { in wpa_supplicant_event_michael_mic_failure()
2922 wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Delay MIC error " in wpa_supplicant_event_michael_mic_failure()
2924 wpa_s->pending_mic_error_report = 1; in wpa_supplicant_event_michael_mic_failure()
2925 wpa_s->pending_mic_error_pairwise = pairwise; in wpa_supplicant_event_michael_mic_failure()
2928 wpa_s, NULL); in wpa_supplicant_event_michael_mic_failure()
2932 wpa_s, NULL); in wpa_supplicant_event_michael_mic_failure()
2934 wpa_sm_key_request(wpa_s->wpa, 1, pairwise); in wpa_supplicant_event_michael_mic_failure()
2937 wpa_sm_key_request(wpa_s->wpa, 1, pairwise); in wpa_supplicant_event_michael_mic_failure()
2940 wpa_s->last_michael_mic_error = t; in wpa_supplicant_event_michael_mic_failure()
2941 wpa_s->mic_errors_seen++; in wpa_supplicant_event_michael_mic_failure()
2948 struct wpa_supplicant *wpa_s; in any_interfaces() local
2950 for (wpa_s = head; wpa_s != NULL; wpa_s = wpa_s->next) in any_interfaces()
2951 if (!wpa_s->interface_removed) in any_interfaces()
2959 wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_interface_status() argument
2962 if (os_strcmp(wpa_s->ifname, data->interface_status.ifname) != 0) in wpa_supplicant_event_interface_status()
2967 if (!wpa_s->interface_removed) in wpa_supplicant_event_interface_status()
2969 wpa_s->interface_removed = 0; in wpa_supplicant_event_interface_status()
2970 wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was added"); in wpa_supplicant_event_interface_status()
2971 if (wpa_supplicant_driver_init(wpa_s) < 0) { in wpa_supplicant_event_interface_status()
2972 wpa_msg(wpa_s, MSG_INFO, "Failed to initialize the " in wpa_supplicant_event_interface_status()
2977 if (!wpa_s->global->p2p && in wpa_supplicant_event_interface_status()
2978 !wpa_s->global->p2p_disabled && in wpa_supplicant_event_interface_status()
2979 !wpa_s->conf->p2p_disabled && in wpa_supplicant_event_interface_status()
2980 (wpa_s->drv_flags & in wpa_supplicant_event_interface_status()
2983 wpa_s, wpa_s->global->params.conf_p2p_dev) < 0) { in wpa_supplicant_event_interface_status()
2992 wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was removed"); in wpa_supplicant_event_interface_status()
2993 wpa_s->interface_removed = 1; in wpa_supplicant_event_interface_status()
2994 wpa_supplicant_mark_disassoc(wpa_s); in wpa_supplicant_event_interface_status()
2995 wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED); in wpa_supplicant_event_interface_status()
2996 l2_packet_deinit(wpa_s->l2); in wpa_supplicant_event_interface_status()
2997 wpa_s->l2 = NULL; in wpa_supplicant_event_interface_status()
3000 if (wpa_s->global->p2p && in wpa_supplicant_event_interface_status()
3001 wpa_s->global->p2p_init_wpa_s->parent == wpa_s && in wpa_supplicant_event_interface_status()
3002 (wpa_s->drv_flags & in wpa_supplicant_event_interface_status()
3004 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event_interface_status()
3007 wpa_s->global, wpa_s->global->p2p_init_wpa_s, in wpa_supplicant_event_interface_status()
3009 wpa_s->global->p2p_init_wpa_s = NULL; in wpa_supplicant_event_interface_status()
3014 if (wpa_s->matched) { in wpa_supplicant_event_interface_status()
3015 wpa_supplicant_remove_iface(wpa_s->global, wpa_s, 0); in wpa_supplicant_event_interface_status()
3022 if (!any_interfaces(wpa_s->global->ifaces)) in wpa_supplicant_event_interface_status()
3032 wpa_supplicant_event_stkstart(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_stkstart() argument
3037 wpa_sm_stkstart(wpa_s->wpa, data->stkstart.peer); in wpa_supplicant_event_stkstart()
3043 static void wpa_supplicant_event_tdls(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_tdls() argument
3050 wpa_tdls_remove(wpa_s->wpa, data->tdls.peer); in wpa_supplicant_event_tdls()
3051 if (wpa_tdls_is_external_setup(wpa_s->wpa)) in wpa_supplicant_event_tdls()
3052 wpa_tdls_start(wpa_s->wpa, data->tdls.peer); in wpa_supplicant_event_tdls()
3054 wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, data->tdls.peer); in wpa_supplicant_event_tdls()
3057 if (wpa_tdls_is_external_setup(wpa_s->wpa)) in wpa_supplicant_event_tdls()
3058 wpa_tdls_teardown_link(wpa_s->wpa, data->tdls.peer, in wpa_supplicant_event_tdls()
3061 wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN, in wpa_supplicant_event_tdls()
3065 wpa_tdls_send_discovery_request(wpa_s->wpa, in wpa_supplicant_event_tdls()
3074 static void wpa_supplicant_event_wnm(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_wnm() argument
3084 ieee802_11_send_wnmsleep_req(wpa_s, data->wnm.sleep_action, in wpa_supplicant_event_wnm()
3094 wpa_supplicant_event_ft_response(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_ft_response() argument
3100 if (wpa_ft_process_response(wpa_s->wpa, data->ft_ies.ies, in wpa_supplicant_event_ft_response()
3113 static void wpa_supplicant_event_ibss_rsn_start(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_ibss_rsn_start() argument
3117 if (wpa_s->wpa_state < WPA_ASSOCIATED) in wpa_supplicant_event_ibss_rsn_start()
3121 ssid = wpa_s->current_ssid; in wpa_supplicant_event_ibss_rsn_start()
3127 ibss_rsn_start(wpa_s->ibss_rsn, data->ibss_rsn_start.peer); in wpa_supplicant_event_ibss_rsn_start()
3131 static void wpa_supplicant_event_ibss_auth(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_ibss_auth() argument
3134 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpa_supplicant_event_ibss_auth()
3143 ibss_rsn_handle_auth(wpa_s->ibss_rsn, data->rx_mgmt.frame, in wpa_supplicant_event_ibss_auth()
3150 static void ft_rx_action(struct wpa_supplicant *wpa_s, const u8 *data, in ft_rx_action() argument
3157 if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) in ft_rx_action()
3166 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Received FT Action Response: STA " in ft_rx_action()
3170 if (os_memcmp(sta_addr, wpa_s->own_addr, ETH_ALEN) != 0) { in ft_rx_action()
3171 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Foreign STA Address " MACSTR in ft_rx_action()
3177 wpa_dbg(wpa_s, MSG_DEBUG, "FT: FT Action Response indicates " in ft_rx_action()
3183 if (wpa_ft_process_response(wpa_s->wpa, data + 1 + 2 * ETH_ALEN + 2, in ft_rx_action()
3191 bss = wpa_bss_get_bssid(wpa_s, target_ap_addr); in ft_rx_action()
3193 wpa_s->sme.freq = bss->freq; in ft_rx_action()
3194 wpa_s->sme.auth_alg = WPA_AUTH_ALG_FT; in ft_rx_action()
3195 sme_associate(wpa_s, WPAS_MODE_INFRA, target_ap_addr, in ft_rx_action()
3203 static void wpa_supplicant_event_unprot_deauth(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_unprot_deauth() argument
3211 sme_event_unprot_disconnect(wpa_s, e->sa, e->da, e->reason_code); in wpa_supplicant_event_unprot_deauth()
3216 static void wpa_supplicant_event_unprot_disassoc(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_unprot_disassoc() argument
3224 sme_event_unprot_disconnect(wpa_s, e->sa, e->da, e->reason_code); in wpa_supplicant_event_unprot_disassoc()
3229 static void wpas_event_disconnect(struct wpa_supplicant *wpa_s, const u8 *addr, in wpas_event_disconnect() argument
3234 if (wpa_s->ap_iface && addr) { in wpas_event_disconnect()
3235 hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], addr); in wpas_event_disconnect()
3239 if (wpa_s->ap_iface) { in wpas_event_disconnect()
3240 wpa_dbg(wpa_s, MSG_DEBUG, "Ignore deauth event in AP mode"); in wpas_event_disconnect()
3246 wpa_s->own_disconnect_req = 0; in wpas_event_disconnect()
3248 wpa_supplicant_event_disassoc(wpa_s, reason_code, locally_generated); in wpas_event_disconnect()
3251 ((wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt) || in wpas_event_disconnect()
3252 (wpa_s->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)) && in wpas_event_disconnect()
3253 eapol_sm_failed(wpa_s->eapol))) && in wpas_event_disconnect()
3254 !wpa_s->eap_expected_failure)) in wpas_event_disconnect()
3255 wpas_auth_failed(wpa_s, "AUTH_FAILED"); in wpas_event_disconnect()
3259 if (wpas_p2p_deauth_notif(wpa_s, addr, reason_code, ie, ie_len, in wpas_event_disconnect()
3270 wpa_supplicant_event_disassoc_finish(wpa_s, reason_code, in wpas_event_disconnect()
3275 static void wpas_event_disassoc(struct wpa_supplicant *wpa_s, in wpas_event_disassoc() argument
3284 wpa_dbg(wpa_s, MSG_DEBUG, "Disassociation notification"); in wpas_event_disassoc()
3292 wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u%s", reason_code, in wpas_event_disassoc()
3295 wpa_dbg(wpa_s, MSG_DEBUG, " * address " MACSTR, in wpas_event_disassoc()
3302 if (wpa_s->ap_iface && info && info->addr) { in wpas_event_disassoc()
3303 hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], info->addr); in wpas_event_disassoc()
3307 if (wpa_s->ap_iface) { in wpas_event_disassoc()
3308 wpa_dbg(wpa_s, MSG_DEBUG, "Ignore disassoc event in AP mode"); in wpas_event_disassoc()
3316 wpa_s, info->addr, reason_code, info->ie, info->ie_len, in wpas_event_disassoc()
3321 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpas_event_disassoc()
3322 sme_event_disassoc(wpa_s, info); in wpas_event_disassoc()
3324 wpas_event_disconnect(wpa_s, addr, reason_code, locally_generated, in wpas_event_disassoc()
3329 static void wpas_event_deauth(struct wpa_supplicant *wpa_s, in wpas_event_deauth() argument
3338 wpa_dbg(wpa_s, MSG_DEBUG, "Deauthentication notification"); in wpas_event_deauth()
3346 wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u%s", in wpas_event_deauth()
3350 wpa_dbg(wpa_s, MSG_DEBUG, " * address " MACSTR, in wpas_event_deauth()
3357 wpa_reset_ft_completed(wpa_s->wpa); in wpas_event_deauth()
3359 wpas_event_disconnect(wpa_s, addr, reason_code, in wpas_event_deauth()
3401 struct wpa_supplicant *wpa_s, struct channel_list_changed *info) in wpa_supplicant_update_channel_list() argument
3411 for (ifs = wpa_s; ifs->parent && ifs != ifs->parent; ifs = ifs->parent) in wpa_supplicant_update_channel_list()
3419 if (wpa_s->drv_priv == NULL) in wpa_supplicant_update_channel_list()
3422 dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant, in wpa_supplicant_update_channel_list()
3441 wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_DRIVER); in wpa_supplicant_update_channel_list()
3445 static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s, in wpas_event_rx_mgmt_action() argument
3462 wpa_dbg(wpa_s, MSG_DEBUG, "Received Action frame: SA=" MACSTR in wpas_event_rx_mgmt_action()
3467 wmm_ac_rx_action(wpa_s, mgmt->da, mgmt->sa, payload, plen); in wpas_event_rx_mgmt_action()
3473 ft_rx_action(wpa_s, payload, plen); in wpas_event_rx_mgmt_action()
3481 sme_sa_query_rx(wpa_s, mgmt->sa, payload, plen); in wpas_event_rx_mgmt_action()
3489 ieee802_11_rx_wnm_action(wpa_s, mgmt, len); in wpas_event_rx_mgmt_action()
3497 gas_query_rx(wpa_s->gas, mgmt->da, mgmt->sa, mgmt->bssid, in wpas_event_rx_mgmt_action()
3506 wpa_dbg(wpa_s, MSG_DEBUG, in wpas_event_rx_mgmt_action()
3518 wpa_dbg(wpa_s, MSG_DEBUG, "Interworking: Received QoS Map Configure frame from " in wpas_event_rx_mgmt_action()
3520 if (os_memcmp(mgmt->sa, wpa_s->bssid, ETH_ALEN) == 0 && in wpas_event_rx_mgmt_action()
3523 wpas_qos_map_set(wpa_s, pos + 2, pos[1]); in wpas_event_rx_mgmt_action()
3530 wpas_rrm_handle_radio_measurement_request(wpa_s, mgmt->sa, in wpas_event_rx_mgmt_action()
3538 wpas_rrm_process_neighbor_rep(wpa_s, payload + 1, plen - 1); in wpas_event_rx_mgmt_action()
3544 wpas_rrm_handle_link_measurement_request(wpa_s, mgmt->sa, in wpas_event_rx_mgmt_action()
3551 if (mgmt->u.action.category == WLAN_ACTION_FST && wpa_s->fst) { in wpas_event_rx_mgmt_action()
3552 fst_rx_action(wpa_s->fst, mgmt, len); in wpas_event_rx_mgmt_action()
3557 wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid, in wpas_event_rx_mgmt_action()
3559 if (wpa_s->ifmsh) in wpas_event_rx_mgmt_action()
3560 mesh_mpm_action_rx(wpa_s, mgmt, len); in wpas_event_rx_mgmt_action()
3564 static void wpa_supplicant_notify_avoid_freq(struct wpa_supplicant *wpa_s, in wpa_supplicant_notify_avoid_freq() argument
3574 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_AVOID_FREQ "ranges=%s", in wpa_supplicant_notify_avoid_freq()
3578 if (freq_range_list_parse(&wpa_s->global->p2p_go_avoid_freq, str)) { in wpa_supplicant_notify_avoid_freq()
3579 wpa_dbg(wpa_s, MSG_ERROR, "%s: Failed to parse freq range", in wpa_supplicant_notify_avoid_freq()
3582 wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Update channel list based on frequency avoid event"); in wpa_supplicant_notify_avoid_freq()
3588 wpas_p2p_update_channel_list(wpa_s, in wpa_supplicant_notify_avoid_freq()
3597 static void wpa_supplicant_event_assoc_auth(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_assoc_auth() argument
3600 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event_assoc_auth()
3602 wpa_s->wpa_state); in wpa_supplicant_event_assoc_auth()
3603 if (wpa_s->wpa_state == WPA_ASSOCIATED) { in wpa_supplicant_event_assoc_auth()
3604 wpa_supplicant_cancel_auth_timeout(wpa_s); in wpa_supplicant_event_assoc_auth()
3605 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); in wpa_supplicant_event_assoc_auth()
3606 eapol_sm_notify_portValid(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc_auth()
3607 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc_auth()
3609 wpa_sm_set_rx_replay_ctr(wpa_s->wpa, data->assoc_info.key_replay_ctr); in wpa_supplicant_event_assoc_auth()
3610 wpa_sm_set_ptk_kck_kek(wpa_s->wpa, data->assoc_info.ptk_kck, in wpa_supplicant_event_assoc_auth()
3620 struct wpa_supplicant *wpa_s = ctx; in wpa_supplicant_event() local
3624 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED && in wpa_supplicant_event()
3629 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event()
3649 wpa_dbg(wpa_s, level, "Event %s (%d) received", in wpa_supplicant_event()
3657 if (!wpas_fst_update_mbie(wpa_s, data->auth.ies, in wpa_supplicant_event()
3662 sme_event_auth(wpa_s, data); in wpa_supplicant_event()
3666 if (wpa_s->ignore_auth_resp) { in wpa_supplicant_event()
3672 wpa_supplicant_event_assoc(wpa_s, data); in wpa_supplicant_event()
3674 wpa_supplicant_event_assoc_auth(wpa_s, data); in wpa_supplicant_event()
3676 wpa_msg(wpa_s, MSG_INFO, in wpa_supplicant_event()
3682 wpas_event_disassoc(wpa_s, in wpa_supplicant_event()
3687 if (wpa_s->ignore_auth_resp) { in wpa_supplicant_event()
3693 wpas_event_deauth(wpa_s, in wpa_supplicant_event()
3697 wpa_supplicant_event_michael_mic_failure(wpa_s, data); in wpa_supplicant_event()
3701 if (wpa_s->own_scan_requested || in wpa_supplicant_event()
3705 os_get_reltime(&wpa_s->scan_start_time); in wpa_supplicant_event()
3706 os_reltime_sub(&wpa_s->scan_start_time, in wpa_supplicant_event()
3707 &wpa_s->scan_trigger_time, &diff); in wpa_supplicant_event()
3708 wpa_dbg(wpa_s, MSG_DEBUG, "Own scan request started a scan in %ld.%06ld seconds", in wpa_supplicant_event()
3710 wpa_s->own_scan_requested = 0; in wpa_supplicant_event()
3711 wpa_s->own_scan_running = 1; in wpa_supplicant_event()
3712 if (wpa_s->last_scan_req == MANUAL_SCAN_REQ && in wpa_supplicant_event()
3713 wpa_s->manual_scan_use_id) { in wpa_supplicant_event()
3714 wpa_msg_ctrl(wpa_s, MSG_INFO, in wpa_supplicant_event()
3716 wpa_s->manual_scan_id); in wpa_supplicant_event()
3718 wpa_msg_ctrl(wpa_s, MSG_INFO, in wpa_supplicant_event()
3722 wpa_dbg(wpa_s, MSG_DEBUG, "External program started a scan"); in wpa_supplicant_event()
3723 wpa_s->radio->external_scan_running = 1; in wpa_supplicant_event()
3724 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_STARTED); in wpa_supplicant_event()
3728 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) { in wpa_supplicant_event()
3729 wpa_s->scan_res_handler = NULL; in wpa_supplicant_event()
3730 wpa_s->own_scan_running = 0; in wpa_supplicant_event()
3731 wpa_s->radio->external_scan_running = 0; in wpa_supplicant_event()
3732 wpa_s->last_scan_req = NORMAL_SCAN_REQ; in wpa_supplicant_event()
3737 os_reltime_initialized(&wpa_s->scan_start_time)) { in wpa_supplicant_event()
3740 os_reltime_sub(&now, &wpa_s->scan_start_time, &diff); in wpa_supplicant_event()
3741 wpa_s->scan_start_time.sec = 0; in wpa_supplicant_event()
3742 wpa_s->scan_start_time.usec = 0; in wpa_supplicant_event()
3743 wpa_dbg(wpa_s, MSG_DEBUG, "Scan completed in %ld.%06ld seconds", in wpa_supplicant_event()
3746 if (wpa_supplicant_event_scan_results(wpa_s, data)) in wpa_supplicant_event()
3749 wpa_s->own_scan_running = 0; in wpa_supplicant_event()
3751 wpa_s->radio->external_scan_running = 0; in wpa_supplicant_event()
3752 radio_work_check_next(wpa_s); in wpa_supplicant_event()
3756 wpa_supplicant_event_associnfo(wpa_s, data); in wpa_supplicant_event()
3759 wpa_supplicant_event_interface_status(wpa_s, data); in wpa_supplicant_event()
3762 wpa_supplicant_event_pmkid_candidate(wpa_s, data); in wpa_supplicant_event()
3766 wpa_supplicant_event_stkstart(wpa_s, data); in wpa_supplicant_event()
3771 wpa_supplicant_event_tdls(wpa_s, data); in wpa_supplicant_event()
3776 wpa_supplicant_event_wnm(wpa_s, data); in wpa_supplicant_event()
3781 wpa_supplicant_event_ft_response(wpa_s, data); in wpa_supplicant_event()
3786 wpa_supplicant_event_ibss_rsn_start(wpa_s, data); in wpa_supplicant_event()
3796 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_ASSOC_REJECT in wpa_supplicant_event()
3803 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_ASSOC_REJECT in wpa_supplicant_event()
3808 wpa_s->assoc_status_code = data->assoc_reject.status_code; in wpa_supplicant_event()
3809 wpa_s->assoc_timed_out = data->assoc_reject.timed_out; in wpa_supplicant_event()
3810 wpas_notify_assoc_status_code(wpa_s); in wpa_supplicant_event()
3811 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpa_supplicant_event()
3812 sme_event_assoc_reject(wpa_s, data); in wpa_supplicant_event()
3816 bssid = wpa_s->pending_bssid; in wpa_supplicant_event()
3817 wpas_connection_failed(wpa_s, bssid); in wpa_supplicant_event()
3818 wpa_supplicant_mark_disassoc(wpa_s); in wpa_supplicant_event()
3823 if (wpa_s->current_ssid && in wpa_supplicant_event()
3824 wpa_s->current_ssid->mode == WPAS_MODE_MESH) { in wpa_supplicant_event()
3825 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event()
3829 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpa_supplicant_event()
3830 sme_event_auth_timed_out(wpa_s, data); in wpa_supplicant_event()
3834 if (wpa_s->current_ssid && in wpa_supplicant_event()
3835 wpa_s->current_ssid->mode == WPAS_MODE_MESH) { in wpa_supplicant_event()
3836 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event()
3840 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpa_supplicant_event()
3841 sme_event_assoc_timed_out(wpa_s, data); in wpa_supplicant_event()
3844 wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_TX_STATUS dst=" MACSTR in wpa_supplicant_event()
3849 if (wpa_s->ap_iface == NULL) { in wpa_supplicant_event()
3854 wpa_s, data->tx_status.dst, in wpa_supplicant_event()
3865 wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_TX_STATUS pending_dst=" in wpa_supplicant_event()
3866 MACSTR, MAC2STR(wpa_s->p2pdev->pending_action_dst)); in wpa_supplicant_event()
3876 os_memcmp(wpa_s->p2pdev->pending_action_dst, in wpa_supplicant_event()
3879 wpa_s->p2pdev, data->tx_status.dst, in wpa_supplicant_event()
3891 ap_mgmt_tx_cb(wpa_s, data->tx_status.data, in wpa_supplicant_event()
3897 ap_tx_status(wpa_s, data->tx_status.dst, in wpa_supplicant_event()
3907 ap_eapol_tx_status(wpa_s, data->eapol_tx_status.dst, in wpa_supplicant_event()
3913 ap_client_poll_ok(wpa_s, data->client_poll.addr); in wpa_supplicant_event()
3916 if (wpa_s->ap_iface == NULL) in wpa_supplicant_event()
3918 ap_rx_from_unknown_sta(wpa_s, data->rx_from_unknown.addr, in wpa_supplicant_event()
3922 if (!data || !wpa_s->current_ssid) in wpa_supplicant_event()
3925 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_CHANNEL_SWITCH in wpa_supplicant_event()
3934 wpa_s->assoc_freq = data->ch_switch.freq; in wpa_supplicant_event()
3935 wpa_s->current_ssid->frequency = data->ch_switch.freq; in wpa_supplicant_event()
3937 if (wpa_s->current_ssid->mode == WPAS_MODE_AP || in wpa_supplicant_event()
3938 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO || in wpa_supplicant_event()
3939 wpa_s->current_ssid->mode == in wpa_supplicant_event()
3941 wpas_ap_ch_switch(wpa_s, data->ch_switch.freq, in wpa_supplicant_event()
3949 wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_CS); in wpa_supplicant_event()
3954 wpas_event_dfs_radar_detected(wpa_s, &data->dfs_event); in wpa_supplicant_event()
3958 wpas_event_dfs_cac_started(wpa_s, &data->dfs_event); in wpa_supplicant_event()
3962 wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event); in wpa_supplicant_event()
3966 wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event); in wpa_supplicant_event()
3970 wpas_event_dfs_cac_nop_finished(wpa_s, in wpa_supplicant_event()
3980 if (wpa_s->ext_mgmt_frame_handling) { in wpa_supplicant_event()
3987 wpa_msg(wpa_s, MSG_INFO, "MGMT-RX freq=%d datarate=%u ssi_signal=%d %s", in wpa_supplicant_event()
4002 if (wpa_s->ap_iface == NULL) { in wpa_supplicant_event()
4015 wpa_s, src, mgmt->da, in wpa_supplicant_event()
4023 if (wpa_s->current_ssid && in wpa_supplicant_event()
4024 wpa_s->current_ssid->mode == WPAS_MODE_IBSS && in wpa_supplicant_event()
4027 wpa_supplicant_event_ibss_auth(wpa_s, data); in wpa_supplicant_event()
4034 wpa_s, data->rx_mgmt.frame, in wpa_supplicant_event()
4041 if (wpa_s->ifmsh) { in wpa_supplicant_event()
4042 mesh_mpm_mgmt_rx(wpa_s, &data->rx_mgmt); in wpa_supplicant_event()
4046 wpa_dbg(wpa_s, MSG_DEBUG, "AP: ignore received " in wpa_supplicant_event()
4060 wpas_notify_preq(wpa_s, mgmt->sa, mgmt->da, in wpa_supplicant_event()
4065 ap_mgmt_rx(wpa_s, &data->rx_mgmt); in wpa_supplicant_event()
4074 if (wpa_s->ap_iface) { in wpa_supplicant_event()
4075 hostapd_probe_req_rx(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
4085 wpas_p2p_probe_req_rx(wpa_s, data->rx_probe_req.sa, in wpa_supplicant_event()
4096 wpa_s, data->remain_on_channel.freq, in wpa_supplicant_event()
4100 wpa_s, data->remain_on_channel.freq, in wpa_supplicant_event()
4106 wpa_s, data->remain_on_channel.freq); in wpa_supplicant_event()
4109 wpa_s, data->remain_on_channel.freq); in wpa_supplicant_event()
4112 wpa_supplicant_rx_eapol(wpa_s, data->eapol_rx.src, in wpa_supplicant_event()
4117 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SIGNAL_CHANGE in wpa_supplicant_event()
4123 wpa_bss_update_level(wpa_s->current_bss, in wpa_supplicant_event()
4126 wpa_s, data->signal_change.above_threshold, in wpa_supplicant_event()
4132 wpa_dbg(wpa_s, MSG_DEBUG, "Interface was enabled"); in wpa_supplicant_event()
4133 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) { in wpa_supplicant_event()
4134 wpa_supplicant_update_mac_addr(wpa_s); in wpa_supplicant_event()
4135 if (wpa_s->p2p_mgmt) { in wpa_supplicant_event()
4136 wpa_supplicant_set_state(wpa_s, in wpa_supplicant_event()
4142 if (!wpa_s->ap_iface) { in wpa_supplicant_event()
4143 wpa_supplicant_set_state(wpa_s, in wpa_supplicant_event()
4145 wpa_s->scan_req = NORMAL_SCAN_REQ; in wpa_supplicant_event()
4146 wpa_supplicant_req_scan(wpa_s, 0, 0); in wpa_supplicant_event()
4148 wpa_supplicant_set_state(wpa_s, in wpa_supplicant_event()
4151 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); in wpa_supplicant_event()
4152 wpa_supplicant_req_scan(wpa_s, 0, 0); in wpa_supplicant_event()
4157 wpa_dbg(wpa_s, MSG_DEBUG, "Interface was disabled"); in wpa_supplicant_event()
4159 if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_GO || in wpa_supplicant_event()
4160 (wpa_s->current_ssid && wpa_s->current_ssid->p2p_group && in wpa_supplicant_event()
4161 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO)) { in wpa_supplicant_event()
4166 wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED); in wpa_supplicant_event()
4172 if (wpa_s->current_ssid && in wpa_supplicant_event()
4173 wpa_s->current_ssid->p2p_group) in wpa_supplicant_event()
4174 wpas_p2p_interface_unavailable(wpa_s); in wpa_supplicant_event()
4176 wpas_p2p_disconnect(wpa_s); in wpa_supplicant_event()
4183 if (wpa_s->p2p_scan_work && wpa_s->global->p2p && in wpa_supplicant_event()
4184 p2p_in_progress(wpa_s->global->p2p) > 1) { in wpa_supplicant_event()
4188 p2p_stop_find(wpa_s->global->p2p); in wpa_supplicant_event()
4192 if (wpa_s->wpa_state >= WPA_AUTHENTICATING) { in wpa_supplicant_event()
4198 wpa_s, WLAN_REASON_DEAUTH_LEAVING, 1); in wpa_supplicant_event()
4200 wpa_supplicant_mark_disassoc(wpa_s); in wpa_supplicant_event()
4201 wpa_bss_flush(wpa_s); in wpa_supplicant_event()
4202 radio_remove_works(wpa_s, NULL, 0); in wpa_supplicant_event()
4204 wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED); in wpa_supplicant_event()
4208 wpa_s, &data->channel_list_changed); in wpa_supplicant_event()
4211 wpas_p2p_interface_unavailable(wpa_s); in wpa_supplicant_event()
4214 wpa_dbg(wpa_s, MSG_DEBUG, "Best channel event received " in wpa_supplicant_event()
4218 wpa_s->best_24_freq = data->best_chan.freq_24; in wpa_supplicant_event()
4219 wpa_s->best_5_freq = data->best_chan.freq_5; in wpa_supplicant_event()
4220 wpa_s->best_overall_freq = data->best_chan.freq_overall; in wpa_supplicant_event()
4221 wpas_p2p_update_best_channels(wpa_s, data->best_chan.freq_24, in wpa_supplicant_event()
4226 wpa_supplicant_event_unprot_deauth(wpa_s, in wpa_supplicant_event()
4230 wpa_supplicant_event_unprot_disassoc(wpa_s, in wpa_supplicant_event()
4235 if (wpa_s->ap_iface && data) in wpa_supplicant_event()
4236 hostapd_event_sta_low_ack(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
4241 wpa_tdls_disable_unreachable_link(wpa_s->wpa, in wpa_supplicant_event()
4247 ibss_rsn_stop(wpa_s->ibss_rsn, data->ibss_peer_lost.peer); in wpa_supplicant_event()
4252 wpa_s->bssid, ETH_ALEN)) in wpa_supplicant_event()
4254 if (!wpa_s->wpa) in wpa_supplicant_event()
4256 wpa_sm_update_replay_ctr(wpa_s->wpa, in wpa_supplicant_event()
4260 wpa_s->sched_scanning = 0; in wpa_supplicant_event()
4261 resched = wpa_s->scanning && wpas_scan_scheduled(wpa_s); in wpa_supplicant_event()
4262 wpa_supplicant_notify_scanning(wpa_s, 0); in wpa_supplicant_event()
4264 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) in wpa_supplicant_event()
4271 if (!wpa_s->sched_scan_stop_req && in wpa_supplicant_event()
4272 wpa_s->wpa_state == WPA_SCANNING) { in wpa_supplicant_event()
4273 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event()
4275 wpa_supplicant_req_scan(wpa_s, 1, 0); in wpa_supplicant_event()
4279 wpa_s->sched_scan_stop_req = 0; in wpa_supplicant_event()
4285 if (wpa_s->sched_scan_timed_out) { in wpa_supplicant_event()
4286 wpa_supplicant_req_sched_scan(wpa_s); in wpa_supplicant_event()
4287 } else if (wpa_s->pno_sched_pending) { in wpa_supplicant_event()
4288 wpa_s->pno_sched_pending = 0; in wpa_supplicant_event()
4289 wpas_start_pno(wpa_s); in wpa_supplicant_event()
4291 wpa_supplicant_req_scan(wpa_s, 0, 0); in wpa_supplicant_event()
4297 wpas_wps_start_pbc(wpa_s, NULL, 0); in wpa_supplicant_event()
4301 wpa_supplicant_notify_avoid_freq(wpa_s, data); in wpa_supplicant_event()
4305 if (!wpa_s->ap_iface || !data) in wpa_supplicant_event()
4308 wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
4315 if (!wpa_s->ifmsh || !data) in wpa_supplicant_event()
4317 wpa_mesh_notify_peer(wpa_s, data->mesh_peer.peer, in wpa_supplicant_event()
4324 if (!wpa_s->ap_iface) in wpa_supplicant_event()
4326 hostapd_event_get_survey(wpa_s->ap_iface, in wpa_supplicant_event()
4333 if (!wpa_s->ap_iface) in wpa_supplicant_event()
4335 hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
4342 wpa_s->p2p_lo_started = 0; in wpa_supplicant_event()
4343 wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_LISTEN_OFFLOAD_STOP in wpa_supplicant_event()
4349 if (!wpa_s->current_bss || !wpa_s->current_ssid) in wpa_supplicant_event()
4351 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_BEACON_LOSS); in wpa_supplicant_event()
4352 bgscan_notify_beacon_loss(wpa_s); in wpa_supplicant_event()
4355 wpa_msg(wpa_s, MSG_INFO, "Unknown event %d", event); in wpa_supplicant_event()
4364 struct wpa_supplicant *wpa_s; in wpa_supplicant_event_global() local
4369 wpa_s = wpa_supplicant_get_iface(ctx, data->interface_status.ifname); in wpa_supplicant_event_global()
4370 if (wpa_s && wpa_s->driver->get_ifindex) { in wpa_supplicant_event_global()
4373 ifindex = wpa_s->driver->get_ifindex(wpa_s->drv_priv); in wpa_supplicant_event_global()
4375 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event_global()
4389 wpa_s = wpa_supplicant_add_iface(ctx, wpa_i, NULL); in wpa_supplicant_event_global()
4391 if (wpa_s) in wpa_supplicant_event_global()
4392 wpa_s->matched = 1; in wpa_supplicant_event_global()
4396 if (wpa_s) in wpa_supplicant_event_global()
4397 wpa_supplicant_event(wpa_s, event, data); in wpa_supplicant_event_global()