Lines Matching refs:wpa_s
58 static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
63 int wpas_temp_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) in wpas_temp_disabled() argument
74 wpas_clear_temp_disabled(wpa_s, ssid, 0); in wpas_temp_disabled()
91 static int wpas_reenabled_network_time(struct wpa_supplicant *wpa_s) in wpas_reenabled_network_time() argument
97 if (wpa_s->conf->auto_interworking && wpa_s->conf->interworking && in wpas_reenabled_network_time()
98 wpa_s->conf->cred) in wpas_reenabled_network_time()
102 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { in wpas_reenabled_network_time()
106 disabled_for = wpas_temp_disabled(wpa_s, ssid); in wpas_reenabled_network_time()
121 struct wpa_supplicant *wpa_s = eloop_ctx; in wpas_network_reenabled() local
123 if (wpa_s->disconnected || wpa_s->wpa_state != WPA_SCANNING) in wpas_network_reenabled()
126 wpa_dbg(wpa_s, MSG_DEBUG, in wpas_network_reenabled()
128 if (wpa_supplicant_fast_associate(wpa_s) != 1) { in wpas_network_reenabled()
129 wpa_supplicant_cancel_sched_scan(wpa_s); in wpas_network_reenabled()
130 wpa_supplicant_req_scan(wpa_s, 0, 0); in wpas_network_reenabled()
136 struct wpa_supplicant *wpa_s, const u8 *bssid) in wpa_supplicant_get_new_bss() argument
139 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpa_supplicant_get_new_bss()
142 bss = wpa_bss_get(wpa_s, bssid, ssid->ssid, ssid->ssid_len); in wpa_supplicant_get_new_bss()
144 bss = wpa_bss_get_bssid(wpa_s, bssid); in wpa_supplicant_get_new_bss()
150 static void wpa_supplicant_update_current_bss(struct wpa_supplicant *wpa_s) in wpa_supplicant_update_current_bss() argument
152 struct wpa_bss *bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); in wpa_supplicant_update_current_bss()
155 wpa_supplicant_update_scan_results(wpa_s); in wpa_supplicant_update_current_bss()
158 bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); in wpa_supplicant_update_current_bss()
162 wpa_s->current_bss = bss; in wpa_supplicant_update_current_bss()
166 static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s) in wpa_supplicant_select_config() argument
173 if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) { in wpa_supplicant_select_config()
174 wpa_supplicant_update_current_bss(wpa_s); in wpa_supplicant_select_config()
176 if (wpa_s->current_ssid->ssid_len == 0) in wpa_supplicant_select_config()
178 res = wpa_drv_get_ssid(wpa_s, drv_ssid); in wpa_supplicant_select_config()
180 wpa_msg(wpa_s, MSG_INFO, in wpa_supplicant_select_config()
186 if (drv_ssid_len == wpa_s->current_ssid->ssid_len && in wpa_supplicant_select_config()
187 os_memcmp(drv_ssid, wpa_s->current_ssid->ssid, in wpa_supplicant_select_config()
191 wpa_msg(wpa_s, MSG_DEBUG, in wpa_supplicant_select_config()
197 wpa_dbg(wpa_s, MSG_DEBUG, "Select network based on association " in wpa_supplicant_select_config()
199 ssid = wpa_supplicant_get_ssid(wpa_s); in wpa_supplicant_select_config()
201 wpa_msg(wpa_s, MSG_INFO, in wpa_supplicant_select_config()
206 if (wpas_network_disabled(wpa_s, ssid)) { in wpa_supplicant_select_config()
207 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is disabled"); in wpa_supplicant_select_config()
211 if (disallowed_bssid(wpa_s, wpa_s->bssid) || in wpa_supplicant_select_config()
212 disallowed_ssid(wpa_s, ssid->ssid, ssid->ssid_len)) { in wpa_supplicant_select_config()
213 wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS is disallowed"); in wpa_supplicant_select_config()
217 res = wpas_temp_disabled(wpa_s, ssid); in wpa_supplicant_select_config()
219 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is temporarily " in wpa_supplicant_select_config()
224 wpa_dbg(wpa_s, MSG_DEBUG, "Network configuration found for the " in wpa_supplicant_select_config()
229 if (wpa_supplicant_set_suites(wpa_s, NULL, ssid, in wpa_supplicant_select_config()
231 wpa_dbg(wpa_s, MSG_DEBUG, "Could not set WPA suites"); in wpa_supplicant_select_config()
233 wpa_supplicant_set_non_wpa_policy(wpa_s, ssid); in wpa_supplicant_select_config()
236 if (wpa_s->current_ssid && wpa_s->current_ssid != ssid) in wpa_supplicant_select_config()
237 eapol_sm_invalidate_cached_session(wpa_s->eapol); in wpa_supplicant_select_config()
238 old_ssid = wpa_s->current_ssid; in wpa_supplicant_select_config()
239 wpa_s->current_ssid = ssid; in wpa_supplicant_select_config()
241 wpa_supplicant_update_current_bss(wpa_s); in wpa_supplicant_select_config()
243 wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid); in wpa_supplicant_select_config()
244 wpa_supplicant_initiate_eapol(wpa_s); in wpa_supplicant_select_config()
245 if (old_ssid != wpa_s->current_ssid) in wpa_supplicant_select_config()
246 wpas_notify_network_changed(wpa_s); in wpa_supplicant_select_config()
254 struct wpa_supplicant *wpa_s = eloop_ctx; in wpa_supplicant_stop_countermeasures() local
256 if (wpa_s->countermeasures) { in wpa_supplicant_stop_countermeasures()
257 wpa_s->countermeasures = 0; in wpa_supplicant_stop_countermeasures()
258 wpa_drv_set_countermeasures(wpa_s, 0); in wpa_supplicant_stop_countermeasures()
259 wpa_msg(wpa_s, MSG_INFO, "WPA: TKIP countermeasures stopped"); in wpa_supplicant_stop_countermeasures()
268 wpa_supplicant_cancel_sched_scan(wpa_s); in wpa_supplicant_stop_countermeasures()
269 wpa_supplicant_req_scan(wpa_s, 0, 0); in wpa_supplicant_stop_countermeasures()
274 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s) in wpa_supplicant_mark_disassoc() argument
278 wnm_bss_keep_alive_deinit(wpa_s); in wpa_supplicant_mark_disassoc()
281 ibss_rsn_deinit(wpa_s->ibss_rsn); in wpa_supplicant_mark_disassoc()
282 wpa_s->ibss_rsn = NULL; in wpa_supplicant_mark_disassoc()
286 wpa_supplicant_ap_deinit(wpa_s); in wpa_supplicant_mark_disassoc()
291 wpa_drv_configure_frame_filters(wpa_s, 0); in wpa_supplicant_mark_disassoc()
294 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) in wpa_supplicant_mark_disassoc()
297 if (os_reltime_initialized(&wpa_s->session_start)) { in wpa_supplicant_mark_disassoc()
298 os_reltime_age(&wpa_s->session_start, &wpa_s->session_length); in wpa_supplicant_mark_disassoc()
299 wpa_s->session_start.sec = 0; in wpa_supplicant_mark_disassoc()
300 wpa_s->session_start.usec = 0; in wpa_supplicant_mark_disassoc()
301 wpas_notify_session_length(wpa_s); in wpa_supplicant_mark_disassoc()
304 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); in wpa_supplicant_mark_disassoc()
305 bssid_changed = !is_zero_ether_addr(wpa_s->bssid); in wpa_supplicant_mark_disassoc()
306 os_memset(wpa_s->bssid, 0, ETH_ALEN); in wpa_supplicant_mark_disassoc()
307 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); in wpa_supplicant_mark_disassoc()
308 sme_clear_on_disassoc(wpa_s); in wpa_supplicant_mark_disassoc()
309 wpa_s->current_bss = NULL; in wpa_supplicant_mark_disassoc()
310 wpa_s->assoc_freq = 0; in wpa_supplicant_mark_disassoc()
313 wpas_notify_bssid_changed(wpa_s); in wpa_supplicant_mark_disassoc()
315 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); in wpa_supplicant_mark_disassoc()
316 eapol_sm_notify_portValid(wpa_s->eapol, FALSE); in wpa_supplicant_mark_disassoc()
317 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || in wpa_supplicant_mark_disassoc()
318 wpa_s->key_mgmt == WPA_KEY_MGMT_OWE || in wpa_supplicant_mark_disassoc()
319 wpa_s->key_mgmt == WPA_KEY_MGMT_DPP) in wpa_supplicant_mark_disassoc()
320 eapol_sm_notify_eap_success(wpa_s->eapol, FALSE); in wpa_supplicant_mark_disassoc()
321 wpa_s->ap_ies_from_associnfo = 0; in wpa_supplicant_mark_disassoc()
322 wpa_s->current_ssid = NULL; in wpa_supplicant_mark_disassoc()
323 eapol_sm_notify_config(wpa_s->eapol, NULL, NULL); in wpa_supplicant_mark_disassoc()
324 wpa_s->key_mgmt = 0; in wpa_supplicant_mark_disassoc()
326 wpas_rrm_reset(wpa_s); in wpa_supplicant_mark_disassoc()
327 wpa_s->wnmsleep_used = 0; in wpa_supplicant_mark_disassoc()
328 wnm_clear_coloc_intf_reporting(wpa_s); in wpa_supplicant_mark_disassoc()
331 wpa_s->last_tk_alg = WPA_ALG_NONE; in wpa_supplicant_mark_disassoc()
332 os_memset(wpa_s->last_tk, 0, sizeof(wpa_s->last_tk)); in wpa_supplicant_mark_disassoc()
334 wpa_s->ieee80211ac = 0; in wpa_supplicant_mark_disassoc()
336 if (wpa_s->enabled_4addr_mode && wpa_drv_set_4addr_mode(wpa_s, 0) == 0) in wpa_supplicant_mark_disassoc()
337 wpa_s->enabled_4addr_mode = 0; in wpa_supplicant_mark_disassoc()
341 static void wpa_find_assoc_pmkid(struct wpa_supplicant *wpa_s) in wpa_find_assoc_pmkid() argument
347 if (wpa_sm_parse_own_wpa_ie(wpa_s->wpa, &ie) < 0 || in wpa_find_assoc_pmkid()
352 pmksa_set = pmksa_cache_set_current(wpa_s->wpa, in wpa_find_assoc_pmkid()
356 eapol_sm_notify_pmkid_attempt(wpa_s->eapol); in wpa_find_assoc_pmkid()
361 wpa_dbg(wpa_s, MSG_DEBUG, "RSN: PMKID from assoc IE %sfound from " in wpa_find_assoc_pmkid()
366 static void wpa_supplicant_event_pmkid_candidate(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_pmkid_candidate() argument
370 wpa_dbg(wpa_s, MSG_DEBUG, "RSN: No data in PMKID candidate " in wpa_supplicant_event_pmkid_candidate()
374 wpa_dbg(wpa_s, MSG_DEBUG, "RSN: PMKID candidate event - bssid=" MACSTR in wpa_supplicant_event_pmkid_candidate()
380 pmksa_candidate_add(wpa_s->wpa, data->pmkid_candidate.bssid, in wpa_supplicant_event_pmkid_candidate()
386 static int wpa_supplicant_dynamic_keys(struct wpa_supplicant *wpa_s) in wpa_supplicant_dynamic_keys() argument
388 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE || in wpa_supplicant_dynamic_keys()
389 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) in wpa_supplicant_dynamic_keys()
393 if (wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA && in wpa_supplicant_dynamic_keys()
394 wpa_s->current_ssid && in wpa_supplicant_dynamic_keys()
395 !(wpa_s->current_ssid->eapol_flags & in wpa_supplicant_dynamic_keys()
417 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s, in wpa_supplicant_scard_init() argument
425 wpa_s->scard != NULL || wpa_s->conf->external_sim) in wpa_supplicant_scard_init()
454 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is configured to " in wpa_supplicant_scard_init()
460 wpa_dbg(wpa_s, MSG_DEBUG, "Selected network is configured to use SIM " in wpa_supplicant_scard_init()
463 wpa_s->scard = scard_init(wpa_s->conf->pcsc_reader); in wpa_supplicant_scard_init()
464 if (wpa_s->scard == NULL) { in wpa_supplicant_scard_init()
465 wpa_msg(wpa_s, MSG_WARNING, "Failed to initialize SIM " in wpa_supplicant_scard_init()
469 wpa_sm_set_scard_ctx(wpa_s->wpa, wpa_s->scard); in wpa_supplicant_scard_init()
470 eapol_sm_register_scard_ctx(wpa_s->eapol, wpa_s->scard); in wpa_supplicant_scard_init()
533 static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s, in wpa_supplicant_ssid_bss_match() argument
543 ret = wpas_wps_ssid_bss_match(wpa_s, ssid, bss); in wpa_supplicant_ssid_bss_match()
559 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
572 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
580 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
587 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
594 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
602 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
609 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
616 wpas_get_ssid_pmf(wpa_s, ssid) == in wpa_supplicant_ssid_bss_match()
619 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
625 wpas_get_ssid_pmf(wpa_s, ssid) == in wpa_supplicant_ssid_bss_match()
628 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
635 wpas_get_ssid_pmf(wpa_s, ssid) != in wpa_supplicant_ssid_bss_match()
638 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
645 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
651 if (wpas_get_ssid_pmf(wpa_s, ssid) == MGMT_FRAME_PROTECTION_REQUIRED && in wpa_supplicant_ssid_bss_match()
654 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()
675 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()
689 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
696 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
703 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
709 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
717 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
725 if (wpa_s->owe_transition_select && in wpa_supplicant_ssid_bss_match()
731 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
735 wpa_s->owe_transition_search = 1; in wpa_supplicant_ssid_bss_match()
739 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
748 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
756 wpa_dbg(wpa_s, MSG_DEBUG, " allow in OSEN"); in wpa_supplicant_ssid_bss_match()
762 wpa_dbg(wpa_s, MSG_DEBUG, " allow in non-WPA/WPA2"); in wpa_supplicant_ssid_bss_match()
767 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_ssid_bss_match()
788 static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, in rate_match() argument
799 modes = wpa_s->hw.modes; in rate_match()
809 for (i = 0; i < wpa_s->hw.num_modes; i++) { in rate_match()
847 wpa_dbg(wpa_s, MSG_DEBUG, in rate_match()
859 wpa_dbg(wpa_s, MSG_DEBUG, in rate_match()
881 wpa_dbg(wpa_s, MSG_DEBUG, in rate_match()
937 static void owe_trans_ssid(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, in owe_trans_ssid() argument
962 wpa_dbg(wpa_s, MSG_DEBUG, "OWE: transition mode BSSID: " MACSTR in owe_trans_ssid()
970 open_bss = wpa_bss_get_bssid_latest(wpa_s, bssid); in owe_trans_ssid()
975 wpa_dbg(wpa_s, MSG_DEBUG, in owe_trans_ssid()
983 wpa_dbg(wpa_s, MSG_DEBUG, in owe_trans_ssid()
994 wpa_dbg(wpa_s, MSG_DEBUG, in owe_trans_ssid()
1003 wpa_dbg(wpa_s, MSG_DEBUG, "OWE: learned transition mode OWE SSID: %s", in owe_trans_ssid()
1011 struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s, in wpa_scan_res_match() argument
1042 wpa_dbg(wpa_s, MSG_DEBUG, "%d: " MACSTR in wpa_scan_res_match()
1056 e = wpa_blacklist_get(wpa_s, bss->bssid); in wpa_scan_res_match()
1059 if (wpa_supplicant_enabled_networks(wpa_s) == 1) { in wpa_scan_res_match()
1072 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1082 owe_trans_ssid(wpa_s, bss, &match_ssid, &match_ssid_len); in wpa_scan_res_match()
1086 wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID not known"); in wpa_scan_res_match()
1090 if (disallowed_bssid(wpa_s, bss->bssid)) { in wpa_scan_res_match()
1092 wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID disallowed"); in wpa_scan_res_match()
1096 if (disallowed_ssid(wpa_s, match_ssid, match_ssid_len)) { in wpa_scan_res_match()
1098 wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID disallowed"); in wpa_scan_res_match()
1108 if (wpas_network_disabled(wpa_s, ssid)) { in wpa_scan_res_match()
1110 wpa_dbg(wpa_s, MSG_DEBUG, " skip - disabled"); in wpa_scan_res_match()
1114 res = wpas_temp_disabled(wpa_s, ssid); in wpa_scan_res_match()
1117 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1126 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1132 wpas_wps_ssid_wildcard_ok(wpa_s, ssid, bss)) in wpa_scan_res_match()
1141 wpas_wps_ssid_wildcard_ok(wpa_s, ssid, bss)) in wpa_scan_res_match()
1154 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1162 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1172 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1182 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1187 if (!wpa_supplicant_ssid_bss_match(wpa_s, ssid, bss, in wpa_scan_res_match()
1197 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1205 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1213 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1220 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1228 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1235 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1243 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1252 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1258 if (!rate_match(wpa_s, bss, debug_print)) { in wpa_scan_res_match()
1260 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1270 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1281 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1293 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1301 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1310 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1325 if (os_reltime_before(&bss->last_update, &wpa_s->scan_min_time)) in wpa_scan_res_match()
1329 os_reltime_sub(&wpa_s->scan_min_time, in wpa_scan_res_match()
1332 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1340 if (wpa_s->ignore_assoc_disallow) in wpa_scan_res_match()
1347 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1353 if (wpa_is_bss_tmp_disallowed(wpa_s, bss)) { in wpa_scan_res_match()
1355 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1366 !wpa_sm_pmksa_exists(wpa_s->wpa, bss->bssid, ssid) && in wpa_scan_res_match()
1371 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_scan_res_match()
1387 wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, in wpa_supplicant_select_bss() argument
1394 if (wpa_s->current_ssid) { in wpa_supplicant_select_bss()
1397 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_select_bss()
1399 for (i = 0; i < wpa_s->last_scan_res_used; i++) { in wpa_supplicant_select_bss()
1400 struct wpa_bss *bss = wpa_s->last_scan_res[i]; in wpa_supplicant_select_bss()
1402 ssid = wpa_scan_res_match(wpa_s, i, bss, group, in wpa_supplicant_select_bss()
1404 if (ssid != wpa_s->current_ssid) in wpa_supplicant_select_bss()
1406 wpa_dbg(wpa_s, MSG_DEBUG, "%u: " MACSTR in wpa_supplicant_select_bss()
1414 wpa_dbg(wpa_s, MSG_DEBUG, "Try to find BSS matching pre-selected network id=%d", in wpa_supplicant_select_bss()
1417 wpa_dbg(wpa_s, MSG_DEBUG, "Selecting BSS from priority group %d", in wpa_supplicant_select_bss()
1420 for (i = 0; i < wpa_s->last_scan_res_used; i++) { in wpa_supplicant_select_bss()
1421 struct wpa_bss *bss = wpa_s->last_scan_res[i]; in wpa_supplicant_select_bss()
1423 wpa_s->owe_transition_select = 1; in wpa_supplicant_select_bss()
1424 *selected_ssid = wpa_scan_res_match(wpa_s, i, bss, group, in wpa_supplicant_select_bss()
1426 wpa_s->owe_transition_select = 0; in wpa_supplicant_select_bss()
1429 wpa_dbg(wpa_s, MSG_DEBUG, " selected BSS " MACSTR in wpa_supplicant_select_bss()
1440 struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s, in wpa_supplicant_pick_network() argument
1448 if (wpa_s->last_scan_res == NULL || in wpa_supplicant_pick_network()
1449 wpa_s->last_scan_res_used == 0) in wpa_supplicant_pick_network()
1452 if (wpa_s->next_ssid) { in wpa_supplicant_pick_network()
1454 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { in wpa_supplicant_pick_network()
1455 if (ssid == wpa_s->next_ssid) in wpa_supplicant_pick_network()
1459 wpa_s->next_ssid = NULL; in wpa_supplicant_pick_network()
1463 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) { in wpa_supplicant_pick_network()
1465 wpa_s->conf->pssid[prio]->priority) { in wpa_supplicant_pick_network()
1467 wpa_s, next_ssid, selected_ssid, 1); in wpa_supplicant_pick_network()
1472 wpa_s, wpa_s->conf->pssid[prio], in wpa_supplicant_pick_network()
1478 if (selected == NULL && wpa_s->blacklist && in wpa_supplicant_pick_network()
1479 !wpa_s->countermeasures) { in wpa_supplicant_pick_network()
1480 wpa_dbg(wpa_s, MSG_DEBUG, "No APs found - clear " in wpa_supplicant_pick_network()
1482 wpa_blacklist_clear(wpa_s); in wpa_supplicant_pick_network()
1483 wpa_s->blacklist_cleared++; in wpa_supplicant_pick_network()
1493 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_pick_network()
1496 wpas_notify_network_request(wpa_s, ssid, in wpa_supplicant_pick_network()
1504 wpas_send_ctrl_req(wpa_s, ssid, field_name, txt); in wpa_supplicant_pick_network()
1513 static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s, in wpa_supplicant_req_new_scan() argument
1516 if (!wpa_supplicant_enabled_networks(wpa_s)) { in wpa_supplicant_req_new_scan()
1522 wpa_dbg(wpa_s, MSG_DEBUG, "Short-circuit new scan request " in wpa_supplicant_req_new_scan()
1524 wpa_supplicant_set_state(wpa_s, WPA_INACTIVE); in wpa_supplicant_req_new_scan()
1528 wpa_s->scan_for_connection = 1; in wpa_supplicant_req_new_scan()
1529 wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec); in wpa_supplicant_req_new_scan()
1533 int wpa_supplicant_connect(struct wpa_supplicant *wpa_s, in wpa_supplicant_connect() argument
1537 if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) { in wpa_supplicant_connect()
1538 wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP in wpa_supplicant_connect()
1540 wpas_notify_wps_event_pbc_overlap(wpa_s); in wpa_supplicant_connect()
1542 if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT || in wpa_supplicant_connect()
1543 wpa_s->p2p_in_provisioning) { in wpa_supplicant_connect()
1545 wpa_s, NULL); in wpa_supplicant_connect()
1551 wpas_wps_pbc_overlap(wpa_s); in wpa_supplicant_connect()
1552 wpas_wps_cancel(wpa_s); in wpa_supplicant_connect()
1557 wpa_msg(wpa_s, MSG_DEBUG, in wpa_supplicant_connect()
1561 wpa_s->reassociate, MAC2STR(selected->bssid), in wpa_supplicant_connect()
1562 MAC2STR(wpa_s->bssid), MAC2STR(wpa_s->pending_bssid), in wpa_supplicant_connect()
1563 wpa_supplicant_state_txt(wpa_s->wpa_state), in wpa_supplicant_connect()
1564 ssid, wpa_s->current_ssid); in wpa_supplicant_connect()
1571 if (wpa_s->reassociate || in wpa_supplicant_connect()
1572 (os_memcmp(selected->bssid, wpa_s->bssid, ETH_ALEN) != 0 && in wpa_supplicant_connect()
1573 ((wpa_s->wpa_state != WPA_ASSOCIATING && in wpa_supplicant_connect()
1574 wpa_s->wpa_state != WPA_AUTHENTICATING) || in wpa_supplicant_connect()
1575 (!is_zero_ether_addr(wpa_s->pending_bssid) && in wpa_supplicant_connect()
1576 os_memcmp(selected->bssid, wpa_s->pending_bssid, ETH_ALEN) != in wpa_supplicant_connect()
1578 (is_zero_ether_addr(wpa_s->pending_bssid) && in wpa_supplicant_connect()
1579 ssid != wpa_s->current_ssid)))) { in wpa_supplicant_connect()
1580 if (wpa_supplicant_scard_init(wpa_s, ssid)) { in wpa_supplicant_connect()
1581 wpa_supplicant_req_new_scan(wpa_s, 10, 0); in wpa_supplicant_connect()
1584 wpa_msg(wpa_s, MSG_DEBUG, "Request association with " MACSTR, in wpa_supplicant_connect()
1586 wpa_supplicant_associate(wpa_s, selected, ssid); in wpa_supplicant_connect()
1588 wpa_dbg(wpa_s, MSG_DEBUG, "Already associated or trying to " in wpa_supplicant_connect()
1597 wpa_supplicant_pick_new_network(struct wpa_supplicant *wpa_s) in wpa_supplicant_pick_new_network() argument
1602 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) { in wpa_supplicant_pick_new_network()
1603 for (ssid = wpa_s->conf->pssid[prio]; ssid; ssid = ssid->pnext) in wpa_supplicant_pick_new_network()
1605 if (wpas_network_disabled(wpa_s, ssid)) in wpa_supplicant_pick_new_network()
1611 wpa_msg(wpa_s, MSG_INFO, in wpa_supplicant_pick_new_network()
1631 struct wpa_supplicant *wpa_s) in wpa_supplicant_rsn_preauth_scan_results() argument
1635 if (rsn_preauth_scan_results(wpa_s->wpa) < 0) in wpa_supplicant_rsn_preauth_scan_results()
1638 dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) { in wpa_supplicant_rsn_preauth_scan_results()
1649 rsn_preauth_scan_result(wpa_s->wpa, bss->bssid, ssid, rsn); in wpa_supplicant_rsn_preauth_scan_results()
1655 static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s, in wpa_supplicant_need_to_roam() argument
1666 if (wpa_s->reassociate) in wpa_supplicant_need_to_roam()
1668 if (wpa_s->wpa_state < WPA_ASSOCIATED) in wpa_supplicant_need_to_roam()
1670 if (wpa_s->current_ssid == NULL) in wpa_supplicant_need_to_roam()
1672 if (wpa_s->current_ssid != ssid) in wpa_supplicant_need_to_roam()
1675 if (wpas_driver_bss_selection(wpa_s)) in wpa_supplicant_need_to_roam()
1678 if (wpa_s->current_ssid->ssid) in wpa_supplicant_need_to_roam()
1679 current_bss = wpa_bss_get(wpa_s, wpa_s->bssid, in wpa_supplicant_need_to_roam()
1680 wpa_s->current_ssid->ssid, in wpa_supplicant_need_to_roam()
1681 wpa_s->current_ssid->ssid_len); in wpa_supplicant_need_to_roam()
1683 current_bss = wpa_bss_get_bssid(wpa_s, wpa_s->bssid); in wpa_supplicant_need_to_roam()
1695 wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation"); in wpa_supplicant_need_to_roam()
1696 wpa_dbg(wpa_s, MSG_DEBUG, "Current BSS: " MACSTR in wpa_supplicant_need_to_roam()
1701 wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS: " MACSTR in wpa_supplicant_need_to_roam()
1706 if (wpa_s->current_ssid->bssid_set && in wpa_supplicant_need_to_roam()
1707 os_memcmp(selected->bssid, wpa_s->current_ssid->bssid, ETH_ALEN) == in wpa_supplicant_need_to_roam()
1709 wpa_dbg(wpa_s, MSG_DEBUG, "Allow reassociation - selected BSS " in wpa_supplicant_need_to_roam()
1715 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_need_to_roam()
1724 wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - Current BSS has better " in wpa_supplicant_need_to_roam()
1730 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_need_to_roam()
1776 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_need_to_roam()
1782 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_need_to_roam()
1801 static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, in _wpa_supplicant_event_scan_results() argument
1813 if (wpa_s->ap_iface) in _wpa_supplicant_event_scan_results()
1817 wpa_supplicant_notify_scanning(wpa_s, 0); in _wpa_supplicant_event_scan_results()
1819 scan_res = wpa_supplicant_get_scan_results(wpa_s, in _wpa_supplicant_event_scan_results()
1823 if (wpa_s->conf->ap_scan == 2 || ap || in _wpa_supplicant_event_scan_results()
1824 wpa_s->scan_res_handler == scan_only_handler) in _wpa_supplicant_event_scan_results()
1830 wpa_dbg(wpa_s, MSG_DEBUG, "Failed to get scan results - try " in _wpa_supplicant_event_scan_results()
1832 wpa_supplicant_req_new_scan(wpa_s, 1, 0); in _wpa_supplicant_event_scan_results()
1858 if (own_request && wpa_s->scan_res_handler && in _wpa_supplicant_event_scan_results()
1860 void (*scan_res_handler)(struct wpa_supplicant *wpa_s, in _wpa_supplicant_event_scan_results()
1863 scan_res_handler = wpa_s->scan_res_handler; in _wpa_supplicant_event_scan_results()
1864 wpa_s->scan_res_handler = NULL; in _wpa_supplicant_event_scan_results()
1865 scan_res_handler(wpa_s, scan_res); in _wpa_supplicant_event_scan_results()
1871 wpa_dbg(wpa_s, MSG_DEBUG, "Ignore scan results in AP mode"); in _wpa_supplicant_event_scan_results()
1873 if (wpa_s->ap_iface->scan_cb) in _wpa_supplicant_event_scan_results()
1874 wpa_s->ap_iface->scan_cb(wpa_s->ap_iface); in _wpa_supplicant_event_scan_results()
1879 wpa_dbg(wpa_s, MSG_DEBUG, "New scan results available (own=%u ext=%u)", in _wpa_supplicant_event_scan_results()
1880 wpa_s->own_scan_running, in _wpa_supplicant_event_scan_results()
1882 if (wpa_s->last_scan_req == MANUAL_SCAN_REQ && in _wpa_supplicant_event_scan_results()
1883 wpa_s->manual_scan_use_id && wpa_s->own_scan_running && in _wpa_supplicant_event_scan_results()
1885 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS "id=%u", in _wpa_supplicant_event_scan_results()
1886 wpa_s->manual_scan_id); in _wpa_supplicant_event_scan_results()
1887 wpa_s->manual_scan_use_id = 0; in _wpa_supplicant_event_scan_results()
1889 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS); in _wpa_supplicant_event_scan_results()
1891 wpas_notify_scan_results(wpa_s); in _wpa_supplicant_event_scan_results()
1893 wpas_notify_scan_done(wpa_s, 1); in _wpa_supplicant_event_scan_results()
1896 …wpa_dbg(wpa_s, MSG_DEBUG, "Do not use results from externally requested scan operation for network… in _wpa_supplicant_event_scan_results()
1901 if (wnm_scan_process(wpa_s, 1) > 0) in _wpa_supplicant_event_scan_results()
1904 if (sme_proc_obss_scan(wpa_s) > 0) in _wpa_supplicant_event_scan_results()
1908 wpas_beacon_rep_scan_process(wpa_s, scan_res, &data->scan_info) > 0) in _wpa_supplicant_event_scan_results()
1911 if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s))) in _wpa_supplicant_event_scan_results()
1914 if (autoscan_notify_scan(wpa_s, scan_res)) in _wpa_supplicant_event_scan_results()
1917 if (wpa_s->disconnected) { in _wpa_supplicant_event_scan_results()
1918 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); in _wpa_supplicant_event_scan_results()
1922 if (!wpas_driver_bss_selection(wpa_s) && in _wpa_supplicant_event_scan_results()
1923 bgscan_notify_scan(wpa_s, scan_res) == 1) in _wpa_supplicant_event_scan_results()
1926 wpas_wps_update_ap_info(wpa_s, scan_res); in _wpa_supplicant_event_scan_results()
1928 if (wpa_s->wpa_state >= WPA_AUTHENTICATING && in _wpa_supplicant_event_scan_results()
1929 wpa_s->wpa_state < WPA_COMPLETED) in _wpa_supplicant_event_scan_results()
1934 if (own_request && wpa_s->scan_work) { in _wpa_supplicant_event_scan_results()
1935 struct wpa_radio_work *work = wpa_s->scan_work; in _wpa_supplicant_event_scan_results()
1936 wpa_s->scan_work = NULL; in _wpa_supplicant_event_scan_results()
1940 return wpas_select_network_from_last_scan(wpa_s, 1, own_request); in _wpa_supplicant_event_scan_results()
1944 if (own_request && wpa_s->scan_work) { in _wpa_supplicant_event_scan_results()
1945 struct wpa_radio_work *work = wpa_s->scan_work; in _wpa_supplicant_event_scan_results()
1946 wpa_s->scan_work = NULL; in _wpa_supplicant_event_scan_results()
1953 static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s, in wpas_select_network_from_last_scan() argument
1958 int time_to_reenable = wpas_reenabled_network_time(wpa_s); in wpas_select_network_from_last_scan()
1961 wpa_dbg(wpa_s, MSG_DEBUG, in wpas_select_network_from_last_scan()
1964 eloop_cancel_timeout(wpas_network_reenabled, wpa_s, NULL); in wpas_select_network_from_last_scan()
1966 wpas_network_reenabled, wpa_s, NULL); in wpas_select_network_from_last_scan()
1970 if (wpa_s->p2p_mgmt) in wpas_select_network_from_last_scan()
1973 wpa_s->owe_transition_search = 0; in wpas_select_network_from_last_scan()
1974 selected = wpa_supplicant_pick_network(wpa_s, &ssid); in wpas_select_network_from_last_scan()
1977 if (wpa_s->ifmsh) { in wpas_select_network_from_last_scan()
1978 wpa_msg(wpa_s, MSG_INFO, in wpas_select_network_from_last_scan()
1986 skip = !wpa_supplicant_need_to_roam(wpa_s, selected, ssid); in wpas_select_network_from_last_scan()
1989 wpa_supplicant_rsn_preauth_scan_results(wpa_s); in wpas_select_network_from_last_scan()
1993 if (ssid != wpa_s->current_ssid && in wpas_select_network_from_last_scan()
1994 wpa_s->wpa_state >= WPA_AUTHENTICATING) { in wpas_select_network_from_last_scan()
1995 wpa_s->own_disconnect_req = 1; in wpas_select_network_from_last_scan()
1997 wpa_s, WLAN_REASON_DEAUTH_LEAVING); in wpas_select_network_from_last_scan()
2000 if (wpa_supplicant_connect(wpa_s, selected, ssid) < 0) { in wpas_select_network_from_last_scan()
2001 wpa_dbg(wpa_s, MSG_DEBUG, "Connect failed"); in wpas_select_network_from_last_scan()
2005 wpa_supplicant_rsn_preauth_scan_results(wpa_s); in wpas_select_network_from_last_scan()
2013 wpa_dbg(wpa_s, MSG_DEBUG, "No suitable network found"); in wpas_select_network_from_last_scan()
2014 ssid = wpa_supplicant_pick_new_network(wpa_s); in wpas_select_network_from_last_scan()
2016 wpa_dbg(wpa_s, MSG_DEBUG, "Setup a new network"); in wpas_select_network_from_last_scan()
2017 wpa_supplicant_associate(wpa_s, NULL, ssid); in wpas_select_network_from_last_scan()
2019 wpa_supplicant_rsn_preauth_scan_results(wpa_s); in wpas_select_network_from_last_scan()
2026 int timeout_sec = wpa_s->scan_interval; in wpas_select_network_from_last_scan()
2031 res = wpas_p2p_scan_no_go_seen(wpa_s); in wpas_select_network_from_last_scan()
2037 if (wpa_s->p2p_in_provisioning || in wpas_select_network_from_last_scan()
2038 wpa_s->show_group_started || in wpas_select_network_from_last_scan()
2039 wpa_s->p2p_in_invitation) { in wpas_select_network_from_last_scan()
2047 wpa_supplicant_req_new_scan(wpa_s, timeout_sec, in wpas_select_network_from_last_scan()
2053 if (wpa_s->conf->auto_interworking && in wpas_select_network_from_last_scan()
2054 wpa_s->conf->interworking && in wpas_select_network_from_last_scan()
2055 wpa_s->conf->cred) { in wpas_select_network_from_last_scan()
2056 wpa_dbg(wpa_s, MSG_DEBUG, "Interworking: " in wpas_select_network_from_last_scan()
2059 wpa_s->network_select = 1; in wpas_select_network_from_last_scan()
2060 wpa_s->auto_network_select = 1; in wpas_select_network_from_last_scan()
2061 interworking_start_fetch_anqp(wpa_s); in wpas_select_network_from_last_scan()
2066 if (wpa_s->after_wps > 0 || wpas_wps_searching(wpa_s)) { in wpas_select_network_from_last_scan()
2067 wpa_dbg(wpa_s, MSG_DEBUG, "Use shorter wait during WPS processing"); in wpas_select_network_from_last_scan()
2070 wpa_supplicant_req_new_scan(wpa_s, timeout_sec, in wpas_select_network_from_last_scan()
2076 if (wpa_s->owe_transition_search) { in wpas_select_network_from_last_scan()
2077 wpa_dbg(wpa_s, MSG_DEBUG, in wpas_select_network_from_last_scan()
2081 wpa_supplicant_req_new_scan(wpa_s, timeout_sec, in wpas_select_network_from_last_scan()
2086 if (wpa_supplicant_req_sched_scan(wpa_s)) in wpas_select_network_from_last_scan()
2087 wpa_supplicant_req_new_scan(wpa_s, timeout_sec, in wpas_select_network_from_last_scan()
2090 wpa_msg_ctrl(wpa_s, MSG_INFO, in wpas_select_network_from_last_scan()
2098 static int wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_scan_results() argument
2104 res = _wpa_supplicant_event_scan_results(wpa_s, data, 1, 0); in wpa_supplicant_event_scan_results()
2128 dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant, in wpa_supplicant_event_scan_results()
2130 if (ifs != wpa_s) { in wpa_supplicant_event_scan_results()
2146 int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s) in wpa_supplicant_fast_associate() argument
2153 wpa_s->ignore_post_flush_scan_res = 0; in wpa_supplicant_fast_associate()
2155 if (wpa_s->last_scan_res_used == 0) in wpa_supplicant_fast_associate()
2159 if (os_reltime_expired(&now, &wpa_s->last_scan, 5)) { in wpa_supplicant_fast_associate()
2164 return wpas_select_network_from_last_scan(wpa_s, 0, 1); in wpa_supplicant_fast_associate()
2172 struct wpa_supplicant *wpa_s = eloop_ctx; in wnm_bss_keep_alive() local
2174 if (wpa_s->wpa_state < WPA_ASSOCIATED) in wnm_bss_keep_alive()
2177 if (!wpa_s->no_keep_alive) { in wnm_bss_keep_alive()
2179 MAC2STR(wpa_s->bssid)); in wnm_bss_keep_alive()
2183 if (wpa_s->l2) in wnm_bss_keep_alive()
2184 l2_packet_send(wpa_s->l2, wpa_s->bssid, 0x0800, in wnm_bss_keep_alive()
2189 if (wpa_s->sme.bss_max_idle_period) { in wnm_bss_keep_alive()
2191 msec = wpa_s->sme.bss_max_idle_period * 1024; /* times 1000 */ in wnm_bss_keep_alive()
2195 wnm_bss_keep_alive, wpa_s, NULL); in wnm_bss_keep_alive()
2201 static void wnm_process_assoc_resp(struct wpa_supplicant *wpa_s, in wnm_process_assoc_resp() argument
2215 wpa_s->sme.bss_max_idle_period = in wnm_process_assoc_resp()
2218 "TU)%s", wpa_s->sme.bss_max_idle_period, in wnm_process_assoc_resp()
2221 if (wpa_s->sme.bss_max_idle_period == 0) in wnm_process_assoc_resp()
2222 wpa_s->sme.bss_max_idle_period = 1; in wnm_process_assoc_resp()
2223 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) { in wnm_process_assoc_resp()
2224 eloop_cancel_timeout(wnm_bss_keep_alive, wpa_s, NULL); in wnm_process_assoc_resp()
2226 msec = wpa_s->sme.bss_max_idle_period * 1024; in wnm_process_assoc_resp()
2230 wnm_bss_keep_alive, wpa_s, in wnm_process_assoc_resp()
2240 void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s) in wnm_bss_keep_alive_deinit() argument
2243 eloop_cancel_timeout(wnm_bss_keep_alive, wpa_s, NULL); in wnm_bss_keep_alive_deinit()
2250 static int wpas_qos_map_set(struct wpa_supplicant *wpa_s, const u8 *qos_map, in wpas_qos_map_set() argument
2256 res = wpa_drv_set_qos_map(wpa_s, qos_map, len); in wpas_qos_map_set()
2265 static void interworking_process_assoc_resp(struct wpa_supplicant *wpa_s, in interworking_process_assoc_resp() argument
2277 wpas_qos_map_set(wpa_s, elems.qos_map_set, in interworking_process_assoc_resp()
2285 static void multi_ap_process_assoc_resp(struct wpa_supplicant *wpa_s, in multi_ap_process_assoc_resp() argument
2292 if (!wpa_s->current_ssid || in multi_ap_process_assoc_resp()
2293 !wpa_s->current_ssid->multi_ap_backhaul_sta || in multi_ap_process_assoc_resp()
2314 wpa_s->current_ssid->key_mgmt & WPA_KEY_MGMT_WPS) { in multi_ap_process_assoc_resp()
2324 if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) { in multi_ap_process_assoc_resp()
2328 wpa_s->enabled_4addr_mode = 1; in multi_ap_process_assoc_resp()
2332 wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING); in multi_ap_process_assoc_resp()
2337 static int wpas_fst_update_mbie(struct wpa_supplicant *wpa_s, in wpas_fst_update_mbie() argument
2342 if (!ie || !ie_len || !wpa_s->fst) in wpas_fst_update_mbie()
2370 wpabuf_free(wpa_s->received_mb_ies); in wpas_fst_update_mbie()
2371 wpa_s->received_mb_ies = mb_ies_by_info(&mb_ies); in wpas_fst_update_mbie()
2380 static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_associnfo() argument
2389 wpa_dbg(wpa_s, MSG_DEBUG, "Association info event"); in wpa_supplicant_event_associnfo()
2397 wpa_tdls_assoc_resp_ies(wpa_s->wpa, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
2401 wnm_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
2405 interworking_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
2408 if (wpa_s->hw_capab == CAPAB_VHT && in wpa_supplicant_event_associnfo()
2411 wpa_s->ieee80211ac = 1; in wpa_supplicant_event_associnfo()
2413 multi_ap_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
2421 wpa_dbg(wpa_s, MSG_DEBUG, "freq=%u MHz", in wpa_supplicant_event_associnfo()
2424 wpa_s->connection_set = 0; in wpa_supplicant_event_associnfo()
2434 wpa_s->connection_set = 1; in wpa_supplicant_event_associnfo()
2435 wpa_s->connection_ht = req_elems.ht_capabilities && in wpa_supplicant_event_associnfo()
2437 wpa_s->connection_vht = req_elems.vht_capabilities && in wpa_supplicant_event_associnfo()
2439 wpa_s->connection_he = req_elems.he_capabilities && in wpa_supplicant_event_associnfo()
2460 if (wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, p, len)) in wpa_supplicant_event_associnfo()
2463 wpa_find_assoc_pmkid(wpa_s); in wpa_supplicant_event_associnfo()
2470 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
2474 if ((wpa_s->sme.auth_alg == WPA_AUTH_ALG_FILS || in wpa_supplicant_event_associnfo()
2475 wpa_s->sme.auth_alg == WPA_AUTH_ALG_FILS_SK_PFS) && in wpa_supplicant_event_associnfo()
2477 fils_process_assoc_resp(wpa_s->wpa, in wpa_supplicant_event_associnfo()
2480 wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_UNSPECIFIED); in wpa_supplicant_event_associnfo()
2486 if (wpa_s->auth_alg == WPA_AUTH_ALG_FILS && in wpa_supplicant_event_associnfo()
2487 !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) in wpa_supplicant_event_associnfo()
2488 wpa_sm_set_reset_fils_completed(wpa_s->wpa, 1); in wpa_supplicant_event_associnfo()
2492 if (wpa_s->key_mgmt == WPA_KEY_MGMT_OWE && in wpa_supplicant_event_associnfo()
2493 (wpa_drv_get_bssid(wpa_s, bssid) < 0 || in wpa_supplicant_event_associnfo()
2494 owe_process_assoc_resp(wpa_s->wpa, bssid, in wpa_supplicant_event_associnfo()
2497 wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_UNSPECIFIED); in wpa_supplicant_event_associnfo()
2503 wpa_sm_set_dpp_z(wpa_s->wpa, NULL); in wpa_supplicant_event_associnfo()
2504 if (wpa_s->key_mgmt == WPA_KEY_MGMT_DPP && wpa_s->dpp_pfs) { in wpa_supplicant_event_associnfo()
2512 if (dpp_pfs_process(wpa_s->dpp_pfs, elems.owe_dh, in wpa_supplicant_event_associnfo()
2514 wpa_supplicant_deauthenticate(wpa_s, in wpa_supplicant_event_associnfo()
2519 wpa_sm_set_dpp_z(wpa_s->wpa, wpa_s->dpp_pfs->secret); in wpa_supplicant_event_associnfo()
2526 if (wpa_s->sme.auth_alg == WPA_AUTH_ALG_FT) { in wpa_supplicant_event_associnfo()
2527 if (wpa_drv_get_bssid(wpa_s, bssid) < 0 || in wpa_supplicant_event_associnfo()
2528 wpa_ft_validate_reassoc_resp(wpa_s->wpa, in wpa_supplicant_event_associnfo()
2532 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Validation of " in wpa_supplicant_event_associnfo()
2535 wpa_s, WLAN_REASON_INVALID_IE); in wpa_supplicant_event_associnfo()
2544 if (p && wpa_s->current_ssid && in wpa_supplicant_event_associnfo()
2545 wpa_s->current_ssid->key_mgmt == WPA_KEY_MGMT_WPS) { in wpa_supplicant_event_associnfo()
2549 wpa_msg(wpa_s, MSG_INFO, "WPS-STRICT: AP did not " in wpa_supplicant_event_associnfo()
2557 wpa_s, WLAN_REASON_INVALID_IE); in wpa_supplicant_event_associnfo()
2574 wpa_s->sme.ft_used = 1; in wpa_supplicant_event_associnfo()
2575 os_memcpy(wpa_s->sme.mobility_domain, p + 2, in wpa_supplicant_event_associnfo()
2585 if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) && in wpa_supplicant_event_associnfo()
2586 wpa_ft_is_completed(wpa_s->wpa)) { in wpa_supplicant_event_associnfo()
2587 if (wpa_drv_get_bssid(wpa_s, bssid) < 0 || in wpa_supplicant_event_associnfo()
2588 wpa_ft_validate_reassoc_resp(wpa_s->wpa, in wpa_supplicant_event_associnfo()
2592 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Validation of " in wpa_supplicant_event_associnfo()
2595 wpa_s, WLAN_REASON_INVALID_IE); in wpa_supplicant_event_associnfo()
2598 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Reassociation Response done"); in wpa_supplicant_event_associnfo()
2601 wpa_sm_set_ft_params(wpa_s->wpa, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
2623 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, p, len); in wpa_supplicant_event_associnfo()
2629 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, p, len); in wpa_supplicant_event_associnfo()
2637 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
2639 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
2641 wpa_s->ap_ies_from_associnfo = 1; in wpa_supplicant_event_associnfo()
2643 if (wpa_s->assoc_freq && data->assoc_info.freq && in wpa_supplicant_event_associnfo()
2644 wpa_s->assoc_freq != data->assoc_info.freq) { in wpa_supplicant_event_associnfo()
2647 wpa_s->assoc_freq, data->assoc_info.freq); in wpa_supplicant_event_associnfo()
2648 wpa_supplicant_update_scan_results(wpa_s); in wpa_supplicant_event_associnfo()
2651 wpa_s->assoc_freq = data->assoc_info.freq; in wpa_supplicant_event_associnfo()
2657 static int wpa_supplicant_assoc_update_ie(struct wpa_supplicant *wpa_s) in wpa_supplicant_assoc_update_ie() argument
2661 if (!wpa_s->current_bss || !wpa_s->current_ssid) in wpa_supplicant_assoc_update_ie()
2664 if (!wpa_key_mgmt_wpa_any(wpa_s->current_ssid->key_mgmt)) in wpa_supplicant_assoc_update_ie()
2667 bss_wpa = wpa_bss_get_vendor_ie(wpa_s->current_bss, in wpa_supplicant_assoc_update_ie()
2669 bss_rsn = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_RSN); in wpa_supplicant_assoc_update_ie()
2671 if (wpa_sm_set_ap_wpa_ie(wpa_s->wpa, bss_wpa, in wpa_supplicant_assoc_update_ie()
2673 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, bss_rsn, in wpa_supplicant_assoc_update_ie()
2681 static void wpas_fst_update_mb_assoc(struct wpa_supplicant *wpa_s, in wpas_fst_update_mb_assoc() argument
2686 struct wpa_bss *bss = wpa_s->current_bss; in wpas_fst_update_mb_assoc()
2689 wpabuf_free(wpa_s->received_mb_ies); in wpas_fst_update_mb_assoc()
2690 wpa_s->received_mb_ies = NULL; in wpas_fst_update_mb_assoc()
2693 !wpas_fst_update_mbie(wpa_s, ai->resp_ies, ai->resp_ies_len)) { in wpas_fst_update_mb_assoc()
2700 !wpas_fst_update_mbie(wpa_s, ai->beacon_ies, ai->beacon_ies_len)) { in wpas_fst_update_mb_assoc()
2712 if (!wpas_fst_update_mbie(wpa_s, ieprb, bss->ie_len)) in wpas_fst_update_mb_assoc()
2714 else if (!wpas_fst_update_mbie(wpa_s, iebcn, bss->beacon_ie_len)) in wpas_fst_update_mb_assoc()
2720 static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_assoc() argument
2728 if (wpa_s->ap_iface) { in wpa_supplicant_event_assoc()
2731 hostapd_notif_assoc(wpa_s->ap_iface->bss[0], in wpa_supplicant_event_assoc()
2740 eloop_cancel_timeout(wpas_network_reenabled, wpa_s, NULL); in wpa_supplicant_event_assoc()
2742 ft_completed = wpa_ft_is_completed(wpa_s->wpa); in wpa_supplicant_event_assoc()
2743 if (data && wpa_supplicant_event_associnfo(wpa_s, data) < 0) in wpa_supplicant_event_assoc()
2751 ft_completed = wpa_fils_is_completed(wpa_s->wpa); in wpa_supplicant_event_assoc()
2753 if (wpa_drv_get_bssid(wpa_s, bssid) < 0) { in wpa_supplicant_event_assoc()
2754 wpa_dbg(wpa_s, MSG_ERROR, "Failed to get BSSID"); in wpa_supplicant_event_assoc()
2756 wpa_s, WLAN_REASON_DEAUTH_LEAVING); in wpa_supplicant_event_assoc()
2760 wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATED); in wpa_supplicant_event_assoc()
2761 if (os_memcmp(bssid, wpa_s->bssid, ETH_ALEN) != 0) { in wpa_supplicant_event_assoc()
2762 if (os_reltime_initialized(&wpa_s->session_start)) { in wpa_supplicant_event_assoc()
2763 os_reltime_age(&wpa_s->session_start, in wpa_supplicant_event_assoc()
2764 &wpa_s->session_length); in wpa_supplicant_event_assoc()
2765 wpa_s->session_start.sec = 0; in wpa_supplicant_event_assoc()
2766 wpa_s->session_start.usec = 0; in wpa_supplicant_event_assoc()
2767 wpas_notify_session_length(wpa_s); in wpa_supplicant_event_assoc()
2769 wpas_notify_auth_changed(wpa_s); in wpa_supplicant_event_assoc()
2770 os_get_reltime(&wpa_s->session_start); in wpa_supplicant_event_assoc()
2772 wpa_dbg(wpa_s, MSG_DEBUG, "Associated to a new BSS: BSSID=" in wpa_supplicant_event_assoc()
2776 os_memcpy(wpa_s->bssid, bssid, ETH_ALEN); in wpa_supplicant_event_assoc()
2777 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); in wpa_supplicant_event_assoc()
2778 wpas_notify_bssid_changed(wpa_s); in wpa_supplicant_event_assoc()
2780 if (wpa_supplicant_dynamic_keys(wpa_s) && !ft_completed) { in wpa_supplicant_event_assoc()
2781 wpa_clear_keys(wpa_s, bssid); in wpa_supplicant_event_assoc()
2783 if (wpa_supplicant_select_config(wpa_s) < 0) { in wpa_supplicant_event_assoc()
2785 wpa_s, WLAN_REASON_DEAUTH_LEAVING); in wpa_supplicant_event_assoc()
2790 if (wpa_s->conf->ap_scan == 1 && in wpa_supplicant_event_assoc()
2791 wpa_s->drv_flags & WPA_DRIVER_FLAGS_BSS_SELECTION) { in wpa_supplicant_event_assoc()
2792 if (wpa_supplicant_assoc_update_ie(wpa_s) < 0 && new_bss) in wpa_supplicant_event_assoc()
2793 wpa_msg(wpa_s, MSG_WARNING, in wpa_supplicant_event_assoc()
2797 wpas_fst_update_mb_assoc(wpa_s, data); in wpa_supplicant_event_assoc()
2800 os_memcpy(wpa_s->sme.prev_bssid, bssid, ETH_ALEN); in wpa_supplicant_event_assoc()
2801 wpa_s->sme.prev_bssid_set = 1; in wpa_supplicant_event_assoc()
2802 wpa_s->sme.last_unprot_disconnect.sec = 0; in wpa_supplicant_event_assoc()
2805 wpa_msg(wpa_s, MSG_INFO, "Associated with " MACSTR, MAC2STR(bssid)); in wpa_supplicant_event_assoc()
2806 if (wpa_s->current_ssid) { in wpa_supplicant_event_assoc()
2811 wpa_supplicant_scard_init(wpa_s, wpa_s->current_ssid); in wpa_supplicant_event_assoc()
2813 wpa_sm_notify_assoc(wpa_s->wpa, bssid); in wpa_supplicant_event_assoc()
2814 if (wpa_s->l2) in wpa_supplicant_event_assoc()
2815 l2_packet_notify_auth_start(wpa_s->l2); in wpa_supplicant_event_assoc()
2828 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); in wpa_supplicant_event_assoc()
2829 eapol_sm_notify_portValid(wpa_s->eapol, FALSE); in wpa_supplicant_event_assoc()
2831 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || in wpa_supplicant_event_assoc()
2832 wpa_s->key_mgmt == WPA_KEY_MGMT_DPP || in wpa_supplicant_event_assoc()
2833 wpa_s->key_mgmt == WPA_KEY_MGMT_OWE || ft_completed || in wpa_supplicant_event_assoc()
2835 eapol_sm_notify_eap_success(wpa_s->eapol, FALSE); in wpa_supplicant_event_assoc()
2837 eapol_sm_notify_portEnabled(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2838 wpa_s->eapol_received = 0; in wpa_supplicant_event_assoc()
2839 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE || in wpa_supplicant_event_assoc()
2840 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE || in wpa_supplicant_event_assoc()
2841 (wpa_s->current_ssid && in wpa_supplicant_event_assoc()
2842 wpa_s->current_ssid->mode == IEEE80211_MODE_IBSS)) { in wpa_supplicant_event_assoc()
2843 if (wpa_s->current_ssid && in wpa_supplicant_event_assoc()
2844 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE && in wpa_supplicant_event_assoc()
2845 (wpa_s->drv_flags & in wpa_supplicant_event_assoc()
2851 wpa_supplicant_set_wpa_none_key(wpa_s, in wpa_supplicant_event_assoc()
2852 wpa_s->current_ssid); in wpa_supplicant_event_assoc()
2854 wpa_supplicant_cancel_auth_timeout(wpa_s); in wpa_supplicant_event_assoc()
2855 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); in wpa_supplicant_event_assoc()
2858 wpa_supplicant_req_auth_timeout(wpa_s, 10, 0); in wpa_supplicant_event_assoc()
2860 wpa_supplicant_cancel_scan(wpa_s); in wpa_supplicant_event_assoc()
2867 wpa_supplicant_cancel_auth_timeout(wpa_s); in wpa_supplicant_event_assoc()
2868 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); in wpa_supplicant_event_assoc()
2869 eapol_sm_notify_portValid(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2870 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2871 } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK) && in wpa_supplicant_event_assoc()
2872 wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) { in wpa_supplicant_event_assoc()
2877 wpa_supplicant_cancel_auth_timeout(wpa_s); in wpa_supplicant_event_assoc()
2878 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); in wpa_supplicant_event_assoc()
2879 eapol_sm_notify_portValid(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2880 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2881 } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X) && in wpa_supplicant_event_assoc()
2882 wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt)) { in wpa_supplicant_event_assoc()
2888 eapol_sm_notify_portValid(wpa_s->eapol, TRUE); in wpa_supplicant_event_assoc()
2891 wpa_s->last_eapol_matches_bssid = 0; in wpa_supplicant_event_assoc()
2893 if (wpa_s->pending_eapol_rx) { in wpa_supplicant_event_assoc()
2896 os_reltime_sub(&now, &wpa_s->pending_eapol_rx_time, &age); in wpa_supplicant_event_assoc()
2898 os_memcmp(wpa_s->pending_eapol_rx_src, bssid, ETH_ALEN) == in wpa_supplicant_event_assoc()
2900 wpa_dbg(wpa_s, MSG_DEBUG, "Process pending EAPOL " in wpa_supplicant_event_assoc()
2904 wpa_s, wpa_s->pending_eapol_rx_src, in wpa_supplicant_event_assoc()
2905 wpabuf_head(wpa_s->pending_eapol_rx), in wpa_supplicant_event_assoc()
2906 wpabuf_len(wpa_s->pending_eapol_rx)); in wpa_supplicant_event_assoc()
2908 wpabuf_free(wpa_s->pending_eapol_rx); in wpa_supplicant_event_assoc()
2909 wpa_s->pending_eapol_rx = NULL; in wpa_supplicant_event_assoc()
2912 if ((wpa_s->key_mgmt == WPA_KEY_MGMT_NONE || in wpa_supplicant_event_assoc()
2913 wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA) && in wpa_supplicant_event_assoc()
2914 wpa_s->current_ssid && in wpa_supplicant_event_assoc()
2915 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE)) { in wpa_supplicant_event_assoc()
2917 wpa_set_wep_keys(wpa_s, wpa_s->current_ssid); in wpa_supplicant_event_assoc()
2921 if (wpa_s->current_ssid && in wpa_supplicant_event_assoc()
2922 wpa_s->current_ssid->mode == WPAS_MODE_IBSS && in wpa_supplicant_event_assoc()
2923 wpa_s->key_mgmt != WPA_KEY_MGMT_NONE && in wpa_supplicant_event_assoc()
2924 wpa_s->key_mgmt != WPA_KEY_MGMT_WPA_NONE && in wpa_supplicant_event_assoc()
2925 wpa_s->ibss_rsn == NULL) { in wpa_supplicant_event_assoc()
2926 wpa_s->ibss_rsn = ibss_rsn_init(wpa_s, wpa_s->current_ssid); in wpa_supplicant_event_assoc()
2927 if (!wpa_s->ibss_rsn) { in wpa_supplicant_event_assoc()
2928 wpa_msg(wpa_s, MSG_INFO, "Failed to init IBSS RSN"); in wpa_supplicant_event_assoc()
2930 wpa_s, WLAN_REASON_DEAUTH_LEAVING); in wpa_supplicant_event_assoc()
2934 ibss_rsn_set_psk(wpa_s->ibss_rsn, wpa_s->current_ssid->psk); in wpa_supplicant_event_assoc()
2938 wpas_wps_notify_assoc(wpa_s, bssid); in wpa_supplicant_event_assoc()
2941 wmm_ac_notify_assoc(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_assoc()
2945 if (wpa_s->reassoc_same_bss) in wpa_supplicant_event_assoc()
2946 wmm_ac_restore_tspecs(wpa_s); in wpa_supplicant_event_assoc()
2950 if (wpa_key_mgmt_fils(wpa_s->key_mgmt)) { in wpa_supplicant_event_assoc()
2951 struct wpa_bss *bss = wpa_bss_get_bssid(wpa_s, bssid); in wpa_supplicant_event_assoc()
2955 wpa_sm_set_fils_cache_id(wpa_s->wpa, fils_cache_id); in wpa_supplicant_event_assoc()
2969 static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_disassoc() argument
2975 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) { in wpa_supplicant_event_disassoc()
2984 bssid = wpa_s->bssid; in wpa_supplicant_event_disassoc()
2986 bssid = wpa_s->pending_bssid; in wpa_supplicant_event_disassoc()
2989 wpa_s->wpa_state >= WPA_AUTHENTICATING) { in wpa_supplicant_event_disassoc()
2990 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" MACSTR in wpa_supplicant_event_disassoc()
2998 static int could_be_psk_mismatch(struct wpa_supplicant *wpa_s, u16 reason_code, in could_be_psk_mismatch() argument
3001 if (wpa_s->wpa_state != WPA_4WAY_HANDSHAKE || in could_be_psk_mismatch()
3002 !wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) in could_be_psk_mismatch()
3020 static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_disassoc_finish() argument
3032 authenticating = wpa_s->wpa_state == WPA_AUTHENTICATING; in wpa_supplicant_event_disassoc_finish()
3033 os_memcpy(prev_pending_bssid, wpa_s->pending_bssid, ETH_ALEN); in wpa_supplicant_event_disassoc_finish()
3035 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) { in wpa_supplicant_event_disassoc_finish()
3041 wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - ignore in " in wpa_supplicant_event_disassoc_finish()
3046 if (!wpa_s->disconnected && wpa_s->wpa_state >= WPA_AUTHENTICATING && in wpa_supplicant_event_disassoc_finish()
3057 curr = wpa_s->current_bss; in wpa_supplicant_event_disassoc_finish()
3059 if (could_be_psk_mismatch(wpa_s, reason_code, locally_generated)) { in wpa_supplicant_event_disassoc_finish()
3060 wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - " in wpa_supplicant_event_disassoc_finish()
3062 if (wpas_p2p_4way_hs_failed(wpa_s) > 0) in wpa_supplicant_event_disassoc_finish()
3064 wpas_auth_failed(wpa_s, "WRONG_KEY"); in wpa_supplicant_event_disassoc_finish()
3066 if (!wpa_s->disconnected && in wpa_supplicant_event_disassoc_finish()
3067 (!wpa_s->auto_reconnect_disabled || in wpa_supplicant_event_disassoc_finish()
3068 wpa_s->key_mgmt == WPA_KEY_MGMT_WPS || in wpa_supplicant_event_disassoc_finish()
3069 wpas_wps_searching(wpa_s) || in wpa_supplicant_event_disassoc_finish()
3070 wpas_wps_reenable_networks_pending(wpa_s))) { in wpa_supplicant_event_disassoc_finish()
3071 wpa_dbg(wpa_s, MSG_DEBUG, "Auto connect enabled: try to " in wpa_supplicant_event_disassoc_finish()
3073 wpa_s->key_mgmt == WPA_KEY_MGMT_WPS, in wpa_supplicant_event_disassoc_finish()
3074 wpas_wps_searching(wpa_s), in wpa_supplicant_event_disassoc_finish()
3075 wpa_s->wpa_state); in wpa_supplicant_event_disassoc_finish()
3076 if (wpa_s->wpa_state == WPA_COMPLETED && in wpa_supplicant_event_disassoc_finish()
3077 wpa_s->current_ssid && in wpa_supplicant_event_disassoc_finish()
3078 wpa_s->current_ssid->mode == WPAS_MODE_INFRA && in wpa_supplicant_event_disassoc_finish()
3087 fast_reconnect = wpa_s->current_bss; in wpa_supplicant_event_disassoc_finish()
3088 fast_reconnect_ssid = wpa_s->current_ssid; in wpa_supplicant_event_disassoc_finish()
3089 } else if (wpa_s->wpa_state >= WPA_ASSOCIATING) in wpa_supplicant_event_disassoc_finish()
3090 wpa_supplicant_req_scan(wpa_s, 0, 100000); in wpa_supplicant_event_disassoc_finish()
3092 wpa_dbg(wpa_s, MSG_DEBUG, "Do not request new " in wpa_supplicant_event_disassoc_finish()
3095 wpa_dbg(wpa_s, MSG_DEBUG, "Auto connect disabled: do not " in wpa_supplicant_event_disassoc_finish()
3097 wpa_s->reassociate = 0; in wpa_supplicant_event_disassoc_finish()
3098 wpa_s->disconnected = 1; in wpa_supplicant_event_disassoc_finish()
3099 if (!wpa_s->pno) in wpa_supplicant_event_disassoc_finish()
3100 wpa_supplicant_cancel_sched_scan(wpa_s); in wpa_supplicant_event_disassoc_finish()
3102 bssid = wpa_s->bssid; in wpa_supplicant_event_disassoc_finish()
3104 bssid = wpa_s->pending_bssid; in wpa_supplicant_event_disassoc_finish()
3105 if (wpa_s->wpa_state >= WPA_AUTHENTICATING) in wpa_supplicant_event_disassoc_finish()
3106 wpas_connection_failed(wpa_s, bssid); in wpa_supplicant_event_disassoc_finish()
3107 wpa_sm_notify_disassoc(wpa_s->wpa); in wpa_supplicant_event_disassoc_finish()
3109 wpa_s->disconnect_reason = -reason_code; in wpa_supplicant_event_disassoc_finish()
3111 wpa_s->disconnect_reason = reason_code; in wpa_supplicant_event_disassoc_finish()
3112 wpas_notify_disconnect_reason(wpa_s); in wpa_supplicant_event_disassoc_finish()
3113 if (wpa_supplicant_dynamic_keys(wpa_s)) { in wpa_supplicant_event_disassoc_finish()
3114 wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - remove keys"); in wpa_supplicant_event_disassoc_finish()
3115 wpa_clear_keys(wpa_s, wpa_s->bssid); in wpa_supplicant_event_disassoc_finish()
3117 last_ssid = wpa_s->current_ssid; in wpa_supplicant_event_disassoc_finish()
3118 wpa_supplicant_mark_disassoc(wpa_s); in wpa_supplicant_event_disassoc_finish()
3121 wpa_bss_remove(wpa_s, curr, "Connection to AP lost"); in wpa_supplicant_event_disassoc_finish()
3123 if (authenticating && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) { in wpa_supplicant_event_disassoc_finish()
3124 sme_disassoc_while_authenticating(wpa_s, prev_pending_bssid); in wpa_supplicant_event_disassoc_finish()
3125 wpa_s->current_ssid = last_ssid; in wpa_supplicant_event_disassoc_finish()
3129 !wpas_network_disabled(wpa_s, fast_reconnect_ssid) && in wpa_supplicant_event_disassoc_finish()
3130 !disallowed_bssid(wpa_s, fast_reconnect->bssid) && in wpa_supplicant_event_disassoc_finish()
3131 !disallowed_ssid(wpa_s, fast_reconnect->ssid, in wpa_supplicant_event_disassoc_finish()
3133 !wpas_temp_disabled(wpa_s, fast_reconnect_ssid) && in wpa_supplicant_event_disassoc_finish()
3134 !wpa_is_bss_tmp_disallowed(wpa_s, fast_reconnect)) { in wpa_supplicant_event_disassoc_finish()
3136 wpa_dbg(wpa_s, MSG_DEBUG, "Try to reconnect to the same BSS"); in wpa_supplicant_event_disassoc_finish()
3137 if (wpa_supplicant_connect(wpa_s, fast_reconnect, in wpa_supplicant_event_disassoc_finish()
3140 wpa_supplicant_req_scan(wpa_s, 0, 100000); in wpa_supplicant_event_disassoc_finish()
3150 wpa_supplicant_req_scan(wpa_s, 0, 100000); in wpa_supplicant_event_disassoc_finish()
3158 struct wpa_supplicant *wpa_s = eloop_ctx; in wpa_supplicant_delayed_mic_error_report() local
3160 if (!wpa_s->pending_mic_error_report) in wpa_supplicant_delayed_mic_error_report()
3163 wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Sending pending MIC error report"); in wpa_supplicant_delayed_mic_error_report()
3164 wpa_sm_key_request(wpa_s->wpa, 1, wpa_s->pending_mic_error_pairwise); in wpa_supplicant_delayed_mic_error_report()
3165 wpa_s->pending_mic_error_report = 0; in wpa_supplicant_delayed_mic_error_report()
3171 wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_michael_mic_failure() argument
3177 wpa_msg(wpa_s, MSG_WARNING, "Michael MIC failure detected"); in wpa_supplicant_event_michael_mic_failure()
3180 if ((wpa_s->last_michael_mic_error.sec && in wpa_supplicant_event_michael_mic_failure()
3181 !os_reltime_expired(&t, &wpa_s->last_michael_mic_error, 60)) || in wpa_supplicant_event_michael_mic_failure()
3182 wpa_s->pending_mic_error_report) { in wpa_supplicant_event_michael_mic_failure()
3183 if (wpa_s->pending_mic_error_report) { in wpa_supplicant_event_michael_mic_failure()
3189 wpa_sm_key_request(wpa_s->wpa, 1, in wpa_supplicant_event_michael_mic_failure()
3190 wpa_s->pending_mic_error_pairwise); in wpa_supplicant_event_michael_mic_failure()
3196 wpa_sm_key_request(wpa_s->wpa, 1, pairwise); in wpa_supplicant_event_michael_mic_failure()
3199 wpa_s->countermeasures = 1; in wpa_supplicant_event_michael_mic_failure()
3201 wpa_blacklist_add(wpa_s, wpa_s->bssid); in wpa_supplicant_event_michael_mic_failure()
3203 wpa_msg(wpa_s, MSG_WARNING, "TKIP countermeasures started"); in wpa_supplicant_event_michael_mic_failure()
3211 wpa_drv_set_countermeasures(wpa_s, 1); in wpa_supplicant_event_michael_mic_failure()
3212 wpa_supplicant_deauthenticate(wpa_s, in wpa_supplicant_event_michael_mic_failure()
3215 wpa_s, NULL); in wpa_supplicant_event_michael_mic_failure()
3218 wpa_s, NULL); in wpa_supplicant_event_michael_mic_failure()
3223 if (wpa_s->mic_errors_seen) { in wpa_supplicant_event_michael_mic_failure()
3241 wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Delay MIC error " in wpa_supplicant_event_michael_mic_failure()
3243 wpa_s->pending_mic_error_report = 1; in wpa_supplicant_event_michael_mic_failure()
3244 wpa_s->pending_mic_error_pairwise = pairwise; in wpa_supplicant_event_michael_mic_failure()
3247 wpa_s, NULL); in wpa_supplicant_event_michael_mic_failure()
3251 wpa_s, NULL); in wpa_supplicant_event_michael_mic_failure()
3253 wpa_sm_key_request(wpa_s->wpa, 1, pairwise); in wpa_supplicant_event_michael_mic_failure()
3256 wpa_sm_key_request(wpa_s->wpa, 1, pairwise); in wpa_supplicant_event_michael_mic_failure()
3259 wpa_s->last_michael_mic_error = t; in wpa_supplicant_event_michael_mic_failure()
3260 wpa_s->mic_errors_seen++; in wpa_supplicant_event_michael_mic_failure()
3267 struct wpa_supplicant *wpa_s; in any_interfaces() local
3269 for (wpa_s = head; wpa_s != NULL; wpa_s = wpa_s->next) in any_interfaces()
3270 if (!wpa_s->interface_removed) in any_interfaces()
3278 wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_interface_status() argument
3281 if (os_strcmp(wpa_s->ifname, data->interface_status.ifname) != 0) in wpa_supplicant_event_interface_status()
3286 if (!wpa_s->interface_removed) in wpa_supplicant_event_interface_status()
3288 wpa_s->interface_removed = 0; in wpa_supplicant_event_interface_status()
3289 wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was added"); in wpa_supplicant_event_interface_status()
3290 if (wpa_supplicant_driver_init(wpa_s) < 0) { in wpa_supplicant_event_interface_status()
3291 wpa_msg(wpa_s, MSG_INFO, "Failed to initialize the " in wpa_supplicant_event_interface_status()
3296 if (!wpa_s->global->p2p && in wpa_supplicant_event_interface_status()
3297 !wpa_s->global->p2p_disabled && in wpa_supplicant_event_interface_status()
3298 !wpa_s->conf->p2p_disabled && in wpa_supplicant_event_interface_status()
3299 (wpa_s->drv_flags & in wpa_supplicant_event_interface_status()
3302 wpa_s, wpa_s->global->params.conf_p2p_dev) < 0) { in wpa_supplicant_event_interface_status()
3311 wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was removed"); in wpa_supplicant_event_interface_status()
3312 wpa_s->interface_removed = 1; in wpa_supplicant_event_interface_status()
3313 wpa_supplicant_mark_disassoc(wpa_s); in wpa_supplicant_event_interface_status()
3314 wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED); in wpa_supplicant_event_interface_status()
3315 l2_packet_deinit(wpa_s->l2); in wpa_supplicant_event_interface_status()
3316 wpa_s->l2 = NULL; in wpa_supplicant_event_interface_status()
3319 if (wpa_s->global->p2p && in wpa_supplicant_event_interface_status()
3320 wpa_s->global->p2p_init_wpa_s->parent == wpa_s && in wpa_supplicant_event_interface_status()
3321 (wpa_s->drv_flags & in wpa_supplicant_event_interface_status()
3323 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event_interface_status()
3326 wpa_s->global, wpa_s->global->p2p_init_wpa_s, in wpa_supplicant_event_interface_status()
3328 wpa_s->global->p2p_init_wpa_s = NULL; in wpa_supplicant_event_interface_status()
3333 if (wpa_s->matched) { in wpa_supplicant_event_interface_status()
3334 wpa_supplicant_remove_iface(wpa_s->global, wpa_s, 0); in wpa_supplicant_event_interface_status()
3341 if (!any_interfaces(wpa_s->global->ifaces)) in wpa_supplicant_event_interface_status()
3350 static void wpa_supplicant_event_tdls(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_tdls() argument
3357 wpa_tdls_remove(wpa_s->wpa, data->tdls.peer); in wpa_supplicant_event_tdls()
3358 if (wpa_tdls_is_external_setup(wpa_s->wpa)) in wpa_supplicant_event_tdls()
3359 wpa_tdls_start(wpa_s->wpa, data->tdls.peer); in wpa_supplicant_event_tdls()
3361 wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, data->tdls.peer); in wpa_supplicant_event_tdls()
3364 if (wpa_tdls_is_external_setup(wpa_s->wpa)) in wpa_supplicant_event_tdls()
3365 wpa_tdls_teardown_link(wpa_s->wpa, data->tdls.peer, in wpa_supplicant_event_tdls()
3368 wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN, in wpa_supplicant_event_tdls()
3372 wpa_tdls_send_discovery_request(wpa_s->wpa, in wpa_supplicant_event_tdls()
3381 static void wpa_supplicant_event_wnm(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_wnm() argument
3391 ieee802_11_send_wnmsleep_req(wpa_s, data->wnm.sleep_action, in wpa_supplicant_event_wnm()
3401 wpa_supplicant_event_ft_response(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_ft_response() argument
3407 if (wpa_ft_process_response(wpa_s->wpa, data->ft_ies.ies, in wpa_supplicant_event_ft_response()
3420 static void wpa_supplicant_event_ibss_rsn_start(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_ibss_rsn_start() argument
3424 if (wpa_s->wpa_state < WPA_ASSOCIATED) in wpa_supplicant_event_ibss_rsn_start()
3428 ssid = wpa_s->current_ssid; in wpa_supplicant_event_ibss_rsn_start()
3434 ibss_rsn_start(wpa_s->ibss_rsn, data->ibss_rsn_start.peer); in wpa_supplicant_event_ibss_rsn_start()
3438 static void wpa_supplicant_event_ibss_auth(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_ibss_auth() argument
3441 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpa_supplicant_event_ibss_auth()
3450 ibss_rsn_handle_auth(wpa_s->ibss_rsn, data->rx_mgmt.frame, in wpa_supplicant_event_ibss_auth()
3457 static void ft_rx_action(struct wpa_supplicant *wpa_s, const u8 *data, in ft_rx_action() argument
3464 if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) in ft_rx_action()
3473 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Received FT Action Response: STA " in ft_rx_action()
3477 if (os_memcmp(sta_addr, wpa_s->own_addr, ETH_ALEN) != 0) { in ft_rx_action()
3478 wpa_dbg(wpa_s, MSG_DEBUG, "FT: Foreign STA Address " MACSTR in ft_rx_action()
3484 wpa_dbg(wpa_s, MSG_DEBUG, "FT: FT Action Response indicates " in ft_rx_action()
3490 if (wpa_ft_process_response(wpa_s->wpa, data + 1 + 2 * ETH_ALEN + 2, in ft_rx_action()
3498 bss = wpa_bss_get_bssid(wpa_s, target_ap_addr); in ft_rx_action()
3500 wpa_s->sme.freq = bss->freq; in ft_rx_action()
3501 wpa_s->sme.auth_alg = WPA_AUTH_ALG_FT; in ft_rx_action()
3502 sme_associate(wpa_s, WPAS_MODE_INFRA, target_ap_addr, in ft_rx_action()
3510 static void wpa_supplicant_event_unprot_deauth(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_unprot_deauth() argument
3518 sme_event_unprot_disconnect(wpa_s, e->sa, e->da, e->reason_code); in wpa_supplicant_event_unprot_deauth()
3523 static void wpa_supplicant_event_unprot_disassoc(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_unprot_disassoc() argument
3531 sme_event_unprot_disconnect(wpa_s, e->sa, e->da, e->reason_code); in wpa_supplicant_event_unprot_disassoc()
3536 static void wpas_event_disconnect(struct wpa_supplicant *wpa_s, const u8 *addr, in wpas_event_disconnect() argument
3541 if (wpa_s->ap_iface && addr) { in wpas_event_disconnect()
3542 hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], addr); in wpas_event_disconnect()
3546 if (wpa_s->ap_iface) { in wpas_event_disconnect()
3547 wpa_dbg(wpa_s, MSG_DEBUG, "Ignore deauth event in AP mode"); in wpas_event_disconnect()
3553 wpa_s->own_disconnect_req = 0; in wpas_event_disconnect()
3555 wpa_supplicant_event_disassoc(wpa_s, reason_code, locally_generated); in wpas_event_disconnect()
3558 ((wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt) || in wpas_event_disconnect()
3559 (wpa_s->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)) && in wpas_event_disconnect()
3560 eapol_sm_failed(wpa_s->eapol))) && in wpas_event_disconnect()
3561 !wpa_s->eap_expected_failure)) in wpas_event_disconnect()
3562 wpas_auth_failed(wpa_s, "AUTH_FAILED"); in wpas_event_disconnect()
3566 if (wpas_p2p_deauth_notif(wpa_s, addr, reason_code, ie, ie_len, in wpas_event_disconnect()
3577 wpa_supplicant_event_disassoc_finish(wpa_s, reason_code, in wpas_event_disconnect()
3582 static void wpas_event_disassoc(struct wpa_supplicant *wpa_s, in wpas_event_disassoc() argument
3591 wpa_dbg(wpa_s, MSG_DEBUG, "Disassociation notification"); in wpas_event_disassoc()
3599 wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u%s", reason_code, in wpas_event_disassoc()
3602 wpa_dbg(wpa_s, MSG_DEBUG, " * address " MACSTR, in wpas_event_disassoc()
3609 if (wpa_s->ap_iface && info && info->addr) { in wpas_event_disassoc()
3610 hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], info->addr); in wpas_event_disassoc()
3614 if (wpa_s->ap_iface) { in wpas_event_disassoc()
3615 wpa_dbg(wpa_s, MSG_DEBUG, "Ignore disassoc event in AP mode"); in wpas_event_disassoc()
3623 wpa_s, info->addr, reason_code, info->ie, info->ie_len, in wpas_event_disassoc()
3628 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpas_event_disassoc()
3629 sme_event_disassoc(wpa_s, info); in wpas_event_disassoc()
3631 wpas_event_disconnect(wpa_s, addr, reason_code, locally_generated, in wpas_event_disassoc()
3636 static void wpas_event_deauth(struct wpa_supplicant *wpa_s, in wpas_event_deauth() argument
3645 wpa_dbg(wpa_s, MSG_DEBUG, "Deauthentication notification"); in wpas_event_deauth()
3653 wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u%s", in wpas_event_deauth()
3657 wpa_dbg(wpa_s, MSG_DEBUG, " * address " MACSTR, in wpas_event_deauth()
3664 wpa_reset_ft_completed(wpa_s->wpa); in wpas_event_deauth()
3666 wpas_event_disconnect(wpa_s, addr, reason_code, in wpas_event_deauth()
3707 void wpa_supplicant_update_channel_list(struct wpa_supplicant *wpa_s, in wpa_supplicant_update_channel_list() argument
3719 for (ifs = wpa_s; ifs->parent && ifs != ifs->parent; ifs = ifs->parent) in wpa_supplicant_update_channel_list()
3730 if (wpa_s->drv_priv == NULL) in wpa_supplicant_update_channel_list()
3733 dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant, in wpa_supplicant_update_channel_list()
3752 wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_DRIVER); in wpa_supplicant_update_channel_list()
3756 static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s, in wpas_event_rx_mgmt_action() argument
3773 wpa_dbg(wpa_s, MSG_DEBUG, "Received Action frame: SA=" MACSTR in wpas_event_rx_mgmt_action()
3778 wmm_ac_rx_action(wpa_s, mgmt->da, mgmt->sa, payload, plen); in wpas_event_rx_mgmt_action()
3784 ft_rx_action(wpa_s, payload, plen); in wpas_event_rx_mgmt_action()
3792 sme_sa_query_rx(wpa_s, mgmt->sa, payload, plen); in wpas_event_rx_mgmt_action()
3800 ieee802_11_rx_wnm_action(wpa_s, mgmt, len); in wpas_event_rx_mgmt_action()
3808 gas_query_rx(wpa_s->gas, mgmt->da, mgmt->sa, mgmt->bssid, in wpas_event_rx_mgmt_action()
3817 gas_server_rx(wpa_s->gas_server, mgmt->da, mgmt->sa, mgmt->bssid, in wpas_event_rx_mgmt_action()
3826 wpa_dbg(wpa_s, MSG_DEBUG, in wpas_event_rx_mgmt_action()
3838 wpa_dbg(wpa_s, MSG_DEBUG, "Interworking: Received QoS Map Configure frame from " in wpas_event_rx_mgmt_action()
3840 if (os_memcmp(mgmt->sa, wpa_s->bssid, ETH_ALEN) == 0 && in wpas_event_rx_mgmt_action()
3843 wpas_qos_map_set(wpa_s, pos + 2, pos[1]); in wpas_event_rx_mgmt_action()
3850 wpas_rrm_handle_radio_measurement_request(wpa_s, mgmt->sa, in wpas_event_rx_mgmt_action()
3859 wpas_rrm_process_neighbor_rep(wpa_s, payload + 1, plen - 1); in wpas_event_rx_mgmt_action()
3865 wpas_rrm_handle_link_measurement_request(wpa_s, mgmt->sa, in wpas_event_rx_mgmt_action()
3872 if (mgmt->u.action.category == WLAN_ACTION_FST && wpa_s->fst) { in wpas_event_rx_mgmt_action()
3873 fst_rx_action(wpa_s->fst, mgmt, len); in wpas_event_rx_mgmt_action()
3885 wpas_dpp_rx_action(wpa_s, mgmt->sa, payload, plen, freq); in wpas_event_rx_mgmt_action()
3890 wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid, in wpas_event_rx_mgmt_action()
3892 if (wpa_s->ifmsh) in wpas_event_rx_mgmt_action()
3893 mesh_mpm_action_rx(wpa_s, mgmt, len); in wpas_event_rx_mgmt_action()
3897 static void wpa_supplicant_notify_avoid_freq(struct wpa_supplicant *wpa_s, in wpa_supplicant_notify_avoid_freq() argument
3907 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_AVOID_FREQ "ranges=%s", in wpa_supplicant_notify_avoid_freq()
3911 if (freq_range_list_parse(&wpa_s->global->p2p_go_avoid_freq, str)) { in wpa_supplicant_notify_avoid_freq()
3912 wpa_dbg(wpa_s, MSG_ERROR, "%s: Failed to parse freq range", in wpa_supplicant_notify_avoid_freq()
3915 wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Update channel list based on frequency avoid event"); in wpa_supplicant_notify_avoid_freq()
3921 wpas_p2p_update_channel_list(wpa_s, in wpa_supplicant_notify_avoid_freq()
3930 static void wpa_supplicant_event_port_authorized(struct wpa_supplicant *wpa_s) in wpa_supplicant_event_port_authorized() argument
3932 if (wpa_s->wpa_state == WPA_ASSOCIATED) { in wpa_supplicant_event_port_authorized()
3933 wpa_supplicant_cancel_auth_timeout(wpa_s); in wpa_supplicant_event_port_authorized()
3934 wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); in wpa_supplicant_event_port_authorized()
3935 eapol_sm_notify_portValid(wpa_s->eapol, TRUE); in wpa_supplicant_event_port_authorized()
3936 eapol_sm_notify_eap_success(wpa_s->eapol, TRUE); in wpa_supplicant_event_port_authorized()
3941 static unsigned int wpas_event_cac_ms(const struct wpa_supplicant *wpa_s, in wpas_event_cac_ms() argument
3947 for (i = 0; i < wpa_s->hw.num_modes; i++) { in wpas_event_cac_ms()
3948 const struct hostapd_hw_modes *mode = &wpa_s->hw.modes[i]; in wpas_event_cac_ms()
3963 static void wpas_event_dfs_cac_started(struct wpa_supplicant *wpa_s, in wpas_event_dfs_cac_started() argument
3967 if (wpa_s->ap_iface || wpa_s->ifmsh) { in wpas_event_dfs_cac_started()
3968 wpas_ap_event_dfs_cac_started(wpa_s, radar); in wpas_event_dfs_cac_started()
3972 unsigned int cac_time = wpas_event_cac_ms(wpa_s, radar->freq); in wpas_event_dfs_cac_started()
3979 wpas_auth_timeout_restart(wpa_s, cac_time); in wpas_event_dfs_cac_started()
3984 static void wpas_event_dfs_cac_finished(struct wpa_supplicant *wpa_s, in wpas_event_dfs_cac_finished() argument
3988 if (wpa_s->ap_iface || wpa_s->ifmsh) { in wpas_event_dfs_cac_finished()
3989 wpas_ap_event_dfs_cac_finished(wpa_s, radar); in wpas_event_dfs_cac_finished()
3995 wpas_auth_timeout_restart(wpa_s, 0); in wpas_event_dfs_cac_finished()
4000 static void wpas_event_dfs_cac_aborted(struct wpa_supplicant *wpa_s, in wpas_event_dfs_cac_aborted() argument
4004 if (wpa_s->ap_iface || wpa_s->ifmsh) { in wpas_event_dfs_cac_aborted()
4005 wpas_ap_event_dfs_cac_aborted(wpa_s, radar); in wpas_event_dfs_cac_aborted()
4011 wpas_auth_timeout_restart(wpa_s, 0); in wpas_event_dfs_cac_aborted()
4016 static void wpa_supplicant_event_assoc_auth(struct wpa_supplicant *wpa_s, in wpa_supplicant_event_assoc_auth() argument
4019 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event_assoc_auth()
4021 wpa_s->wpa_state); in wpa_supplicant_event_assoc_auth()
4023 wpa_supplicant_event_port_authorized(wpa_s); in wpa_supplicant_event_assoc_auth()
4025 wpa_sm_set_rx_replay_ctr(wpa_s->wpa, data->assoc_info.key_replay_ctr); in wpa_supplicant_event_assoc_auth()
4026 wpa_sm_set_ptk_kck_kek(wpa_s->wpa, data->assoc_info.ptk_kck, in wpa_supplicant_event_assoc_auth()
4031 if (wpa_s->auth_alg == WPA_AUTH_ALG_FILS) { in wpa_supplicant_event_assoc_auth()
4032 struct wpa_bss *bss = wpa_bss_get_bssid(wpa_s, wpa_s->bssid); in wpa_supplicant_event_assoc_auth()
4037 wpa_s->eapol, data->assoc_info.fils_erp_next_seq_num); in wpa_supplicant_event_assoc_auth()
4041 wpa_sm_pmksa_cache_add(wpa_s->wpa, in wpa_supplicant_event_assoc_auth()
4045 wpa_s->bssid, fils_cache_id); in wpa_supplicant_event_assoc_auth()
4048 pmksa_cache_set_current(wpa_s->wpa, in wpa_supplicant_event_assoc_auth()
4057 static void wpas_event_assoc_reject(struct wpa_supplicant *wpa_s, in wpas_event_assoc_reject() argument
4063 bssid = wpa_s->pending_bssid; in wpas_event_assoc_reject()
4066 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_ASSOC_REJECT in wpas_event_assoc_reject()
4075 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_ASSOC_REJECT in wpas_event_assoc_reject()
4082 wpa_s->assoc_status_code = data->assoc_reject.status_code; in wpas_event_assoc_reject()
4083 wpa_s->assoc_timed_out = data->assoc_reject.timed_out; in wpas_event_assoc_reject()
4084 wpas_notify_assoc_status_code(wpa_s); in wpas_event_assoc_reject()
4089 wpa_s->key_mgmt == WPA_KEY_MGMT_OWE && in wpas_event_assoc_reject()
4090 wpa_s->current_ssid && in wpas_event_assoc_reject()
4091 wpa_s->current_ssid->owe_group == 0 && in wpas_event_assoc_reject()
4092 wpa_s->last_owe_group != 21) { in wpas_event_assoc_reject()
4093 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpas_event_assoc_reject()
4094 struct wpa_bss *bss = wpa_s->current_bss; in wpas_event_assoc_reject()
4097 bss = wpa_supplicant_get_new_bss(wpa_s, bssid); in wpas_event_assoc_reject()
4099 wpas_connection_failed(wpa_s, bssid); in wpas_event_assoc_reject()
4100 wpa_supplicant_mark_disassoc(wpa_s); in wpas_event_assoc_reject()
4105 wpas_connect_work_done(wpa_s); in wpas_event_assoc_reject()
4106 wpa_supplicant_mark_disassoc(wpa_s); in wpas_event_assoc_reject()
4107 wpa_supplicant_connect(wpa_s, bss, ssid); in wpas_event_assoc_reject()
4115 wpa_s->current_bss && data->assoc_reject.bssid && in wpas_event_assoc_reject()
4129 wpa_bss_tmp_disallow(wpa_s, in wpas_event_assoc_reject()
4133 wpa_s->current_bss->level); in wpas_event_assoc_reject()
4138 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) { in wpas_event_assoc_reject()
4139 sme_event_assoc_reject(wpa_s, data); in wpas_event_assoc_reject()
4146 if (wpa_s->current_ssid && in wpas_event_assoc_reject()
4147 wpa_key_mgmt_sae(wpa_s->current_ssid->key_mgmt) && in wpas_event_assoc_reject()
4149 wpa_dbg(wpa_s, MSG_DEBUG, "SAE: Drop PMKSA cache entry"); in wpas_event_assoc_reject()
4150 wpa_sm_aborted_cached(wpa_s->wpa); in wpas_event_assoc_reject()
4151 wpa_sm_pmksa_cache_flush(wpa_s->wpa, wpa_s->current_ssid); in wpas_event_assoc_reject()
4156 if (wpa_s->current_ssid && in wpas_event_assoc_reject()
4157 wpa_s->current_ssid->key_mgmt == WPA_KEY_MGMT_DPP && in wpas_event_assoc_reject()
4159 wpa_dbg(wpa_s, MSG_DEBUG, "DPP: Drop PMKSA cache entry"); in wpas_event_assoc_reject()
4160 wpa_sm_aborted_cached(wpa_s->wpa); in wpas_event_assoc_reject()
4161 wpa_sm_pmksa_cache_flush(wpa_s->wpa, wpa_s->current_ssid); in wpas_event_assoc_reject()
4167 if (wpa_s->auth_alg == WPA_AUTH_ALG_FILS) { in wpas_event_assoc_reject()
4169 wpa_s->eapol, in wpas_event_assoc_reject()
4171 fils_connection_failure(wpa_s); in wpas_event_assoc_reject()
4175 wpas_connection_failed(wpa_s, bssid); in wpas_event_assoc_reject()
4176 wpa_supplicant_mark_disassoc(wpa_s); in wpas_event_assoc_reject()
4183 struct wpa_supplicant *wpa_s = ctx; in wpa_supplicant_event() local
4189 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED && in wpa_supplicant_event()
4194 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event()
4211 wpa_dbg(wpa_s, level, "Event %s (%d) received", in wpa_supplicant_event()
4218 if (!wpas_fst_update_mbie(wpa_s, data->auth.ies, in wpa_supplicant_event()
4223 sme_event_auth(wpa_s, data); in wpa_supplicant_event()
4224 wpa_s->auth_status_code = data->auth.status_code; in wpa_supplicant_event()
4225 wpas_notify_auth_status_code(wpa_s); in wpa_supplicant_event()
4229 if (wpa_s->ignore_auth_resp) { in wpa_supplicant_event()
4234 if (wpa_s->testing_resend_assoc) { in wpa_supplicant_event()
4240 wpa_supplicant_event_assoc(wpa_s, data); in wpa_supplicant_event()
4241 wpa_s->assoc_status_code = WLAN_STATUS_SUCCESS; in wpa_supplicant_event()
4244 (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) && in wpa_supplicant_event()
4245 wpa_fils_is_completed(wpa_s->wpa)))) in wpa_supplicant_event()
4246 wpa_supplicant_event_assoc_auth(wpa_s, data); in wpa_supplicant_event()
4248 wpa_msg(wpa_s, MSG_INFO, in wpa_supplicant_event()
4254 wpas_event_disassoc(wpa_s, in wpa_supplicant_event()
4259 if (wpa_s->ignore_auth_resp) { in wpa_supplicant_event()
4264 if (wpa_s->testing_resend_assoc) { in wpa_supplicant_event()
4270 wpas_event_deauth(wpa_s, in wpa_supplicant_event()
4274 wpa_supplicant_event_michael_mic_failure(wpa_s, data); in wpa_supplicant_event()
4278 if (wpa_s->own_scan_requested || in wpa_supplicant_event()
4282 os_get_reltime(&wpa_s->scan_start_time); in wpa_supplicant_event()
4283 os_reltime_sub(&wpa_s->scan_start_time, in wpa_supplicant_event()
4284 &wpa_s->scan_trigger_time, &diff); in wpa_supplicant_event()
4285 wpa_dbg(wpa_s, MSG_DEBUG, "Own scan request started a scan in %ld.%06ld seconds", in wpa_supplicant_event()
4287 wpa_s->own_scan_requested = 0; in wpa_supplicant_event()
4288 wpa_s->own_scan_running = 1; in wpa_supplicant_event()
4289 if (wpa_s->last_scan_req == MANUAL_SCAN_REQ && in wpa_supplicant_event()
4290 wpa_s->manual_scan_use_id) { in wpa_supplicant_event()
4291 wpa_msg_ctrl(wpa_s, MSG_INFO, in wpa_supplicant_event()
4293 wpa_s->manual_scan_id); in wpa_supplicant_event()
4295 wpa_msg_ctrl(wpa_s, MSG_INFO, in wpa_supplicant_event()
4299 wpa_dbg(wpa_s, MSG_DEBUG, "External program started a scan"); in wpa_supplicant_event()
4300 wpa_s->radio->external_scan_running = 1; in wpa_supplicant_event()
4301 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_STARTED); in wpa_supplicant_event()
4305 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) { in wpa_supplicant_event()
4306 wpa_s->scan_res_handler = NULL; in wpa_supplicant_event()
4307 wpa_s->own_scan_running = 0; in wpa_supplicant_event()
4308 wpa_s->radio->external_scan_running = 0; in wpa_supplicant_event()
4309 wpa_s->last_scan_req = NORMAL_SCAN_REQ; in wpa_supplicant_event()
4314 os_reltime_initialized(&wpa_s->scan_start_time)) { in wpa_supplicant_event()
4317 os_reltime_sub(&now, &wpa_s->scan_start_time, &diff); in wpa_supplicant_event()
4318 wpa_s->scan_start_time.sec = 0; in wpa_supplicant_event()
4319 wpa_s->scan_start_time.usec = 0; in wpa_supplicant_event()
4320 wpa_dbg(wpa_s, MSG_DEBUG, "Scan completed in %ld.%06ld seconds", in wpa_supplicant_event()
4323 if (wpa_supplicant_event_scan_results(wpa_s, data)) in wpa_supplicant_event()
4326 wpa_s->own_scan_running = 0; in wpa_supplicant_event()
4328 wpa_s->radio->external_scan_running = 0; in wpa_supplicant_event()
4329 radio_work_check_next(wpa_s); in wpa_supplicant_event()
4333 wpa_supplicant_event_associnfo(wpa_s, data); in wpa_supplicant_event()
4336 wpa_supplicant_event_interface_status(wpa_s, data); in wpa_supplicant_event()
4339 wpa_supplicant_event_pmkid_candidate(wpa_s, data); in wpa_supplicant_event()
4343 wpa_supplicant_event_tdls(wpa_s, data); in wpa_supplicant_event()
4348 wpa_supplicant_event_wnm(wpa_s, data); in wpa_supplicant_event()
4353 wpa_supplicant_event_ft_response(wpa_s, data); in wpa_supplicant_event()
4358 wpa_supplicant_event_ibss_rsn_start(wpa_s, data); in wpa_supplicant_event()
4362 wpas_event_assoc_reject(wpa_s, data); in wpa_supplicant_event()
4366 if (wpa_s->current_ssid && in wpa_supplicant_event()
4367 wpa_s->current_ssid->mode == WPAS_MODE_MESH) { in wpa_supplicant_event()
4368 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event()
4372 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpa_supplicant_event()
4373 sme_event_auth_timed_out(wpa_s, data); in wpa_supplicant_event()
4377 if (wpa_s->current_ssid && in wpa_supplicant_event()
4378 wpa_s->current_ssid->mode == WPAS_MODE_MESH) { in wpa_supplicant_event()
4379 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event()
4383 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpa_supplicant_event()
4384 sme_event_assoc_timed_out(wpa_s, data); in wpa_supplicant_event()
4387 wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_TX_STATUS dst=" MACSTR in wpa_supplicant_event()
4392 if (wpa_s->ap_iface == NULL) { in wpa_supplicant_event()
4397 wpa_s, data->tx_status.dst, in wpa_supplicant_event()
4408 wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_TX_STATUS pending_dst=" in wpa_supplicant_event()
4409 MACSTR, MAC2STR(wpa_s->p2pdev->pending_action_dst)); in wpa_supplicant_event()
4419 os_memcmp(wpa_s->p2pdev->pending_action_dst, in wpa_supplicant_event()
4422 wpa_s->p2pdev, data->tx_status.dst, in wpa_supplicant_event()
4434 ap_mgmt_tx_cb(wpa_s, data->tx_status.data, in wpa_supplicant_event()
4440 ap_tx_status(wpa_s, data->tx_status.dst, in wpa_supplicant_event()
4450 ap_eapol_tx_status(wpa_s, data->eapol_tx_status.dst, in wpa_supplicant_event()
4456 ap_client_poll_ok(wpa_s, data->client_poll.addr); in wpa_supplicant_event()
4459 if (wpa_s->ap_iface == NULL) in wpa_supplicant_event()
4461 ap_rx_from_unknown_sta(wpa_s, data->rx_from_unknown.addr, in wpa_supplicant_event()
4466 if (!data || !wpa_s->current_ssid) in wpa_supplicant_event()
4469 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_CHANNEL_SWITCH in wpa_supplicant_event()
4478 wpa_s->assoc_freq = data->ch_switch.freq; in wpa_supplicant_event()
4479 wpa_s->current_ssid->frequency = data->ch_switch.freq; in wpa_supplicant_event()
4482 if (wpa_s->current_ssid->mode == WPAS_MODE_AP || in wpa_supplicant_event()
4483 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO || in wpa_supplicant_event()
4484 wpa_s->current_ssid->mode == WPAS_MODE_MESH || in wpa_supplicant_event()
4485 wpa_s->current_ssid->mode == in wpa_supplicant_event()
4487 wpas_ap_ch_switch(wpa_s, data->ch_switch.freq, in wpa_supplicant_event()
4497 sme_event_ch_switch(wpa_s); in wpa_supplicant_event()
4499 wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_CS); in wpa_supplicant_event()
4500 wnm_clear_coloc_intf_reporting(wpa_s); in wpa_supplicant_event()
4506 wpas_ap_event_dfs_radar_detected(wpa_s, in wpa_supplicant_event()
4511 wpas_ap_event_dfs_cac_nop_finished(wpa_s, in wpa_supplicant_event()
4518 wpas_event_dfs_cac_started(wpa_s, &data->dfs_event); in wpa_supplicant_event()
4522 wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event); in wpa_supplicant_event()
4526 wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event); in wpa_supplicant_event()
4533 if (wpa_s->ext_mgmt_frame_handling) { in wpa_supplicant_event()
4540 wpa_msg(wpa_s, MSG_INFO, "MGMT-RX freq=%d datarate=%u ssi_signal=%d %s", in wpa_supplicant_event()
4555 if (wpa_s->ap_iface == NULL) { in wpa_supplicant_event()
4568 wpa_s, src, mgmt->da, in wpa_supplicant_event()
4576 if (wpa_s->current_ssid && in wpa_supplicant_event()
4577 wpa_s->current_ssid->mode == WPAS_MODE_IBSS && in wpa_supplicant_event()
4580 wpa_supplicant_event_ibss_auth(wpa_s, data); in wpa_supplicant_event()
4587 wpa_s, data->rx_mgmt.frame, in wpa_supplicant_event()
4594 if (wpa_s->ifmsh) { in wpa_supplicant_event()
4595 mesh_mpm_mgmt_rx(wpa_s, &data->rx_mgmt); in wpa_supplicant_event()
4601 !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) && in wpa_supplicant_event()
4602 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SAE)) { in wpa_supplicant_event()
4604 wpa_s, data->rx_mgmt.frame, in wpa_supplicant_event()
4609 wpa_dbg(wpa_s, MSG_DEBUG, "AP: ignore received " in wpa_supplicant_event()
4623 wpas_notify_preq(wpa_s, mgmt->sa, mgmt->da, in wpa_supplicant_event()
4628 ap_mgmt_rx(wpa_s, &data->rx_mgmt); in wpa_supplicant_event()
4637 if (wpa_s->ap_iface) { in wpa_supplicant_event()
4638 hostapd_probe_req_rx(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
4648 wpas_p2p_probe_req_rx(wpa_s, data->rx_probe_req.sa, in wpa_supplicant_event()
4659 wpa_s, data->remain_on_channel.freq, in wpa_supplicant_event()
4663 wpa_s, data->remain_on_channel.freq, in wpa_supplicant_event()
4669 wpa_s, data->remain_on_channel.freq); in wpa_supplicant_event()
4672 wpa_s, data->remain_on_channel.freq); in wpa_supplicant_event()
4675 wpa_s, data->remain_on_channel.freq); in wpa_supplicant_event()
4679 wpa_supplicant_rx_eapol(wpa_s, data->eapol_rx.src, in wpa_supplicant_event()
4684 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SIGNAL_CHANGE in wpa_supplicant_event()
4690 wpa_bss_update_level(wpa_s->current_bss, in wpa_supplicant_event()
4693 wpa_s, data->signal_change.above_threshold, in wpa_supplicant_event()
4699 wpa_supplicant_update_mac_addr(wpa_s); in wpa_supplicant_event()
4702 wpa_dbg(wpa_s, MSG_DEBUG, "Interface was enabled"); in wpa_supplicant_event()
4703 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) { in wpa_supplicant_event()
4704 wpa_supplicant_update_mac_addr(wpa_s); in wpa_supplicant_event()
4705 if (wpa_s->p2p_mgmt) { in wpa_supplicant_event()
4706 wpa_supplicant_set_state(wpa_s, in wpa_supplicant_event()
4712 if (!wpa_s->ap_iface) { in wpa_supplicant_event()
4713 wpa_supplicant_set_state(wpa_s, in wpa_supplicant_event()
4715 wpa_s->scan_req = NORMAL_SCAN_REQ; in wpa_supplicant_event()
4716 wpa_supplicant_req_scan(wpa_s, 0, 0); in wpa_supplicant_event()
4718 wpa_supplicant_set_state(wpa_s, in wpa_supplicant_event()
4721 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); in wpa_supplicant_event()
4722 wpa_supplicant_req_scan(wpa_s, 0, 0); in wpa_supplicant_event()
4727 wpa_dbg(wpa_s, MSG_DEBUG, "Interface was disabled"); in wpa_supplicant_event()
4729 if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_GO || in wpa_supplicant_event()
4730 (wpa_s->current_ssid && wpa_s->current_ssid->p2p_group && in wpa_supplicant_event()
4731 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO)) { in wpa_supplicant_event()
4736 wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED); in wpa_supplicant_event()
4742 if (wpa_s->current_ssid && in wpa_supplicant_event()
4743 wpa_s->current_ssid->p2p_group) in wpa_supplicant_event()
4744 wpas_p2p_interface_unavailable(wpa_s); in wpa_supplicant_event()
4746 wpas_p2p_disconnect(wpa_s); in wpa_supplicant_event()
4753 if (wpa_s->p2p_scan_work && wpa_s->global->p2p && in wpa_supplicant_event()
4754 p2p_in_progress(wpa_s->global->p2p) > 1) { in wpa_supplicant_event()
4758 p2p_stop_find(wpa_s->global->p2p); in wpa_supplicant_event()
4762 if (wpa_s->wpa_state >= WPA_AUTHENTICATING) { in wpa_supplicant_event()
4768 wpa_s, WLAN_REASON_DEAUTH_LEAVING, 1); in wpa_supplicant_event()
4770 wpa_supplicant_mark_disassoc(wpa_s); in wpa_supplicant_event()
4771 if (!wpa_s->conf->bss_no_flush_when_down) in wpa_supplicant_event()
4772 wpa_bss_flush(wpa_s); in wpa_supplicant_event()
4773 radio_remove_works(wpa_s, NULL, 0); in wpa_supplicant_event()
4775 wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED); in wpa_supplicant_event()
4779 wpa_s, &data->channel_list_changed); in wpa_supplicant_event()
4782 wpas_p2p_interface_unavailable(wpa_s); in wpa_supplicant_event()
4785 wpa_dbg(wpa_s, MSG_DEBUG, "Best channel event received " in wpa_supplicant_event()
4789 wpa_s->best_24_freq = data->best_chan.freq_24; in wpa_supplicant_event()
4790 wpa_s->best_5_freq = data->best_chan.freq_5; in wpa_supplicant_event()
4791 wpa_s->best_overall_freq = data->best_chan.freq_overall; in wpa_supplicant_event()
4792 wpas_p2p_update_best_channels(wpa_s, data->best_chan.freq_24, in wpa_supplicant_event()
4797 wpa_supplicant_event_unprot_deauth(wpa_s, in wpa_supplicant_event()
4801 wpa_supplicant_event_unprot_disassoc(wpa_s, in wpa_supplicant_event()
4806 if (wpa_s->ap_iface && data) in wpa_supplicant_event()
4807 hostapd_event_sta_low_ack(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
4812 wpa_tdls_disable_unreachable_link(wpa_s->wpa, in wpa_supplicant_event()
4818 ibss_rsn_stop(wpa_s->ibss_rsn, data->ibss_peer_lost.peer); in wpa_supplicant_event()
4823 wpa_s->bssid, ETH_ALEN)) in wpa_supplicant_event()
4825 if (!wpa_s->wpa) in wpa_supplicant_event()
4827 wpa_sm_update_replay_ctr(wpa_s->wpa, in wpa_supplicant_event()
4831 wpa_s->sched_scanning = 0; in wpa_supplicant_event()
4832 resched = wpa_s->scanning && wpas_scan_scheduled(wpa_s); in wpa_supplicant_event()
4833 wpa_supplicant_notify_scanning(wpa_s, 0); in wpa_supplicant_event()
4835 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) in wpa_supplicant_event()
4842 if (!wpa_s->sched_scan_stop_req && in wpa_supplicant_event()
4843 wpa_s->wpa_state == WPA_SCANNING) { in wpa_supplicant_event()
4844 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event()
4846 wpa_supplicant_req_scan(wpa_s, 1, 0); in wpa_supplicant_event()
4850 wpa_s->sched_scan_stop_req = 0; in wpa_supplicant_event()
4856 if (wpa_s->sched_scan_timed_out) { in wpa_supplicant_event()
4857 wpa_supplicant_req_sched_scan(wpa_s); in wpa_supplicant_event()
4858 } else if (wpa_s->pno_sched_pending) { in wpa_supplicant_event()
4859 wpa_s->pno_sched_pending = 0; in wpa_supplicant_event()
4860 wpas_start_pno(wpa_s); in wpa_supplicant_event()
4862 wpa_supplicant_req_scan(wpa_s, 0, 0); in wpa_supplicant_event()
4868 wpas_wps_start_pbc(wpa_s, NULL, 0, 0); in wpa_supplicant_event()
4872 wpa_supplicant_notify_avoid_freq(wpa_s, data); in wpa_supplicant_event()
4876 if (!wpa_s->ap_iface || !data) in wpa_supplicant_event()
4879 wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
4886 if (!wpa_s->ifmsh || !data) in wpa_supplicant_event()
4888 wpa_mesh_notify_peer(wpa_s, data->mesh_peer.peer, in wpa_supplicant_event()
4895 if (!wpa_s->ap_iface) in wpa_supplicant_event()
4897 hostapd_event_get_survey(wpa_s->ap_iface, in wpa_supplicant_event()
4904 if (!wpa_s->ap_iface) in wpa_supplicant_event()
4906 hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
4913 wpa_s->p2p_lo_started = 0; in wpa_supplicant_event()
4914 wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_LISTEN_OFFLOAD_STOP in wpa_supplicant_event()
4920 if (!wpa_s->current_bss || !wpa_s->current_ssid) in wpa_supplicant_event()
4922 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_BEACON_LOSS); in wpa_supplicant_event()
4923 bgscan_notify_beacon_loss(wpa_s); in wpa_supplicant_event()
4927 if (!wpa_s->current_ssid) { in wpa_supplicant_event()
4931 sme_external_auth_trigger(wpa_s, data); in wpa_supplicant_event()
4935 wpa_supplicant_event_port_authorized(wpa_s); in wpa_supplicant_event()
4939 if (!wpa_s->ap_iface || !data) in wpa_supplicant_event()
4942 hostapd_event_sta_opmode_changed(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
4950 wpa_msg(wpa_s, MSG_INFO, "Unknown event %d", event); in wpa_supplicant_event()
4959 struct wpa_supplicant *wpa_s; in wpa_supplicant_event_global() local
4964 wpa_s = wpa_supplicant_get_iface(ctx, data->interface_status.ifname); in wpa_supplicant_event_global()
4965 if (wpa_s && wpa_s->driver->get_ifindex) { in wpa_supplicant_event_global()
4968 ifindex = wpa_s->driver->get_ifindex(wpa_s->drv_priv); in wpa_supplicant_event_global()
4970 wpa_dbg(wpa_s, MSG_DEBUG, in wpa_supplicant_event_global()
4984 wpa_s = wpa_supplicant_add_iface(ctx, wpa_i, NULL); in wpa_supplicant_event_global()
4986 if (wpa_s) in wpa_supplicant_event_global()
4987 wpa_s->matched = 1; in wpa_supplicant_event_global()
4991 if (wpa_s) in wpa_supplicant_event_global()
4992 wpa_supplicant_event(wpa_s, event, data); in wpa_supplicant_event_global()