Lines Matching +full:tsn +full:- +full:capable

2  * WPA Supplicant - Driver event processing
3 * Copyright (c) 2003-2019, Jouni Malinen <j@w1.fi>
72 if (ssid == NULL || ssid->disabled_until.sec == 0) in wpas_temp_disabled()
76 if (ssid->disabled_until.sec > now.sec) in wpas_temp_disabled()
77 return ssid->disabled_until.sec - now.sec; in wpas_temp_disabled()
87 * wpas_reenabled_network_time - Time until first network is re-enabled
90 * (in sec) until the first network is re-enabled. Otherwise returns 0.
94 * re-enabled. The function assumes that at least one network is enabled.
102 if (wpa_s->conf->auto_interworking && wpa_s->conf->interworking && in wpas_reenabled_network_time()
103 wpa_s->conf->cred) in wpas_reenabled_network_time()
107 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { in wpas_reenabled_network_time()
108 if (ssid->disabled) in wpas_reenabled_network_time()
128 if (wpa_s->disconnected || wpa_s->wpa_state != WPA_SCANNING) in wpas_network_reenabled()
132 "Try to associate due to network getting re-enabled"); in wpas_network_reenabled()
171 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpa_supplicant_get_new_bss()
182 if (!bss && ssid && ssid->ssid_len > 0) { in wpa_supplicant_get_new_bss()
183 bss = _wpa_supplicant_get_new_bss(wpa_s, bssid, ssid->ssid, in wpa_supplicant_get_new_bss()
184 ssid->ssid_len, in wpa_supplicant_get_new_bss()
202 wpa_s->current_bss = bss; in wpa_supplicant_update_current_bss()
214 wpa_s->links[link_id].bss = bss; in wpa_supplicant_update_link_bss()
227 if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) { in wpa_supplicant_select_config()
228 wpa_supplicant_update_current_bss(wpa_s, wpa_s->bssid); in wpa_supplicant_select_config()
230 if (wpa_s->current_ssid->ssid_len == 0) in wpa_supplicant_select_config()
240 if (drv_ssid_len == wpa_s->current_ssid->ssid_len && in wpa_supplicant_select_config()
241 os_memcmp(drv_ssid, wpa_s->current_ssid->ssid, in wpa_supplicant_select_config()
246 if ((wpa_s->current_ssid->key_mgmt & WPA_KEY_MGMT_OWE) && in wpa_supplicant_select_config()
247 wpa_s->current_bss && in wpa_supplicant_select_config()
248 (wpa_s->current_bss->flags & WPA_BSS_OWE_TRANSITION) && in wpa_supplicant_select_config()
249 drv_ssid_len == wpa_s->current_bss->ssid_len && in wpa_supplicant_select_config()
250 os_memcmp(drv_ssid, wpa_s->current_bss->ssid, in wpa_supplicant_select_config()
256 "Driver-initiated BSS selection changed the SSID to %s", in wpa_supplicant_select_config()
267 return -1; in wpa_supplicant_select_config()
272 return -1; in wpa_supplicant_select_config()
275 if (disallowed_bssid(wpa_s, wpa_s->bssid) || in wpa_supplicant_select_config()
276 disallowed_ssid(wpa_s, ssid->ssid, ssid->ssid_len)) { in wpa_supplicant_select_config()
278 return -1; in wpa_supplicant_select_config()
285 return -1; in wpa_supplicant_select_config()
290 bss = wpa_supplicant_update_current_bss(wpa_s, wpa_s->bssid); in wpa_supplicant_select_config()
291 if (wpa_key_mgmt_wpa_any(ssid->key_mgmt)) { in wpa_supplicant_select_config()
299 skip_default_rsne = data && data->assoc_info.req_ies; in wpa_supplicant_select_config()
308 if (wpa_s->current_ssid && wpa_s->current_ssid != ssid) in wpa_supplicant_select_config()
309 eapol_sm_invalidate_cached_session(wpa_s->eapol); in wpa_supplicant_select_config()
310 old_ssid = wpa_s->current_ssid; in wpa_supplicant_select_config()
311 wpa_s->current_ssid = ssid; in wpa_supplicant_select_config()
313 wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid); in wpa_supplicant_select_config()
315 if (old_ssid != wpa_s->current_ssid) in wpa_supplicant_select_config()
326 if (wpa_s->countermeasures) { in wpa_supplicant_stop_countermeasures()
327 wpa_s->countermeasures = 0; in wpa_supplicant_stop_countermeasures()
346 if (!wpa_s->valid_links) in wpas_reset_mlo_info()
349 wpa_s->valid_links = 0; in wpas_reset_mlo_info()
350 wpa_s->mlo_assoc_link_id = 0; in wpas_reset_mlo_info()
351 os_memset(wpa_s->ap_mld_addr, 0, ETH_ALEN); in wpas_reset_mlo_info()
352 os_memset(wpa_s->links, 0, sizeof(wpa_s->links)); in wpas_reset_mlo_info()
363 ibss_rsn_deinit(wpa_s->ibss_rsn); in wpa_supplicant_mark_disassoc()
364 wpa_s->ibss_rsn = NULL; in wpa_supplicant_mark_disassoc()
376 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) in wpa_supplicant_mark_disassoc()
379 if (os_reltime_initialized(&wpa_s->session_start)) { in wpa_supplicant_mark_disassoc()
380 os_reltime_age(&wpa_s->session_start, &wpa_s->session_length); in wpa_supplicant_mark_disassoc()
381 wpa_s->session_start.sec = 0; in wpa_supplicant_mark_disassoc()
382 wpa_s->session_start.usec = 0; in wpa_supplicant_mark_disassoc()
387 bssid_changed = !is_zero_ether_addr(wpa_s->bssid); in wpa_supplicant_mark_disassoc()
388 os_memset(wpa_s->bssid, 0, ETH_ALEN); in wpa_supplicant_mark_disassoc()
389 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); in wpa_supplicant_mark_disassoc()
391 wpa_s->current_bss = NULL; in wpa_supplicant_mark_disassoc()
392 wpa_s->assoc_freq = 0; in wpa_supplicant_mark_disassoc()
397 eapol_sm_notify_portEnabled(wpa_s->eapol, false); in wpa_supplicant_mark_disassoc()
398 eapol_sm_notify_portValid(wpa_s->eapol, false); in wpa_supplicant_mark_disassoc()
399 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || in wpa_supplicant_mark_disassoc()
400 wpa_s->key_mgmt == WPA_KEY_MGMT_OWE || in wpa_supplicant_mark_disassoc()
401 wpa_s->key_mgmt == WPA_KEY_MGMT_DPP || wpa_s->drv_authorized_port) in wpa_supplicant_mark_disassoc()
402 eapol_sm_notify_eap_success(wpa_s->eapol, false); in wpa_supplicant_mark_disassoc()
403 wpa_s->drv_authorized_port = 0; in wpa_supplicant_mark_disassoc()
404 wpa_s->ap_ies_from_associnfo = 0; in wpa_supplicant_mark_disassoc()
405 wpa_s->current_ssid = NULL; in wpa_supplicant_mark_disassoc()
406 eapol_sm_notify_config(wpa_s->eapol, NULL, NULL); in wpa_supplicant_mark_disassoc()
407 wpa_s->key_mgmt = 0; in wpa_supplicant_mark_disassoc()
408 wpa_s->allowed_key_mgmts = 0; in wpa_supplicant_mark_disassoc()
413 wpa_s->wnmsleep_used = 0; in wpa_supplicant_mark_disassoc()
415 wpa_s->wnm_mode = 0; in wpa_supplicant_mark_disassoc()
418 wpa_s->disable_mbo_oce = 0; in wpa_supplicant_mark_disassoc()
421 wpa_s->last_tk_alg = WPA_ALG_NONE; in wpa_supplicant_mark_disassoc()
422 os_memset(wpa_s->last_tk, 0, sizeof(wpa_s->last_tk)); in wpa_supplicant_mark_disassoc()
424 wpa_s->ieee80211ac = 0; in wpa_supplicant_mark_disassoc()
426 if (wpa_s->enabled_4addr_mode && wpa_drv_set_4addr_mode(wpa_s, 0) == 0) in wpa_supplicant_mark_disassoc()
427 wpa_s->enabled_4addr_mode = 0; in wpa_supplicant_mark_disassoc()
429 wpa_s->wps_scan_done = false; in wpa_supplicant_mark_disassoc()
433 wpa_s->sme.bss_max_idle_period = 0; in wpa_supplicant_mark_disassoc()
436 wpa_s->ssid_verified = false; in wpa_supplicant_mark_disassoc()
437 wpa_s->bigtk_set = false; in wpa_supplicant_mark_disassoc()
444 int pmksa_set = -1; in wpa_find_assoc_pmkid()
450 * entries for Suite B cases with driver-based roaming indication. */ in wpa_find_assoc_pmkid()
451 cur_pmksa = pmksa_cache_get_current(wpa_s->wpa); in wpa_find_assoc_pmkid()
452 if (cur_pmksa && !wpa_key_mgmt_sae(cur_pmksa->akmp)) in wpa_find_assoc_pmkid()
453 pmksa_cache_clear_current(wpa_s->wpa); in wpa_find_assoc_pmkid()
455 if (wpa_sm_parse_own_wpa_ie(wpa_s->wpa, &ie) < 0 || in wpa_find_assoc_pmkid()
460 pmksa_set = pmksa_cache_set_current(wpa_s->wpa, in wpa_find_assoc_pmkid()
465 eapol_sm_notify_pmkid_attempt(wpa_s->eapol); in wpa_find_assoc_pmkid()
467 wpa_sm_set_pmk_from_pmksa(wpa_s->wpa); in wpa_find_assoc_pmkid()
485 wpa_dbg(wpa_s, MSG_DEBUG, "RSN: PMKID candidate event - bssid=" MACSTR in wpa_supplicant_event_pmkid_candidate()
487 MAC2STR(data->pmkid_candidate.bssid), in wpa_supplicant_event_pmkid_candidate()
488 data->pmkid_candidate.index, in wpa_supplicant_event_pmkid_candidate()
489 data->pmkid_candidate.preauth); in wpa_supplicant_event_pmkid_candidate()
491 pmksa_candidate_add(wpa_s->wpa, data->pmkid_candidate.bssid, in wpa_supplicant_event_pmkid_candidate()
492 data->pmkid_candidate.index, in wpa_supplicant_event_pmkid_candidate()
493 data->pmkid_candidate.preauth); in wpa_supplicant_event_pmkid_candidate()
499 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE || in wpa_supplicant_dynamic_keys()
500 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) in wpa_supplicant_dynamic_keys()
504 if (wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA && in wpa_supplicant_dynamic_keys()
505 wpa_s->current_ssid && in wpa_supplicant_dynamic_keys()
506 !(wpa_s->current_ssid->eapol_flags & in wpa_supplicant_dynamic_keys()
520 * wpa_supplicant_scard_init - Initialize SIM/USIM access with PC/SC
523 * Returns: 0 on success, -1 on failure
526 * configured to use PC/SC for SIM/USIM access (EAP-SIM or EAP-AKA).
535 if ((ssid != NULL && ssid->eap.pcsc == NULL) || in wpa_supplicant_scard_init()
536 wpa_s->scard != NULL || wpa_s->conf->external_sim) in wpa_supplicant_scard_init()
539 if (ssid == NULL || ssid->eap.eap_methods == NULL) { in wpa_supplicant_scard_init()
543 struct eap_method_type *eap = ssid->eap.eap_methods; in wpa_supplicant_scard_init()
544 while (eap->vendor != EAP_VENDOR_IETF || in wpa_supplicant_scard_init()
545 eap->method != EAP_TYPE_NONE) { in wpa_supplicant_scard_init()
546 if (eap->vendor == EAP_VENDOR_IETF) { in wpa_supplicant_scard_init()
547 if (eap->method == EAP_TYPE_SIM) in wpa_supplicant_scard_init()
549 else if (eap->method == EAP_TYPE_AKA || in wpa_supplicant_scard_init()
550 eap->method == EAP_TYPE_AKA_PRIME) in wpa_supplicant_scard_init()
566 "use SIM, but neither EAP-SIM nor EAP-AKA are " in wpa_supplicant_scard_init()
572 "(sim=%d aka=%d) - initialize PCSC", sim, aka); in wpa_supplicant_scard_init()
574 wpa_s->scard = scard_init(wpa_s->conf->pcsc_reader); in wpa_supplicant_scard_init()
575 if (wpa_s->scard == NULL) { in wpa_supplicant_scard_init()
577 "(pcsc-lite)"); in wpa_supplicant_scard_init()
578 return -1; in wpa_supplicant_scard_init()
580 wpa_sm_set_scard_ctx(wpa_s->wpa, wpa_s->scard); in wpa_supplicant_scard_init()
581 eapol_sm_register_scard_ctx(wpa_s->eapol, wpa_s->scard); in wpa_supplicant_scard_init()
597 if (ssid->wep_key_len[i]) in has_wep_key()
611 if (ssid->mixed_cell) in wpa_supplicant_match_privacy()
615 if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) in wpa_supplicant_match_privacy()
620 if ((ssid->key_mgmt & WPA_KEY_MGMT_OWE) && !ssid->owe_only) in wpa_supplicant_match_privacy()
630 if ((ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) && in wpa_supplicant_match_privacy()
631 ssid->eapol_flags & (EAPOL_FLAG_REQUIRE_KEY_UNICAST | in wpa_supplicant_match_privacy()
636 if (wpa_key_mgmt_wpa(ssid->key_mgmt)) in wpa_supplicant_match_privacy()
639 if (ssid->key_mgmt & WPA_KEY_MGMT_OSEN) in wpa_supplicant_match_privacy()
642 if (bss->caps & IEEE80211_CAP_PRIVACY) in wpa_supplicant_match_privacy()
659 bool is_6ghz_bss = is_6ghz_freq(bss->freq); in wpa_supplicant_ssid_bss_match()
666 /* Allow TSN if local configuration accepts WEP use without WPA/WPA2 */ in wpa_supplicant_ssid_bss_match()
667 wep_ok = !wpa_key_mgmt_wpa(ssid->key_mgmt) && in wpa_supplicant_ssid_bss_match()
668 (((ssid->key_mgmt & WPA_KEY_MGMT_NONE) && in wpa_supplicant_ssid_bss_match()
669 ssid->wep_key_len[ssid->wep_tx_keyidx] > 0) || in wpa_supplicant_ssid_bss_match()
670 (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)); in wpa_supplicant_ssid_bss_match()
677 " skip - 6 GHz BSS without RSNE"); in wpa_supplicant_ssid_bss_match()
681 while ((ssid->proto & (WPA_PROTO_RSN | WPA_PROTO_OSEN)) && rsn_ie) { in wpa_supplicant_ssid_bss_match()
687 " skip RSN IE - parse failed"); in wpa_supplicant_ssid_bss_match()
691 ie.pairwise_cipher = wpa_default_rsn_cipher(bss->freq); in wpa_supplicant_ssid_bss_match()
693 ie.group_cipher = wpa_default_rsn_cipher(bss->freq); in wpa_supplicant_ssid_bss_match()
695 if (is_6ghz_bss || !is_zero_ether_addr(bss->mld_addr)) { in wpa_supplicant_ssid_bss_match()
711 " selected based on TSN in RSN IE"); in wpa_supplicant_ssid_bss_match()
716 if (!(ie.proto & ssid->proto) && in wpa_supplicant_ssid_bss_match()
717 !(ssid->proto & WPA_PROTO_OSEN)) { in wpa_supplicant_ssid_bss_match()
720 " skip RSN IE - proto mismatch"); in wpa_supplicant_ssid_bss_match()
724 if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) { in wpa_supplicant_ssid_bss_match()
727 " skip RSN IE - PTK cipher mismatch"); in wpa_supplicant_ssid_bss_match()
731 if (!(ie.group_cipher & ssid->group_cipher)) { in wpa_supplicant_ssid_bss_match()
734 " skip RSN IE - GTK cipher mismatch"); in wpa_supplicant_ssid_bss_match()
738 if (ssid->group_mgmt_cipher && in wpa_supplicant_ssid_bss_match()
739 !(ie.mgmt_group_cipher & ssid->group_mgmt_cipher)) { in wpa_supplicant_ssid_bss_match()
742 " skip RSN IE - group mgmt cipher mismatch"); in wpa_supplicant_ssid_bss_match()
751 " skip RSNE - 6 GHz without MFPC"); in wpa_supplicant_ssid_bss_match()
761 if (!(ie.key_mgmt & ssid->key_mgmt)) { in wpa_supplicant_ssid_bss_match()
764 " skip RSN IE - key mgmt mismatch"); in wpa_supplicant_ssid_bss_match()
773 " skip RSN IE - no mgmt frame protection"); in wpa_supplicant_ssid_bss_match()
781 " skip RSN IE - no mgmt frame protection enabled but AP requires it"); in wpa_supplicant_ssid_bss_match()
794 " skip - 6 GHz BSS without matching RSNE"); in wpa_supplicant_ssid_bss_match()
801 (!(ssid->key_mgmt & WPA_KEY_MGMT_OWE) || ssid->owe_only)) { in wpa_supplicant_ssid_bss_match()
803 if ((ssid->key_mgmt & WPA_KEY_MGMT_OWE) && ssid->owe_only && in wpa_supplicant_ssid_bss_match()
805 wpa_s->owe_transition_select && in wpa_supplicant_ssid_bss_match()
807 ssid->owe_transition_bss_select_count + 1 <= in wpa_supplicant_ssid_bss_match()
809 ssid->owe_transition_bss_select_count++; in wpa_supplicant_ssid_bss_match()
813 ssid->owe_transition_bss_select_count, in wpa_supplicant_ssid_bss_match()
815 wpa_s->owe_transition_search = 1; in wpa_supplicant_ssid_bss_match()
821 " skip - MFP Required but network not MFP Capable"); in wpa_supplicant_ssid_bss_match()
825 while ((ssid->proto & WPA_PROTO_WPA) && wpa_ie) { in wpa_supplicant_ssid_bss_match()
831 " skip WPA IE - parse failed"); in wpa_supplicant_ssid_bss_match()
841 " selected based on TSN in WPA IE"); in wpa_supplicant_ssid_bss_match()
846 if (!(ie.proto & ssid->proto)) { in wpa_supplicant_ssid_bss_match()
849 " skip WPA IE - proto mismatch"); in wpa_supplicant_ssid_bss_match()
853 if (!(ie.pairwise_cipher & ssid->pairwise_cipher)) { in wpa_supplicant_ssid_bss_match()
856 " skip WPA IE - PTK cipher mismatch"); in wpa_supplicant_ssid_bss_match()
860 if (!(ie.group_cipher & ssid->group_cipher)) { in wpa_supplicant_ssid_bss_match()
863 " skip WPA IE - GTK cipher mismatch"); in wpa_supplicant_ssid_bss_match()
867 if (!(ie.key_mgmt & ssid->key_mgmt)) { in wpa_supplicant_ssid_bss_match()
870 " skip WPA IE - key mgmt mismatch"); in wpa_supplicant_ssid_bss_match()
880 if ((ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) && !wpa_ie && in wpa_supplicant_ssid_bss_match()
884 " allow for non-WPA IEEE 802.1X"); in wpa_supplicant_ssid_bss_match()
889 if ((ssid->key_mgmt & WPA_KEY_MGMT_OWE) && !ssid->owe_only && in wpa_supplicant_ssid_bss_match()
891 if (wpa_s->owe_transition_select && in wpa_supplicant_ssid_bss_match()
893 ssid->owe_transition_bss_select_count + 1 <= in wpa_supplicant_ssid_bss_match()
895 ssid->owe_transition_bss_select_count++; in wpa_supplicant_ssid_bss_match()
899 ssid->owe_transition_bss_select_count, in wpa_supplicant_ssid_bss_match()
901 wpa_s->owe_transition_search = 1; in wpa_supplicant_ssid_bss_match()
911 if ((ssid->proto & (WPA_PROTO_WPA | WPA_PROTO_RSN)) && in wpa_supplicant_ssid_bss_match()
912 wpa_key_mgmt_wpa(ssid->key_mgmt) && proto_match == 0) { in wpa_supplicant_ssid_bss_match()
915 " skip - no WPA/RSN proto match"); in wpa_supplicant_ssid_bss_match()
919 if ((ssid->key_mgmt & WPA_KEY_MGMT_OSEN) && in wpa_supplicant_ssid_bss_match()
926 if (!wpa_key_mgmt_wpa(ssid->key_mgmt)) { in wpa_supplicant_ssid_bss_match()
928 wpa_dbg(wpa_s, MSG_DEBUG, " allow in non-WPA/WPA2"); in wpa_supplicant_ssid_bss_match()
962 if (bss->freq == 0) in rate_match()
965 modes = wpa_s->hw.modes; in rate_match()
975 for (i = 0; i < wpa_s->hw.num_modes; i++) { in rate_match()
978 if (freq == bss->freq) { in rate_match()
980 mode->mode == HOSTAPD_MODE_IEEE80211G) in rate_match()
1002 * IEEE Std 802.11n-2009 7.3.2.2: in rate_match()
1046 if (wpa_s->conf->sae_pwe == in rate_match()
1048 !ssid->sae_password_id && in rate_match()
1049 !is_6ghz_freq(bss->freq) && in rate_match()
1050 wpa_key_mgmt_sae(ssid->key_mgmt)) { in rate_match()
1055 if (wpa_s->ignore_sae_h2e_only) { in rate_match()
1071 for (k = 0; k < mode->num_rates; k++) { in rate_match()
1072 if (mode->rates[k] == r) in rate_match()
1075 if (k == mode->num_rates) { in rate_match()
1077 * IEEE Std 802.11-2007 7.3.2.2 demands that in in rate_match()
1085 bss->freq, mode->mode, mode->num_rates); in rate_match()
1097 * This is done differently in DMG (60 GHz) and non-DMG bands
1102 return (bss->caps & IEEE80211_CAP_DMG_MASK) == in bss_is_ess()
1106 return ((bss->caps & (IEEE80211_CAP_ESS | IEEE80211_CAP_IBSS)) == in bss_is_ess()
1152 if (end - pos < ETH_ALEN + 1) in owe_trans_ssid()
1157 if (end - pos < ssid_len || ssid_len > SSID_MAX_LEN) in owe_trans_ssid()
1167 if (!(bss->flags & WPA_BSS_OWE_TRANSITION)) { in owe_trans_ssid()
1170 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { in owe_trans_ssid()
1173 if (ssid->ssid_len == ssid_len && in owe_trans_ssid()
1174 os_memcmp(ssid->ssid, pos, ssid_len) == 0) { in owe_trans_ssid()
1179 bss->flags |= WPA_BSS_OWE_TRANSITION; in owe_trans_ssid()
1195 if (!bss->valid_links) in wpas_valid_ml_bss()
1200 if (BIT(bss->mld_link_id) & removed_links) in wpas_valid_ml_bss()
1211 if (!wpa_s->hw.modes || !wpa_s->hw.num_modes) in disabled_freq()
1214 for (j = 0; j < wpa_s->hw.num_modes; j++) { in disabled_freq()
1215 struct hostapd_hw_modes *mode = &wpa_s->hw.modes[j]; in disabled_freq()
1217 for (i = 0; i < mode->num_channels; i++) { in disabled_freq()
1218 struct hostapd_channel_data *chan = &mode->channels[i]; in disabled_freq()
1220 if (chan->freq == freq) in disabled_freq()
1221 return !!(chan->flag & HOSTAPD_CHAN_DISABLED); in disabled_freq()
1244 dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) { in sae_pk_acceptable_bss_with_pk()
1257 if (bss->est_throughput < 2000) in sae_pk_acceptable_bss_with_pk()
1260 count = wpa_bssid_ignore_is_listed(wpa_s, bss->bssid); in sae_pk_acceptable_bss_with_pk()
1303 check_ssid = wpa || ssid->ssid_len > 0; in wpa_scan_res_ok()
1307 wpa_dbg(wpa_s, MSG_DEBUG, " skip - disabled"); in wpa_scan_res_ok()
1315 " skip - disabled temporarily for %d second(s)", in wpa_scan_res_ok()
1321 if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && bssid_ignore_count) { in wpa_scan_res_ok()
1324 " skip - BSSID ignored (WPS)"); in wpa_scan_res_ok()
1328 if (wpa && ssid->ssid_len == 0 && in wpa_scan_res_ok()
1332 if (!wpa && (ssid->key_mgmt & WPA_KEY_MGMT_WPS)) { in wpa_scan_res_ok()
1335 check_ssid = ssid->ssid_len > 0 || in wpa_scan_res_ok()
1340 if (ssid->bssid_set && ssid->ssid_len == 0 && in wpa_scan_res_ok()
1341 ether_addr_equal(bss->bssid, ssid->bssid)) in wpa_scan_res_ok()
1345 (match_ssid_len != ssid->ssid_len || in wpa_scan_res_ok()
1346 os_memcmp(match_ssid, ssid->ssid, match_ssid_len) != 0)) { in wpa_scan_res_ok()
1348 wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID mismatch"); in wpa_scan_res_ok()
1352 if (ssid->bssid_set && in wpa_scan_res_ok()
1353 !ether_addr_equal(bss->bssid, ssid->bssid)) { in wpa_scan_res_ok()
1355 wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID mismatch"); in wpa_scan_res_ok()
1360 if (ssid->num_bssid_ignore && in wpa_scan_res_ok()
1361 addr_in_list(bss->bssid, ssid->bssid_ignore, in wpa_scan_res_ok()
1362 ssid->num_bssid_ignore)) { in wpa_scan_res_ok()
1365 " skip - BSSID configured to be ignored"); in wpa_scan_res_ok()
1370 if (ssid->num_bssid_accept && in wpa_scan_res_ok()
1371 !addr_in_list(bss->bssid, ssid->bssid_accept, in wpa_scan_res_ok()
1372 ssid->num_bssid_accept)) { in wpa_scan_res_ok()
1375 " skip - BSSID not in list of accepted values"); in wpa_scan_res_ok()
1383 !(ssid->key_mgmt & WPA_KEY_MGMT_NONE) && in wpa_scan_res_ok()
1384 !(ssid->key_mgmt & WPA_KEY_MGMT_WPS) && in wpa_scan_res_ok()
1385 !(ssid->key_mgmt & WPA_KEY_MGMT_OWE) && in wpa_scan_res_ok()
1386 !(ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)) { in wpa_scan_res_ok()
1389 " skip - non-WPA network not allowed"); in wpa_scan_res_ok()
1394 if (wpa && !wpa_key_mgmt_wpa(ssid->key_mgmt) && has_wep_key(ssid)) { in wpa_scan_res_ok()
1397 " skip - ignore WPA/WPA2 AP for WEP network block"); in wpa_scan_res_ok()
1402 if ((ssid->key_mgmt & WPA_KEY_MGMT_OSEN) && !osen && !rsn_osen) { in wpa_scan_res_ok()
1405 " skip - non-OSEN network not allowed"); in wpa_scan_res_ok()
1411 wpa_dbg(wpa_s, MSG_DEBUG, " skip - privacy mismatch"); in wpa_scan_res_ok()
1415 if (ssid->mode != WPAS_MODE_MESH && !bss_is_ess(bss) && in wpa_scan_res_ok()
1419 " skip - not ESS, PBSS, or MBSS"); in wpa_scan_res_ok()
1423 if (ssid->pbss != 2 && ssid->pbss != bss_is_pbss(bss)) { in wpa_scan_res_ok()
1426 " skip - PBSS mismatch (ssid %d bss %d)", in wpa_scan_res_ok()
1427 ssid->pbss, bss_is_pbss(bss)); in wpa_scan_res_ok()
1431 if (!freq_allowed(ssid->freq_list, bss->freq)) { in wpa_scan_res_ok()
1434 " skip - frequency not allowed"); in wpa_scan_res_ok()
1439 if (ssid->mode == WPAS_MODE_MESH && ssid->frequency > 0 && in wpa_scan_res_ok()
1440 ssid->frequency != bss->freq) { in wpa_scan_res_ok()
1443 " skip - frequency not allowed (mesh)"); in wpa_scan_res_ok()
1451 " skip - rate sets do not match"); in wpa_scan_res_ok()
1458 if ((wpa_s->conf->sae_pwe == SAE_PWE_HASH_TO_ELEMENT || in wpa_scan_res_ok()
1459 is_6ghz_freq(bss->freq) || ssid->sae_password_id) && in wpa_scan_res_ok()
1460 wpa_s->conf->sae_pwe != SAE_PWE_FORCE_HUNT_AND_PECK && in wpa_scan_res_ok()
1461 wpa_key_mgmt_sae(ssid->key_mgmt) && in wpa_scan_res_ok()
1465 " skip - SAE H2E required, but not supported by the AP"); in wpa_scan_res_ok()
1471 if (ssid->sae_pk == SAE_PK_MODE_ONLY && in wpa_scan_res_ok()
1475 " skip - SAE-PK required, but not supported by the AP"); in wpa_scan_res_ok()
1481 if (ssid->mode == WPAS_MODE_IBSS && in wpa_scan_res_ok()
1482 !(ssid->key_mgmt & (WPA_KEY_MGMT_NONE | WPA_KEY_MGMT_WPA_NONE))) { in wpa_scan_res_ok()
1485 " skip - IBSS RSN not supported in the build"); in wpa_scan_res_ok()
1491 if (ssid->p2p_group && in wpa_scan_res_ok()
1495 wpa_dbg(wpa_s, MSG_DEBUG, " skip - no P2P IE seen"); in wpa_scan_res_ok()
1499 if (!is_zero_ether_addr(ssid->go_p2p_dev_addr)) { in wpa_scan_res_ok()
1507 " skip - no P2P element"); in wpa_scan_res_ok()
1514 " skip - could not fetch P2P element"); in wpa_scan_res_ok()
1519 !ether_addr_equal(dev_addr, ssid->go_p2p_dev_addr)) { in wpa_scan_res_ok()
1522 " skip - no matching GO P2P Device Address in P2P element"); in wpa_scan_res_ok()
1536 if (os_reltime_before(&bss->last_update, &wpa_s->scan_min_time)) { in wpa_scan_res_ok()
1539 os_reltime_sub(&wpa_s->scan_min_time, &bss->last_update, &diff); in wpa_scan_res_ok()
1542 " skip - scan result not recent enough (%u.%06u seconds too old)", in wpa_scan_res_ok()
1549 if (wpa_s->ignore_assoc_disallow) in wpa_scan_res_ok()
1556 " skip - MBO association disallowed (reason %u)", in wpa_scan_res_ok()
1564 " skip - AP temporarily disallowed"); in wpa_scan_res_ok()
1573 if ((ssid->key_mgmt & WPA_KEY_MGMT_DPP) && in wpa_scan_res_ok()
1574 !wpa_sm_pmksa_exists(wpa_s->wpa, bss->bssid, wpa_s->own_addr, in wpa_scan_res_ok()
1576 (!ssid->dpp_connector || !ssid->dpp_netaccesskey || in wpa_scan_res_ok()
1577 !ssid->dpp_csign)) { in wpa_scan_res_ok()
1580 " skip - no PMKSA entry for DPP"); in wpa_scan_res_ok()
1586 if (ssid->sae_pk == SAE_PK_MODE_AUTOMATIC && in wpa_scan_res_ok()
1587 wpa_key_mgmt_sae(ssid->key_mgmt) && in wpa_scan_res_ok()
1588 ((ssid->sae_password && in wpa_scan_res_ok()
1589 sae_pk_valid_password(ssid->sae_password)) || in wpa_scan_res_ok()
1590 (!ssid->sae_password && ssid->passphrase && in wpa_scan_res_ok()
1591 sae_pk_valid_password(ssid->passphrase))) && in wpa_scan_res_ok()
1597 " skip - another acceptable BSS with SAE-PK in the same ESS"); in wpa_scan_res_ok()
1602 if (bss->ssid_len == 0) { in wpa_scan_res_ok()
1609 owe_ssid_len == ssid->ssid_len && in wpa_scan_res_ok()
1610 os_memcmp(owe_ssid, ssid->ssid, owe_ssid_len) == 0) { in wpa_scan_res_ok()
1613 " skip - no SSID in BSS entry for a possible OWE transition mode BSS"); in wpa_scan_res_ok()
1614 int_array_add_unique(&wpa_s->owe_trans_scan_freq, in wpa_scan_res_ok()
1615 bss->freq); in wpa_scan_res_ok()
1621 " skip - no SSID known for the BSS"); in wpa_scan_res_ok()
1628 " skip - ML BSS going to be removed"); in wpa_scan_res_ok()
1662 i, MAC2STR(bss->bssid), in wpa_scan_res_match()
1663 wpa_ssid_txt(bss->ssid, bss->ssid_len), in wpa_scan_res_match()
1664 wpa_ie_len, rsn_ie_len, bss->caps, bss->level, in wpa_scan_res_match()
1665 bss->freq, in wpa_scan_res_match()
1674 bssid_ignore_count = wpa_bssid_ignore_is_listed(wpa_s, bss->bssid); in wpa_scan_res_match()
1691 " skip - BSSID ignored (count=%d limit=%d)", in wpa_scan_res_match()
1698 match_ssid = bss->ssid; in wpa_scan_res_match()
1699 match_ssid_len = bss->ssid_len; in wpa_scan_res_match()
1704 wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID not known"); in wpa_scan_res_match()
1708 if (disallowed_bssid(wpa_s, bss->bssid)) { in wpa_scan_res_match()
1710 wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID disallowed"); in wpa_scan_res_match()
1716 wpa_dbg(wpa_s, MSG_DEBUG, " skip - SSID disallowed"); in wpa_scan_res_match()
1720 if (disabled_freq(wpa_s, bss->freq)) { in wpa_scan_res_match()
1722 wpa_dbg(wpa_s, MSG_DEBUG, " skip - channel disabled"); in wpa_scan_res_match()
1728 wpa_dbg(wpa_s, MSG_DEBUG, " skip - BSSID excluded"); in wpa_scan_res_match()
1732 for (ssid = group; ssid; ssid = only_first_ssid ? NULL : ssid->pnext) { in wpa_scan_res_match()
1751 if (wpa_s->current_ssid) { in wpa_supplicant_select_bss()
1756 for (i = 0; i < wpa_s->last_scan_res_used; i++) { in wpa_supplicant_select_bss()
1757 struct wpa_bss *bss = wpa_s->last_scan_res[i]; in wpa_supplicant_select_bss()
1761 if (ssid != wpa_s->current_ssid) in wpa_supplicant_select_bss()
1765 i, MAC2STR(bss->bssid), bss->freq, bss->level, in wpa_supplicant_select_bss()
1766 bss->snr, bss->est_throughput); in wpa_supplicant_select_bss()
1771 wpa_dbg(wpa_s, MSG_DEBUG, "Try to find BSS matching pre-selected network id=%d", in wpa_supplicant_select_bss()
1772 group->id); in wpa_supplicant_select_bss()
1775 group->priority); in wpa_supplicant_select_bss()
1777 for (i = 0; i < wpa_s->last_scan_res_used; i++) { in wpa_supplicant_select_bss()
1778 struct wpa_bss *bss = wpa_s->last_scan_res[i]; in wpa_supplicant_select_bss()
1780 wpa_s->owe_transition_select = 1; in wpa_supplicant_select_bss()
1783 wpa_s->owe_transition_select = 0; in wpa_supplicant_select_bss()
1788 bss == wpa_s->current_bss ? "current ": "", in wpa_supplicant_select_bss()
1789 MAC2STR(bss->bssid), in wpa_supplicant_select_bss()
1790 wpa_ssid_txt(bss->ssid, bss->ssid_len)); in wpa_supplicant_select_bss()
1806 if (wpa_s->last_scan_res == NULL || in wpa_supplicant_pick_network()
1807 wpa_s->last_scan_res_used == 0) in wpa_supplicant_pick_network()
1810 if (wpa_s->next_ssid) { in wpa_supplicant_pick_network()
1812 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { in wpa_supplicant_pick_network()
1813 if (ssid == wpa_s->next_ssid) in wpa_supplicant_pick_network()
1817 wpa_s->next_ssid = NULL; in wpa_supplicant_pick_network()
1821 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) { in wpa_supplicant_pick_network()
1822 if (next_ssid && next_ssid->priority == in wpa_supplicant_pick_network()
1823 wpa_s->conf->pssid[prio]->priority) { in wpa_supplicant_pick_network()
1830 wpa_s, wpa_s->conf->pssid[prio], in wpa_supplicant_pick_network()
1837 (wpa_s->bssid_ignore || wnm_active_bss_trans_mgmt(wpa_s)) && in wpa_supplicant_pick_network()
1838 !wpa_s->countermeasures) { in wpa_supplicant_pick_network()
1840 "No APs found - clear BSSID ignore list and try again"); in wpa_supplicant_pick_network()
1843 wpa_s->bssid_ignore_cleared = true; in wpa_supplicant_pick_network()
1849 if (selected && ssid && ssid->mem_only_psk && !ssid->psk_set && in wpa_supplicant_pick_network()
1850 !ssid->passphrase && !ssid->ext_psk) { in wpa_supplicant_pick_network()
1878 * No networks are enabled; short-circuit request so in wpa_supplicant_req_new_scan()
1882 wpa_dbg(wpa_s, MSG_DEBUG, "Short-circuit new scan request " in wpa_supplicant_req_new_scan()
1888 wpa_s->scan_for_connection = 1; in wpa_supplicant_req_new_scan()
1895 if (!wpa_s->ml_connect_probe_ssid || !wpa_s->ml_connect_probe_bss) in ml_link_probe_scan()
1900 MAC2STR(wpa_s->ml_connect_probe_bss->bssid)); in ml_link_probe_scan()
1902 wpa_supplicant_associate(wpa_s, wpa_s->ml_connect_probe_bss, in ml_link_probe_scan()
1903 wpa_s->ml_connect_probe_ssid); in ml_link_probe_scan()
1905 wpa_s->ml_connect_probe_ssid = NULL; in ml_link_probe_scan()
1906 wpa_s->ml_connect_probe_bss = NULL; in ml_link_probe_scan()
1920 if (!((wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_MLO) && in wpa_supplicant_connect_ml_missing()
1921 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME))) in wpa_supplicant_connect_ml_missing()
1944 wpa_s->ml_connect_probe_ssid = ssid; in wpa_supplicant_connect_ml_missing()
1945 wpa_s->ml_connect_probe_bss = selected; in wpa_supplicant_connect_ml_missing()
1947 freqs[0] = selected->freq; in wpa_supplicant_connect_ml_missing()
1950 wpa_s->manual_scan_passive = 0; in wpa_supplicant_connect_ml_missing()
1951 wpa_s->manual_scan_use_id = 0; in wpa_supplicant_connect_ml_missing()
1952 wpa_s->manual_scan_only_new = 0; in wpa_supplicant_connect_ml_missing()
1953 wpa_s->scan_id_count = 0; in wpa_supplicant_connect_ml_missing()
1954 os_free(wpa_s->manual_scan_freqs); in wpa_supplicant_connect_ml_missing()
1955 wpa_s->manual_scan_freqs = freqs; in wpa_supplicant_connect_ml_missing()
1957 os_memcpy(wpa_s->ml_probe_bssid, selected->bssid, ETH_ALEN); in wpa_supplicant_connect_ml_missing()
1964 * from a non-transmitted BSS, the AP MLD ID should not be included. in wpa_supplicant_connect_ml_missing()
1967 wpa_s->ml_probe_mld_id = -1; in wpa_supplicant_connect_ml_missing()
1969 wpa_s->ml_probe_mld_id = 0; in wpa_supplicant_connect_ml_missing()
1971 if (ssid && ssid->ssid_len) { in wpa_supplicant_connect_ml_missing()
1972 os_free(wpa_s->ssids_from_scan_req); in wpa_supplicant_connect_ml_missing()
1973 wpa_s->num_ssids_from_scan_req = 0; in wpa_supplicant_connect_ml_missing()
1975 wpa_s->ssids_from_scan_req = in wpa_supplicant_connect_ml_missing()
1977 if (wpa_s->ssids_from_scan_req) { in wpa_supplicant_connect_ml_missing()
1981 wpa_s->num_ssids_from_scan_req = 1; in wpa_supplicant_connect_ml_missing()
1982 wpa_s->ssids_from_scan_req[0].ssid_len = ssid->ssid_len; in wpa_supplicant_connect_ml_missing()
1983 os_memcpy(wpa_s->ssids_from_scan_req[0].ssid, in wpa_supplicant_connect_ml_missing()
1984 ssid->ssid, ssid->ssid_len); in wpa_supplicant_connect_ml_missing()
1988 wpa_s->ml_probe_links = missing_links; in wpa_supplicant_connect_ml_missing()
1990 wpa_s->normal_scans = 0; in wpa_supplicant_connect_ml_missing()
1991 wpa_s->scan_req = MANUAL_SCAN_REQ; in wpa_supplicant_connect_ml_missing()
1992 wpa_s->after_wps = 0; in wpa_supplicant_connect_ml_missing()
1993 wpa_s->known_wps_freq = 0; in wpa_supplicant_connect_ml_missing()
2005 if ((eap_is_wps_pbc_enrollee(&ssid->eap) && in wpa_supplicant_connect()
2011 wpa_s->wps_overlap = true; in wpa_supplicant_connect()
2013 if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT || in wpa_supplicant_connect()
2014 wpa_s->p2p_in_provisioning) { in wpa_supplicant_connect()
2017 return -1; in wpa_supplicant_connect()
2025 return -1; in wpa_supplicant_connect()
2033 wpa_s->reassociate, MAC2STR(selected->bssid), in wpa_supplicant_connect()
2034 MAC2STR(wpa_s->bssid), MAC2STR(wpa_s->pending_bssid), in wpa_supplicant_connect()
2035 wpa_supplicant_state_txt(wpa_s->wpa_state), in wpa_supplicant_connect()
2036 ssid, wpa_s->current_ssid); in wpa_supplicant_connect()
2043 if (wpa_s->reassociate || in wpa_supplicant_connect()
2044 (!ether_addr_equal(selected->bssid, wpa_s->bssid) && in wpa_supplicant_connect()
2045 ((wpa_s->wpa_state != WPA_ASSOCIATING && in wpa_supplicant_connect()
2046 wpa_s->wpa_state != WPA_AUTHENTICATING) || in wpa_supplicant_connect()
2047 (!is_zero_ether_addr(wpa_s->pending_bssid) && in wpa_supplicant_connect()
2048 !ether_addr_equal(selected->bssid, wpa_s->pending_bssid)) || in wpa_supplicant_connect()
2049 (is_zero_ether_addr(wpa_s->pending_bssid) && in wpa_supplicant_connect()
2050 ssid != wpa_s->current_ssid)))) { in wpa_supplicant_connect()
2060 MAC2STR(selected->bssid)); in wpa_supplicant_connect()
2077 for (prio = 0; prio < wpa_s->conf->num_prio; prio++) { in wpa_supplicant_pick_new_network()
2078 for (ssid = wpa_s->conf->pssid[prio]; ssid; ssid = ssid->pnext) in wpa_supplicant_pick_new_network()
2083 if (ssid->mode == WPAS_MODE_IBSS && in wpa_supplicant_pick_new_network()
2084 !(ssid->key_mgmt & (WPA_KEY_MGMT_NONE | in wpa_supplicant_pick_new_network()
2087 "IBSS RSN not supported in the build - cannot use the profile for SSID '%s'", in wpa_supplicant_pick_new_network()
2088 wpa_ssid_txt(ssid->ssid, in wpa_supplicant_pick_new_network()
2089 ssid->ssid_len)); in wpa_supplicant_pick_new_network()
2093 if (ssid->mode == WPAS_MODE_IBSS || in wpa_supplicant_pick_new_network()
2094 ssid->mode == WPAS_MODE_AP || in wpa_supplicant_pick_new_network()
2095 ssid->mode == WPAS_MODE_MESH) in wpa_supplicant_pick_new_network()
2110 if (rsn_preauth_scan_results(wpa_s->wpa) < 0) in wpa_supplicant_rsn_preauth_scan_results()
2113 dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) { in wpa_supplicant_rsn_preauth_scan_results()
2124 rsn_preauth_scan_result(wpa_s->wpa, bss->bssid, ssid, rsn); in wpa_supplicant_rsn_preauth_scan_results()
2143 return avg_signal - noise; in wpas_get_snr_signal_info()
2153 size_t ie_len = bss->ie_len ? bss->ie_len : bss->beacon_ie_len; in wpas_get_est_throughput_from_bss_snr()
2156 return wpas_get_est_tpt(wpa_s, ies, ie_len, rate, snr, bss->freq, in wpas_get_est_throughput_from_bss_snr()
2185 size_t cur_ie_len = current_bss->ie_len ? current_bss->ie_len : in wpa_supplicant_need_to_roam_within_ess()
2186 current_bss->beacon_ie_len; in wpa_supplicant_need_to_roam_within_ess()
2187 size_t sel_ie_len = selected->ie_len ? selected->ie_len : in wpa_supplicant_need_to_roam_within_ess()
2188 selected->beacon_ie_len; in wpa_supplicant_need_to_roam_within_ess()
2190 wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation"); in wpa_supplicant_need_to_roam_within_ess()
2193 MAC2STR(current_bss->bssid), in wpa_supplicant_need_to_roam_within_ess()
2194 current_bss->freq, current_bss->level, in wpa_supplicant_need_to_roam_within_ess()
2195 current_bss->snr, current_bss->est_throughput); in wpa_supplicant_need_to_roam_within_ess()
2198 MAC2STR(selected->bssid), selected->freq, selected->level, in wpa_supplicant_need_to_roam_within_ess()
2199 selected->snr, selected->est_throughput); in wpa_supplicant_need_to_roam_within_ess()
2201 if (wpas_ap_link_address(wpa_s, selected->bssid)) { in wpa_supplicant_need_to_roam_within_ess()
2206 if (wpa_s->current_ssid->bssid_set && in wpa_supplicant_need_to_roam_within_ess()
2207 ether_addr_equal(selected->bssid, wpa_s->current_ssid->bssid)) { in wpa_supplicant_need_to_roam_within_ess()
2208 wpa_dbg(wpa_s, MSG_DEBUG, "Allow reassociation - selected BSS " in wpa_supplicant_need_to_roam_within_ess()
2236 (si.data.avg_signal - in wpa_supplicant_need_to_roam_within_ess()
2250 cur_level = current_bss->level; in wpa_supplicant_need_to_roam_within_ess()
2251 cur_snr = current_bss->snr; in wpa_supplicant_need_to_roam_within_ess()
2252 cur_est = current_bss->est_throughput; in wpa_supplicant_need_to_roam_within_ess()
2257 current_bss->max_cw); in wpa_supplicant_need_to_roam_within_ess()
2259 current_bss->max_cw, cur_snr); in wpa_supplicant_need_to_roam_within_ess()
2261 sel_est = selected->est_throughput; in wpa_supplicant_need_to_roam_within_ess()
2262 sel_level = selected->level + in wpa_supplicant_need_to_roam_within_ess()
2264 selected->max_cw); in wpa_supplicant_need_to_roam_within_ess()
2268 "Allow reassociation - selected BSS has better estimated throughput"); in wpa_supplicant_need_to_roam_within_ess()
2272 to_5ghz = selected->freq > 4000 && current_bss->freq < 4000; in wpa_supplicant_need_to_roam_within_ess()
2273 to_6ghz = is_6ghz_freq(selected->freq) && in wpa_supplicant_need_to_roam_within_ess()
2274 !is_6ghz_freq(current_bss->freq); in wpa_supplicant_need_to_roam_within_ess()
2279 wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - Current BSS has better " in wpa_supplicant_need_to_roam_within_ess()
2286 "Skip roam - Current BSS has better estimated throughput"); in wpa_supplicant_need_to_roam_within_ess()
2292 "Skip roam - Current BSS has good SNR (%u > %u)", in wpa_supplicant_need_to_roam_within_ess()
2297 if (cur_level < -85) /* ..-86 dBm */ in wpa_supplicant_need_to_roam_within_ess()
2299 else if (cur_level < -80) /* -85..-81 dBm */ in wpa_supplicant_need_to_roam_within_ess()
2301 else if (cur_level < -75) /* -80..-76 dBm */ in wpa_supplicant_need_to_roam_within_ess()
2303 else if (cur_level < -70) /* -75..-71 dBm */ in wpa_supplicant_need_to_roam_within_ess()
2305 else if (cur_level < 0) /* -70..-1 dBm */ in wpa_supplicant_need_to_roam_within_ess()
2319 min_diff -= 10; in wpa_supplicant_need_to_roam_within_ess()
2321 min_diff -= 5; in wpa_supplicant_need_to_roam_within_ess()
2323 min_diff -= 2; in wpa_supplicant_need_to_roam_within_ess()
2325 min_diff--; in wpa_supplicant_need_to_roam_within_ess()
2327 cur_band_score = wpas_evaluate_band_score(current_bss->freq); in wpa_supplicant_need_to_roam_within_ess()
2328 sel_band_score = wpas_evaluate_band_score(selected->freq); in wpa_supplicant_need_to_roam_within_ess()
2329 min_diff += (cur_band_score - sel_band_score) * 2; in wpa_supplicant_need_to_roam_within_ess()
2330 if (wpa_s->signal_threshold && cur_level <= wpa_s->signal_threshold && in wpa_supplicant_need_to_roam_within_ess()
2331 sel_level > wpa_s->signal_threshold) in wpa_supplicant_need_to_roam_within_ess()
2332 min_diff -= 2; in wpa_supplicant_need_to_roam_within_ess()
2333 diff = sel_level - cur_level; in wpa_supplicant_need_to_roam_within_ess()
2336 "Skip roam - too small difference in signal level (%d < %d)", in wpa_supplicant_need_to_roam_within_ess()
2349 MAC2STR(current_bss->bssid), in wpa_supplicant_need_to_roam_within_ess()
2350 current_bss->freq, cur_level, cur_est, in wpa_supplicant_need_to_roam_within_ess()
2351 MAC2STR(selected->bssid), in wpa_supplicant_need_to_roam_within_ess()
2352 selected->freq, sel_level, sel_est); in wpa_supplicant_need_to_roam_within_ess()
2366 if (wpa_s->reassociate) in wpa_supplicant_need_to_roam()
2368 if (wpa_s->wpa_state < WPA_ASSOCIATED) in wpa_supplicant_need_to_roam()
2370 if (wpa_s->current_ssid == NULL) in wpa_supplicant_need_to_roam()
2372 if (wpa_s->current_ssid != ssid) in wpa_supplicant_need_to_roam()
2376 return 0; /* Driver-based roaming */ in wpa_supplicant_need_to_roam()
2378 if (wpa_s->valid_links) in wpa_supplicant_need_to_roam()
2379 bssid = wpa_s->links[wpa_s->mlo_assoc_link_id].bssid; in wpa_supplicant_need_to_roam()
2381 bssid = wpa_s->bssid; in wpa_supplicant_need_to_roam()
2383 if (wpa_s->current_ssid->ssid) in wpa_supplicant_need_to_roam()
2385 wpa_s->current_ssid->ssid, in wpa_supplicant_need_to_roam()
2386 wpa_s->current_ssid->ssid_len); in wpa_supplicant_need_to_roam()
2396 if (selected->last_update_idx > current_bss->last_update_idx) in wpa_supplicant_need_to_roam()
2430 if (wpa_s->ap_iface) in _wpa_supplicant_event_scan_results()
2434 trigger_6ghz_scan = wpa_s->crossed_6ghz_dom && in _wpa_supplicant_event_scan_results()
2435 wpa_s->last_scan_all_chan; in _wpa_supplicant_event_scan_results()
2436 wpa_s->crossed_6ghz_dom = false; in _wpa_supplicant_event_scan_results()
2437 wpa_s->last_scan_all_chan = false; in _wpa_supplicant_event_scan_results()
2442 data ? &data->scan_info : in _wpa_supplicant_event_scan_results()
2445 if (wpa_s->conf->ap_scan == 2 || ap || in _wpa_supplicant_event_scan_results()
2446 wpa_s->scan_res_handler == scan_only_handler) in _wpa_supplicant_event_scan_results()
2447 return -1; in _wpa_supplicant_event_scan_results()
2449 return -1; in _wpa_supplicant_event_scan_results()
2450 if (data && data->scan_info.external_scan) in _wpa_supplicant_event_scan_results()
2451 return -1; in _wpa_supplicant_event_scan_results()
2452 if (wpa_s->scan_res_fail_handler) { in _wpa_supplicant_event_scan_results()
2455 handler = wpa_s->scan_res_fail_handler; in _wpa_supplicant_event_scan_results()
2456 wpa_s->scan_res_fail_handler = NULL; in _wpa_supplicant_event_scan_results()
2460 "Failed to get scan results - try scanning again"); in _wpa_supplicant_event_scan_results()
2464 ret = -1; in _wpa_supplicant_event_scan_results()
2469 num = scan_res->num; in _wpa_supplicant_event_scan_results()
2474 struct wpa_scan_res *res = scan_res->res[i]; in _wpa_supplicant_event_scan_results()
2475 buf[0] = res->bssid[5]; in _wpa_supplicant_event_scan_results()
2476 buf[1] = res->qual & 0xff; in _wpa_supplicant_event_scan_results()
2477 buf[2] = res->noise & 0xff; in _wpa_supplicant_event_scan_results()
2478 buf[3] = res->level & 0xff; in _wpa_supplicant_event_scan_results()
2479 buf[4] = res->tsf & 0xff; in _wpa_supplicant_event_scan_results()
2489 if (own_request && wpa_s->scan_res_handler && in _wpa_supplicant_event_scan_results()
2490 !(data && data->scan_info.external_scan)) { in _wpa_supplicant_event_scan_results()
2494 scan_res_handler = wpa_s->scan_res_handler; in _wpa_supplicant_event_scan_results()
2495 wpa_s->scan_res_handler = NULL; in _wpa_supplicant_event_scan_results()
2502 wpa_s->own_scan_running, in _wpa_supplicant_event_scan_results()
2503 data ? data->scan_info.external_scan : 0); in _wpa_supplicant_event_scan_results()
2504 if (wpa_s->last_scan_req == MANUAL_SCAN_REQ && in _wpa_supplicant_event_scan_results()
2505 wpa_s->manual_scan_use_id && wpa_s->own_scan_running && in _wpa_supplicant_event_scan_results()
2506 own_request && !(data && data->scan_info.external_scan)) { in _wpa_supplicant_event_scan_results()
2508 wpa_s->manual_scan_id); in _wpa_supplicant_event_scan_results()
2509 wpa_s->manual_scan_use_id = 0; in _wpa_supplicant_event_scan_results()
2520 if (wpa_s->ap_iface->scan_cb) in _wpa_supplicant_event_scan_results()
2521 wpa_s->ap_iface->scan_cb(wpa_s->ap_iface); in _wpa_supplicant_event_scan_results()
2526 if (data && data->scan_info.external_scan) { in _wpa_supplicant_event_scan_results()
2540 wpas_beacon_rep_scan_process(wpa_s, scan_res, &data->scan_info) > 0) in _wpa_supplicant_event_scan_results()
2547 if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s))) in _wpa_supplicant_event_scan_results()
2553 if (wpa_s->disconnected) { in _wpa_supplicant_event_scan_results()
2564 if (wpa_s->wpa_state >= WPA_AUTHENTICATING && in _wpa_supplicant_event_scan_results()
2565 wpa_s->wpa_state < WPA_COMPLETED) in _wpa_supplicant_event_scan_results()
2570 if (own_request && wpa_s->scan_work) { in _wpa_supplicant_event_scan_results()
2571 struct wpa_radio_work *work = wpa_s->scan_work; in _wpa_supplicant_event_scan_results()
2572 wpa_s->scan_work = NULL; in _wpa_supplicant_event_scan_results()
2576 os_free(wpa_s->last_scan_freqs); in _wpa_supplicant_event_scan_results()
2577 wpa_s->last_scan_freqs = NULL; in _wpa_supplicant_event_scan_results()
2578 wpa_s->num_last_scan_freqs = 0; in _wpa_supplicant_event_scan_results()
2580 data->scan_info.freqs && data->scan_info.num_freqs) { in _wpa_supplicant_event_scan_results()
2581 wpa_s->last_scan_freqs = os_malloc(sizeof(int) * in _wpa_supplicant_event_scan_results()
2582 data->scan_info.num_freqs); in _wpa_supplicant_event_scan_results()
2583 if (wpa_s->last_scan_freqs) { in _wpa_supplicant_event_scan_results()
2584 os_memcpy(wpa_s->last_scan_freqs, in _wpa_supplicant_event_scan_results()
2585 data->scan_info.freqs, in _wpa_supplicant_event_scan_results()
2586 sizeof(int) * data->scan_info.num_freqs); in _wpa_supplicant_event_scan_results()
2587 wpa_s->num_last_scan_freqs = data->scan_info.num_freqs; in _wpa_supplicant_event_scan_results()
2591 if (wpa_s->supp_pbc_active && !wpas_wps_partner_link_scan_done(wpa_s)) in _wpa_supplicant_event_scan_results()
2599 if (own_request && wpa_s->scan_work) { in _wpa_supplicant_event_scan_results()
2600 struct wpa_radio_work *work = wpa_s->scan_work; in _wpa_supplicant_event_scan_results()
2601 wpa_s->scan_work = NULL; in _wpa_supplicant_event_scan_results()
2614 wpa_dbg(wpa_s, MSG_INFO, "Triggering 6GHz-only scan"); in wpas_trigger_6ghz_scan()
2616 params.non_coloc_6ghz = wpa_s->last_scan_non_coloc_6ghz; in wpas_trigger_6ghz_scan()
2617 for (j = 0; j < data->scan_info.num_ssids; j++) in wpas_trigger_6ghz_scan()
2618 params.ssids[j] = data->scan_info.ssids[j]; in wpas_trigger_6ghz_scan()
2619 params.num_ssids = data->scan_info.num_ssids; in wpas_trigger_6ghz_scan()
2621 true, !wpa_s->last_scan_non_coloc_6ghz, false); in wpas_trigger_6ghz_scan()
2626 wpa_dbg(wpa_s, MSG_INFO, "Failed to trigger 6GHz-only scan"); in wpas_trigger_6ghz_scan()
2637 * @trigger_6ghz_scan: Whether to trigger a 6ghz-only scan when applicable
2661 if (wpa_s->p2p_mgmt) in wpas_select_network_from_last_scan()
2664 wpa_s->owe_transition_search = 0; in wpas_select_network_from_last_scan()
2666 os_free(wpa_s->owe_trans_scan_freq); in wpas_select_network_from_last_scan()
2667 wpa_s->owe_trans_scan_freq = NULL; in wpas_select_network_from_last_scan()
2672 if (wpa_s->ifmsh) { in wpas_select_network_from_last_scan()
2688 wpa_s->suitable_network++; in wpas_select_network_from_last_scan()
2690 if (ssid != wpa_s->current_ssid && in wpas_select_network_from_last_scan()
2691 wpa_s->wpa_state >= WPA_AUTHENTICATING) { in wpas_select_network_from_last_scan()
2692 wpa_s->own_disconnect_req = 1; in wpas_select_network_from_last_scan()
2699 return -1; in wpas_select_network_from_last_scan()
2701 wpa_s->supp_pbc_active = false; in wpas_select_network_from_last_scan()
2712 wpa_s->no_suitable_network++; in wpas_select_network_from_last_scan()
2721 if (wpa_s->support_6ghz && trigger_6ghz_scan && data && in wpas_select_network_from_last_scan()
2730 int timeout_sec = wpa_s->scan_interval; in wpas_select_network_from_last_scan()
2744 if (wpa_s->p2p_in_provisioning || in wpas_select_network_from_last_scan()
2745 wpa_s->show_group_started || in wpas_select_network_from_last_scan()
2746 wpa_s->p2p_in_invitation) { in wpas_select_network_from_last_scan()
2749 * state and during P2P join-a-group operation in wpas_select_network_from_last_scan()
2760 if (wpa_s->conf->auto_interworking && in wpas_select_network_from_last_scan()
2761 wpa_s->conf->interworking && in wpas_select_network_from_last_scan()
2762 wpa_s->conf->cred) { in wpas_select_network_from_last_scan()
2766 wpa_s->network_select = 1; in wpas_select_network_from_last_scan()
2767 wpa_s->auto_network_select = 1; in wpas_select_network_from_last_scan()
2773 if (wpa_s->after_wps > 0 || wpas_wps_searching(wpa_s)) { in wpas_select_network_from_last_scan()
2783 if (wpa_s->owe_transition_search) { in wpas_select_network_from_last_scan()
2788 if (wpa_s->owe_trans_scan_freq) { in wpas_select_network_from_last_scan()
2789 os_free(wpa_s->next_scan_freqs); in wpas_select_network_from_last_scan()
2790 wpa_s->next_scan_freqs = in wpas_select_network_from_last_scan()
2791 wpa_s->owe_trans_scan_freq; in wpas_select_network_from_last_scan()
2792 wpa_s->owe_trans_scan_freq = NULL; in wpas_select_network_from_last_scan()
2842 dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant, in wpa_supplicant_event_scan_results()
2846 "sibling", ifs->ifname); in wpa_supplicant_event_scan_results()
2863 return -1; in wpa_supplicant_fast_associate()
2867 wpa_s->ignore_post_flush_scan_res = 0; in wpa_supplicant_fast_associate()
2869 if (wpa_s->last_scan_res_used == 0) in wpa_supplicant_fast_associate()
2870 return -1; in wpa_supplicant_fast_associate()
2873 if (os_reltime_expired(&now, &wpa_s->last_scan, in wpa_supplicant_fast_associate()
2874 wpa_s->conf->scan_res_valid_for_connect)) { in wpa_supplicant_fast_associate()
2876 return -1; in wpa_supplicant_fast_associate()
2877 } else if (wpa_s->crossed_6ghz_dom) { in wpa_supplicant_fast_associate()
2879 return -1; in wpa_supplicant_fast_associate()
2890 return -1; in wpa_wps_supplicant_fast_associate()
2903 if (wpa_s->wpa_state < WPA_ASSOCIATED) in wnm_bss_keep_alive()
2906 if (!wpa_s->no_keep_alive) { in wnm_bss_keep_alive()
2907 wpa_printf(MSG_DEBUG, "WNM: Send keep-alive to AP " MACSTR, in wnm_bss_keep_alive()
2908 MAC2STR(wpa_s->bssid)); in wnm_bss_keep_alive()
2912 if (wpa_s->l2) in wnm_bss_keep_alive()
2913 l2_packet_send(wpa_s->l2, wpa_s->bssid, 0x0800, in wnm_bss_keep_alive()
2918 if (wpa_s->sme.bss_max_idle_period) { in wnm_bss_keep_alive()
2920 msec = wpa_s->sme.bss_max_idle_period * 1024; /* times 1000 */ in wnm_bss_keep_alive()
2922 msec -= 100; in wnm_bss_keep_alive()
2944 wpa_s->sme.bss_max_idle_period = in wnm_process_assoc_resp()
2947 "TU)%s", wpa_s->sme.bss_max_idle_period, in wnm_process_assoc_resp()
2949 " (protected keep-live required)" : ""); in wnm_process_assoc_resp()
2950 if (wpa_s->sme.bss_max_idle_period == 0) in wnm_process_assoc_resp()
2951 wpa_s->sme.bss_max_idle_period = 1; in wnm_process_assoc_resp()
2952 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) { in wnm_process_assoc_resp()
2955 msec = wpa_s->sme.bss_max_idle_period * 1024; in wnm_process_assoc_resp()
2957 msec -= 100; in wnm_process_assoc_resp()
2963 wpa_s->sme.bss_max_idle_period = 0; in wnm_process_assoc_resp()
3014 if (wpa_s->enabled_4addr_mode) { in wpa_supplicant_set_4addr_mode()
3023 wpa_s->enabled_4addr_mode = 1; in wpa_supplicant_set_4addr_mode()
3039 wpa_s->multi_ap_ie = 0; in multi_ap_process_assoc_resp()
3046 status = check_multi_ap_ie(elems.multi_ap + 4, elems.multi_ap_len - 4, in multi_ap_process_assoc_resp()
3051 wpa_s->multi_ap_backhaul = !!(multi_ap.capability & in multi_ap_process_assoc_resp()
3053 wpa_s->multi_ap_fronthaul = !!(multi_ap.capability & in multi_ap_process_assoc_resp()
3055 wpa_s->multi_ap_ie = 1; in multi_ap_process_assoc_resp()
3061 if (!wpa_s->current_ssid || in multi_ap_set_4addr_mode()
3062 !wpa_s->current_ssid->multi_ap_backhaul_sta) in multi_ap_set_4addr_mode()
3065 if (!wpa_s->multi_ap_ie) { in multi_ap_set_4addr_mode()
3067 "AP does not include valid Multi-AP element"); in multi_ap_set_4addr_mode()
3071 if (!wpa_s->multi_ap_backhaul) { in multi_ap_set_4addr_mode()
3072 if (wpa_s->multi_ap_fronthaul && in multi_ap_set_4addr_mode()
3073 wpa_s->current_ssid->key_mgmt & WPA_KEY_MGMT_WPS) { in multi_ap_set_4addr_mode()
3075 "WPS active, accepting fronthaul-only BSS"); in multi_ap_set_4addr_mode()
3097 if (!ie || !ie_len || !wpa_s->fst) in wpas_fst_update_mbie()
3098 return -ENOENT; in wpas_fst_update_mbie()
3116 mb_ies.ies[mb_ies.nof_ies].ie_len = len - 2; in wpas_fst_update_mbie()
3120 ie_len -= len; in wpas_fst_update_mbie()
3125 wpabuf_free(wpa_s->received_mb_ies); in wpas_fst_update_mbie()
3126 wpa_s->received_mb_ies = mb_ies_by_info(&mb_ies); in wpas_fst_update_mbie()
3130 return -ENOENT; in wpas_fst_update_mbie()
3143 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpa_supplicant_use_own_rsne_params()
3144 struct wpa_bss *bss = wpa_s->current_bss; in wpa_supplicant_use_own_rsne_params()
3150 p = data->assoc_info.req_ies; in wpa_supplicant_use_own_rsne_params()
3151 l = data->assoc_info.req_ies_len; in wpa_supplicant_use_own_rsne_params()
3168 l -= len; in wpa_supplicant_use_own_rsne_params()
3173 wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCV, 0); in wpa_supplicant_use_own_rsne_params()
3178 "WPA: Update cipher suite selection based on IEs in driver-generated WPA/RSNE in AssocReq", in wpa_supplicant_use_own_rsne_params()
3182 wpa_s->wpa_proto = ie.proto; in wpa_supplicant_use_own_rsne_params()
3183 wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_PROTO, wpa_s->wpa_proto); in wpa_supplicant_use_own_rsne_params()
3184 wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_RSN_ENABLED, in wpa_supplicant_use_own_rsne_params()
3185 !!(wpa_s->wpa_proto & in wpa_supplicant_use_own_rsne_params()
3190 if (ssid->key_mgmt) in wpa_supplicant_use_own_rsne_params()
3191 sel &= ssid->key_mgmt; in wpa_supplicant_use_own_rsne_params()
3195 ie.key_mgmt, ssid->key_mgmt, sel); in wpa_supplicant_use_own_rsne_params()
3199 return -1; in wpa_supplicant_use_own_rsne_params()
3203 if (((wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) || in wpa_supplicant_use_own_rsne_params()
3204 (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_OCV)) && ssid->ocv) in wpa_supplicant_use_own_rsne_params()
3205 wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_OCV, in wpa_supplicant_use_own_rsne_params()
3213 if (wpa_s->key_mgmt != ie.key_mgmt && in wpa_supplicant_use_own_rsne_params()
3215 if (!ssid->psk_set) { in wpa_supplicant_use_own_rsne_params()
3219 return -1; in wpa_supplicant_use_own_rsne_params()
3222 wpa_sm_set_pmk(wpa_s->wpa, ssid->psk, PMK_LEN, NULL, NULL); in wpa_supplicant_use_own_rsne_params()
3223 if (wpa_s->conf->key_mgmt_offload && in wpa_supplicant_use_own_rsne_params()
3224 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD) && in wpa_supplicant_use_own_rsne_params()
3225 wpa_drv_set_key(wpa_s, -1, 0, NULL, 0, 0, NULL, 0, in wpa_supplicant_use_own_rsne_params()
3226 ssid->psk, PMK_LEN, KEY_FLAG_PMK)) in wpa_supplicant_use_own_rsne_params()
3231 wpa_s->key_mgmt = ie.key_mgmt; in wpa_supplicant_use_own_rsne_params()
3232 wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_KEY_MGMT, wpa_s->key_mgmt); in wpa_supplicant_use_own_rsne_params()
3234 wpa_key_mgmt_txt(wpa_s->key_mgmt, wpa_s->wpa_proto), in wpa_supplicant_use_own_rsne_params()
3235 wpa_s->wpa_proto); in wpa_supplicant_use_own_rsne_params()
3239 if (ssid->pairwise_cipher) in wpa_supplicant_use_own_rsne_params()
3240 sel &= ssid->pairwise_cipher; in wpa_supplicant_use_own_rsne_params()
3244 ie.pairwise_cipher, ssid->pairwise_cipher, sel); in wpa_supplicant_use_own_rsne_params()
3248 return -1; in wpa_supplicant_use_own_rsne_params()
3251 wpa_s->pairwise_cipher = ie.pairwise_cipher; in wpa_supplicant_use_own_rsne_params()
3252 wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_PAIRWISE, in wpa_supplicant_use_own_rsne_params()
3253 wpa_s->pairwise_cipher); in wpa_supplicant_use_own_rsne_params()
3255 wpa_cipher_txt(wpa_s->pairwise_cipher)); in wpa_supplicant_use_own_rsne_params()
3260 "WPA: current_bss == NULL - skip AP IE check"); in wpa_supplicant_use_own_rsne_params()
3267 if (wpa_s->wpa_proto & (WPA_PROTO_RSN | WPA_PROTO_OSEN)) { in wpa_supplicant_use_own_rsne_params()
3276 } else if (wpa_s->wpa_proto & WPA_PROTO_WPA) { in wpa_supplicant_use_own_rsne_params()
3296 return -1; in wpa_supplicant_use_own_rsne_params()
3303 return -1; in wpa_supplicant_use_own_rsne_params()
3308 wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_MFP, pmf); in wpa_supplicant_use_own_rsne_params()
3312 if (ssid->group_cipher) in wpa_supplicant_use_own_rsne_params()
3313 sel &= ssid->group_cipher; in wpa_supplicant_use_own_rsne_params()
3317 ie.group_cipher, ssid->group_cipher, sel); in wpa_supplicant_use_own_rsne_params()
3321 return -1; in wpa_supplicant_use_own_rsne_params()
3324 wpa_s->group_cipher = ie.group_cipher; in wpa_supplicant_use_own_rsne_params()
3325 wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_GROUP, wpa_s->group_cipher); in wpa_supplicant_use_own_rsne_params()
3327 wpa_cipher_txt(wpa_s->group_cipher)); in wpa_supplicant_use_own_rsne_params()
3331 if (ssid->group_mgmt_cipher) in wpa_supplicant_use_own_rsne_params()
3332 sel &= ssid->group_mgmt_cipher; in wpa_supplicant_use_own_rsne_params()
3336 ie.mgmt_group_cipher, ssid->group_mgmt_cipher, sel); in wpa_supplicant_use_own_rsne_params()
3341 "WPA: STA/AP is not MFP capable; AP RSNE caps 0x%x", in wpa_supplicant_use_own_rsne_params()
3349 return -1; in wpa_supplicant_use_own_rsne_params()
3352 wpa_s->mgmt_group_cipher = ie.mgmt_group_cipher; in wpa_supplicant_use_own_rsne_params()
3353 wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_MGMT_GROUP, in wpa_supplicant_use_own_rsne_params()
3354 wpa_s->mgmt_group_cipher); in wpa_supplicant_use_own_rsne_params()
3355 if (wpa_s->mgmt_group_cipher) in wpa_supplicant_use_own_rsne_params()
3357 wpa_cipher_txt(wpa_s->mgmt_group_cipher)); in wpa_supplicant_use_own_rsne_params()
3374 wpa_s->ssid_verified = false; in wpa_supplicant_event_associnfo()
3375 wpa_s->bigtk_set = false; in wpa_supplicant_event_associnfo()
3380 if (wpa_s->sme.sae.state == SAE_ACCEPTED && wpa_s->sme.sae.h2e) in wpa_supplicant_event_associnfo()
3381 wpa_s->ssid_verified = true; in wpa_supplicant_event_associnfo()
3385 if (data->assoc_info.req_ies) in wpa_supplicant_event_associnfo()
3386 wpa_hexdump(MSG_DEBUG, "req_ies", data->assoc_info.req_ies, in wpa_supplicant_event_associnfo()
3387 data->assoc_info.req_ies_len); in wpa_supplicant_event_associnfo()
3388 if (data->assoc_info.resp_ies) { in wpa_supplicant_event_associnfo()
3389 wpa_hexdump(MSG_DEBUG, "resp_ies", data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3390 data->assoc_info.resp_ies_len); in wpa_supplicant_event_associnfo()
3392 wpa_tdls_assoc_resp_ies(wpa_s->wpa, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3393 data->assoc_info.resp_ies_len); in wpa_supplicant_event_associnfo()
3396 wnm_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3397 data->assoc_info.resp_ies_len); in wpa_supplicant_event_associnfo()
3399 interworking_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3400 data->assoc_info.resp_ies_len); in wpa_supplicant_event_associnfo()
3401 if (wpa_s->hw_capab == CAPAB_VHT && in wpa_supplicant_event_associnfo()
3402 get_ie(data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3403 data->assoc_info.resp_ies_len, WLAN_EID_VHT_CAP)) in wpa_supplicant_event_associnfo()
3404 wpa_s->ieee80211ac = 1; in wpa_supplicant_event_associnfo()
3406 multi_ap_process_assoc_resp(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3407 data->assoc_info.resp_ies_len); in wpa_supplicant_event_associnfo()
3409 if (data->assoc_info.beacon_ies) in wpa_supplicant_event_associnfo()
3411 data->assoc_info.beacon_ies, in wpa_supplicant_event_associnfo()
3412 data->assoc_info.beacon_ies_len); in wpa_supplicant_event_associnfo()
3413 if (data->assoc_info.freq) in wpa_supplicant_event_associnfo()
3415 data->assoc_info.freq); in wpa_supplicant_event_associnfo()
3417 wpa_s->connection_set = 0; in wpa_supplicant_event_associnfo()
3418 if (data->assoc_info.req_ies && data->assoc_info.resp_ies) { in wpa_supplicant_event_associnfo()
3421 if (ieee802_11_parse_elems(data->assoc_info.req_ies, in wpa_supplicant_event_associnfo()
3422 data->assoc_info.req_ies_len, in wpa_supplicant_event_associnfo()
3424 ieee802_11_parse_elems(data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3425 data->assoc_info.resp_ies_len, in wpa_supplicant_event_associnfo()
3427 wpa_s->connection_set = 1; in wpa_supplicant_event_associnfo()
3428 wpa_s->connection_ht = req_elems.ht_capabilities && in wpa_supplicant_event_associnfo()
3433 wpa_s->connection_vht = req_elems.vht_capabilities && in wpa_supplicant_event_associnfo()
3435 (!data->assoc_info.freq || in wpa_supplicant_event_associnfo()
3436 wpas_freq_to_band(data->assoc_info.freq) != in wpa_supplicant_event_associnfo()
3438 wpa_s->connection_he = req_elems.he_capabilities && in wpa_supplicant_event_associnfo()
3440 wpa_s->connection_eht = req_elems.eht_capabilities && in wpa_supplicant_event_associnfo()
3443 wpa_s->rrm.rrm_used = 1; in wpa_supplicant_event_associnfo()
3447 p = data->assoc_info.req_ies; in wpa_supplicant_event_associnfo()
3448 l = data->assoc_info.req_ies_len; in wpa_supplicant_event_associnfo()
3464 if (wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, p, len)) in wpa_supplicant_event_associnfo()
3468 data->assoc_info.authorized); in wpa_supplicant_event_associnfo()
3471 if (wpa_sm_set_assoc_rsnxe(wpa_s->wpa, p, len)) in wpa_supplicant_event_associnfo()
3475 l -= len; in wpa_supplicant_event_associnfo()
3478 if (!found && data->assoc_info.req_ies) in wpa_supplicant_event_associnfo()
3479 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
3480 if (!found_x && data->assoc_info.req_ies) in wpa_supplicant_event_associnfo()
3481 wpa_sm_set_assoc_rsnxe(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
3485 if (wpa_s->sme.auth_alg == WPA_AUTH_ALG_FILS || in wpa_supplicant_event_associnfo()
3486 wpa_s->sme.auth_alg == WPA_AUTH_ALG_FILS_SK_PFS) { in wpa_supplicant_event_associnfo()
3487 if (!data->assoc_info.resp_frame || in wpa_supplicant_event_associnfo()
3488 fils_process_assoc_resp(wpa_s->wpa, in wpa_supplicant_event_associnfo()
3489 data->assoc_info.resp_frame, in wpa_supplicant_event_associnfo()
3490 data->assoc_info.resp_frame_len) < in wpa_supplicant_event_associnfo()
3494 return -1; in wpa_supplicant_event_associnfo()
3500 wpa_s->ssid_verified = true; in wpa_supplicant_event_associnfo()
3505 if (wpa_s->auth_alg == WPA_AUTH_ALG_FILS && in wpa_supplicant_event_associnfo()
3506 !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) in wpa_supplicant_event_associnfo()
3507 wpa_sm_set_reset_fils_completed(wpa_s->wpa, 1); in wpa_supplicant_event_associnfo()
3511 if (wpa_s->key_mgmt == WPA_KEY_MGMT_OWE && in wpa_supplicant_event_associnfo()
3512 !(wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA) && in wpa_supplicant_event_associnfo()
3514 owe_process_assoc_resp(wpa_s->wpa, in wpa_supplicant_event_associnfo()
3515 wpa_s->valid_links ? in wpa_supplicant_event_associnfo()
3516 wpa_s->ap_mld_addr : bssid, in wpa_supplicant_event_associnfo()
3517 data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3518 data->assoc_info.resp_ies_len) < 0)) { in wpa_supplicant_event_associnfo()
3520 return -1; in wpa_supplicant_event_associnfo()
3525 wpa_sm_set_dpp_z(wpa_s->wpa, NULL); in wpa_supplicant_event_associnfo()
3526 if (DPP_VERSION > 1 && wpa_s->key_mgmt == WPA_KEY_MGMT_DPP && in wpa_supplicant_event_associnfo()
3527 wpa_s->dpp_pfs) { in wpa_supplicant_event_associnfo()
3530 if (ieee802_11_parse_elems(data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3531 data->assoc_info.resp_ies_len, in wpa_supplicant_event_associnfo()
3535 if (dpp_pfs_process(wpa_s->dpp_pfs, elems.owe_dh, in wpa_supplicant_event_associnfo()
3539 return -1; in wpa_supplicant_event_associnfo()
3542 wpa_sm_set_dpp_z(wpa_s->wpa, wpa_s->dpp_pfs->secret); in wpa_supplicant_event_associnfo()
3549 if (wpa_s->sme.auth_alg == WPA_AUTH_ALG_FT) { in wpa_supplicant_event_associnfo()
3551 wpa_ft_validate_reassoc_resp(wpa_s->wpa, in wpa_supplicant_event_associnfo()
3552 data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3553 data->assoc_info.resp_ies_len, in wpa_supplicant_event_associnfo()
3559 return -1; in wpa_supplicant_event_associnfo()
3561 /* SSID is included in PMK-R0 derivation, so it is verified in wpa_supplicant_event_associnfo()
3563 wpa_s->ssid_verified = true; in wpa_supplicant_event_associnfo()
3566 p = data->assoc_info.resp_ies; in wpa_supplicant_event_associnfo()
3567 l = data->assoc_info.resp_ies_len; in wpa_supplicant_event_associnfo()
3570 if (p && wpa_s->current_ssid && in wpa_supplicant_event_associnfo()
3571 wpa_s->current_ssid->key_mgmt == WPA_KEY_MGMT_WPS) { in wpa_supplicant_event_associnfo()
3575 wpa_msg(wpa_s, MSG_INFO, "WPS-STRICT: AP did not " in wpa_supplicant_event_associnfo()
3577 return -1; in wpa_supplicant_event_associnfo()
3584 return -1; in wpa_supplicant_event_associnfo()
3600 wpa_s->sme.ft_used = 1; in wpa_supplicant_event_associnfo()
3601 os_memcpy(wpa_s->sme.mobility_domain, p + 2, in wpa_supplicant_event_associnfo()
3605 l -= len; in wpa_supplicant_event_associnfo()
3611 if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) && in wpa_supplicant_event_associnfo()
3612 wpa_ft_is_completed(wpa_s->wpa)) { in wpa_supplicant_event_associnfo()
3614 wpa_ft_validate_reassoc_resp(wpa_s->wpa, in wpa_supplicant_event_associnfo()
3615 data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3616 data->assoc_info.resp_ies_len, in wpa_supplicant_event_associnfo()
3622 return -1; in wpa_supplicant_event_associnfo()
3625 /* SSID is included in PMK-R0 derivation, so it is verified in wpa_supplicant_event_associnfo()
3627 wpa_s->ssid_verified = true; in wpa_supplicant_event_associnfo()
3630 wpa_sm_set_ft_params(wpa_s->wpa, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3631 data->assoc_info.resp_ies_len); in wpa_supplicant_event_associnfo()
3637 data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3638 data->assoc_info.resp_ies_len); in wpa_supplicant_event_associnfo()
3642 p = data->assoc_info.beacon_ies; in wpa_supplicant_event_associnfo()
3643 l = data->assoc_info.beacon_ies_len; in wpa_supplicant_event_associnfo()
3659 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, p, len); in wpa_supplicant_event_associnfo()
3665 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, p, len); in wpa_supplicant_event_associnfo()
3669 wpa_sm_set_ap_rsnxe(wpa_s->wpa, p, len); in wpa_supplicant_event_associnfo()
3671 l -= len; in wpa_supplicant_event_associnfo()
3675 if (!wpa_found && data->assoc_info.beacon_ies) in wpa_supplicant_event_associnfo()
3676 wpa_sm_set_ap_wpa_ie(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
3677 if (!rsn_found && data->assoc_info.beacon_ies) { in wpa_supplicant_event_associnfo()
3678 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
3679 wpa_sm_set_ap_rsnxe(wpa_s->wpa, NULL, 0); in wpa_supplicant_event_associnfo()
3682 wpa_s->ap_ies_from_associnfo = 1; in wpa_supplicant_event_associnfo()
3684 if (wpa_s->assoc_freq && data->assoc_info.freq) { in wpa_supplicant_event_associnfo()
3691 freq = bss->freq; in wpa_supplicant_event_associnfo()
3693 if (freq != data->assoc_info.freq) { in wpa_supplicant_event_associnfo()
3696 wpa_s->assoc_freq, data->assoc_info.freq); in wpa_supplicant_event_associnfo()
3701 wpa_s->assoc_freq = data->assoc_info.freq; in wpa_supplicant_event_associnfo()
3704 wpas_handle_assoc_resp_qos_mgmt(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_associnfo()
3705 data->assoc_info.resp_ies_len); in wpa_supplicant_event_associnfo()
3716 if (!wpa_s->current_bss || !wpa_s->current_ssid) in wpa_supplicant_assoc_update_ie()
3717 return -1; in wpa_supplicant_assoc_update_ie()
3719 if (!wpa_key_mgmt_wpa_any(wpa_s->current_ssid->key_mgmt)) in wpa_supplicant_assoc_update_ie()
3722 bss_wpa = wpa_bss_get_vendor_ie(wpa_s->current_bss, in wpa_supplicant_assoc_update_ie()
3724 bss_rsn = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_RSN); in wpa_supplicant_assoc_update_ie()
3725 bss_rsnx = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_RSNX); in wpa_supplicant_assoc_update_ie()
3727 if (wpa_sm_set_ap_wpa_ie(wpa_s->wpa, bss_wpa, in wpa_supplicant_assoc_update_ie()
3729 wpa_sm_set_ap_rsn_ie(wpa_s->wpa, bss_rsn, in wpa_supplicant_assoc_update_ie()
3731 wpa_sm_set_ap_rsnxe(wpa_s->wpa, bss_rsnx, in wpa_supplicant_assoc_update_ie()
3733 return -1; in wpa_supplicant_assoc_update_ie()
3743 struct assoc_info *ai = data ? &data->assoc_info : NULL; in wpas_fst_update_mb_assoc()
3744 struct wpa_bss *bss = wpa_s->current_bss; in wpas_fst_update_mb_assoc()
3747 wpabuf_free(wpa_s->received_mb_ies); in wpas_fst_update_mb_assoc()
3748 wpa_s->received_mb_ies = NULL; in wpas_fst_update_mb_assoc()
3751 !wpas_fst_update_mbie(wpa_s, ai->resp_ies, ai->resp_ies_len)) { in wpas_fst_update_mb_assoc()
3758 !wpas_fst_update_mbie(wpa_s, ai->beacon_ies, ai->beacon_ies_len)) { in wpas_fst_update_mb_assoc()
3768 iebcn = ieprb + bss->ie_len; in wpas_fst_update_mb_assoc()
3770 if (!wpas_fst_update_mbie(wpa_s, ieprb, bss->ie_len)) in wpas_fst_update_mb_assoc()
3772 else if (!wpas_fst_update_mbie(wpa_s, iebcn, bss->beacon_ie_len)) in wpas_fst_update_mb_assoc()
3796 if (!wpa_s->valid_links || !elems->basic_mle || !elems->basic_mle_len) in wpas_ml_parse_assoc()
3799 mlbuf = ieee802_11_defrag(elems->basic_mle, elems->basic_mle_len, true); in wpas_ml_parse_assoc()
3810 ml_control = le_to_host16(ml->ml_control); in wpas_ml_parse_assoc()
3847 common_info = (struct eht_ml_basic_common_info *) ml->variable; in wpas_ml_parse_assoc()
3848 if (common_info->len != expected_common_info_len) { in wpas_ml_parse_assoc()
3851 common_info->len, expected_common_info_len); in wpas_ml_parse_assoc()
3856 MAC2STR(common_info->mld_addr)); in wpas_ml_parse_assoc()
3858 if (!ether_addr_equal(wpa_s->ap_mld_addr, common_info->mld_addr)) { in wpas_ml_parse_assoc()
3860 MACSTR ")", MAC2STR(wpa_s->ap_mld_addr)); in wpas_ml_parse_assoc()
3864 pos = common_info->variable; in wpas_ml_parse_assoc()
3893 pos = ((u8 *) common_info) + common_info->len; in wpas_ml_parse_assoc()
3894 ml_len -= sizeof(*ml) + common_info->len; in wpas_ml_parse_assoc()
3904 if (sub_elem_len > ml_len - 2) { in wpas_ml_parse_assoc()
3920 ml_len -= 2 + sub_elem_len; in wpas_ml_parse_assoc()
3932 ml_len -= 2; in wpas_ml_parse_assoc()
3934 if (end - pos < 2) in wpas_ml_parse_assoc()
3941 ml_len -= 2; in wpas_ml_parse_assoc()
3987 if (sta_info_len > ml_len || sta_info_len > end - pos || in wpas_ml_parse_assoc()
4005 ml_len -= sta_info_len; in wpas_ml_parse_assoc()
4010 sub_elem_len -= sta_info_len + 2; in wpas_ml_parse_assoc()
4020 ml_len -= sub_elem_len; in wpas_ml_parse_assoc()
4043 return -1; in wpa_drv_get_mlo_info()
4046 if (wpa_s->valid_links == mlo.valid_links) { in wpa_drv_get_mlo_info()
4053 if (!ether_addr_equal(wpa_s->links[i].addr, in wpa_drv_get_mlo_info()
4055 !ether_addr_equal(wpa_s->links[i].bssid, in wpa_drv_get_mlo_info()
4062 if (match && wpa_s->mlo_assoc_link_id == mlo.assoc_link_id && in wpa_drv_get_mlo_info()
4063 ether_addr_equal(wpa_s->ap_mld_addr, mlo.ap_mld_addr)) in wpa_drv_get_mlo_info()
4067 wpa_s->valid_links = mlo.valid_links; in wpa_drv_get_mlo_info()
4068 wpa_s->mlo_assoc_link_id = mlo.assoc_link_id; in wpa_drv_get_mlo_info()
4069 os_memcpy(wpa_s->ap_mld_addr, mlo.ap_mld_addr, ETH_ALEN); in wpa_drv_get_mlo_info()
4070 for_each_link(wpa_s->valid_links, i) { in wpa_drv_get_mlo_info()
4071 os_memcpy(wpa_s->links[i].addr, mlo.links[i].addr, ETH_ALEN); in wpa_drv_get_mlo_info()
4072 os_memcpy(wpa_s->links[i].bssid, mlo.links[i].bssid, ETH_ALEN); in wpa_drv_get_mlo_info()
4073 wpa_s->links[i].freq = mlo.links[i].freq; in wpa_drv_get_mlo_info()
4091 return -1; in wpa_sm_set_ml_info()
4110 return -1; in wpa_sm_set_ml_info()
4128 return wpa_sm_set_mlo_params(wpa_s->wpa, &wpa_mlo); in wpa_sm_set_ml_info()
4143 if (wpa_s->ap_iface) { in wpa_supplicant_event_assoc()
4146 hostapd_notif_assoc(wpa_s->ap_iface->bss[0], in wpa_supplicant_event_assoc()
4147 data->assoc_info.addr, in wpa_supplicant_event_assoc()
4148 data->assoc_info.req_ies, in wpa_supplicant_event_assoc()
4149 data->assoc_info.req_ies_len, NULL, 0, in wpa_supplicant_event_assoc()
4150 NULL, data->assoc_info.reassoc); in wpa_supplicant_event_assoc()
4156 wpa_s->own_reconnect_req = 0; in wpa_supplicant_event_assoc()
4158 ft_completed = wpa_ft_is_completed(wpa_s->wpa); in wpa_supplicant_event_assoc()
4175 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_BSS_SELECTION)) { in wpa_supplicant_event_assoc()
4194 ft_completed = wpa_fils_is_completed(wpa_s->wpa); in wpa_supplicant_event_assoc()
4197 if (!ether_addr_equal(bssid, wpa_s->bssid)) { in wpa_supplicant_event_assoc()
4198 if (os_reltime_initialized(&wpa_s->session_start)) { in wpa_supplicant_event_assoc()
4199 os_reltime_age(&wpa_s->session_start, in wpa_supplicant_event_assoc()
4200 &wpa_s->session_length); in wpa_supplicant_event_assoc()
4201 wpa_s->session_start.sec = 0; in wpa_supplicant_event_assoc()
4202 wpa_s->session_start.usec = 0; in wpa_supplicant_event_assoc()
4206 os_get_reltime(&wpa_s->session_start); in wpa_supplicant_event_assoc()
4212 os_memcpy(wpa_s->bssid, bssid, ETH_ALEN); in wpa_supplicant_event_assoc()
4213 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); in wpa_supplicant_event_assoc()
4226 if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) && in wpa_supplicant_event_assoc()
4232 if (wpa_s->conf->ap_scan == 1 && in wpa_supplicant_event_assoc()
4233 wpa_s->drv_flags & WPA_DRIVER_FLAGS_BSS_SELECTION) { in wpa_supplicant_event_assoc()
4243 * Cache the current AP's BSSID (for non-MLO connection) or MLD address in wpa_supplicant_event_assoc()
4245 * reassociation requests handled by SME-in-wpa_supplicant. in wpa_supplicant_event_assoc()
4247 os_memcpy(wpa_s->sme.prev_bssid, in wpa_supplicant_event_assoc()
4248 wpa_s->valid_links ? wpa_s->ap_mld_addr : bssid, ETH_ALEN); in wpa_supplicant_event_assoc()
4249 wpa_s->sme.prev_bssid_set = 1; in wpa_supplicant_event_assoc()
4250 wpa_s->sme.last_unprot_disconnect.sec = 0; in wpa_supplicant_event_assoc()
4254 if (wpa_s->current_ssid) { in wpa_supplicant_event_assoc()
4259 wpa_supplicant_scard_init(wpa_s, wpa_s->current_ssid); in wpa_supplicant_event_assoc()
4261 wpa_sm_notify_assoc(wpa_s->wpa, bssid); in wpa_supplicant_event_assoc()
4271 if (wpa_s->l2) in wpa_supplicant_event_assoc()
4272 l2_packet_notify_auth_start(wpa_s->l2); in wpa_supplicant_event_assoc()
4274 already_authorized = data && data->assoc_info.authorized; in wpa_supplicant_event_assoc()
4285 eapol_sm_notify_portEnabled(wpa_s->eapol, false); in wpa_supplicant_event_assoc()
4286 eapol_sm_notify_portValid(wpa_s->eapol, false); in wpa_supplicant_event_assoc()
4288 if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || in wpa_supplicant_event_assoc()
4289 wpa_s->key_mgmt == WPA_KEY_MGMT_DPP || in wpa_supplicant_event_assoc()
4290 wpa_s->key_mgmt == WPA_KEY_MGMT_OWE || ft_completed || in wpa_supplicant_event_assoc()
4291 already_authorized || wpa_s->drv_authorized_port) in wpa_supplicant_event_assoc()
4292 eapol_sm_notify_eap_success(wpa_s->eapol, false); in wpa_supplicant_event_assoc()
4294 eapol_sm_notify_portEnabled(wpa_s->eapol, true); in wpa_supplicant_event_assoc()
4295 wpa_s->eapol_received = 0; in wpa_supplicant_event_assoc()
4296 if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE || in wpa_supplicant_event_assoc()
4297 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE || in wpa_supplicant_event_assoc()
4298 (wpa_s->current_ssid && in wpa_supplicant_event_assoc()
4299 wpa_s->current_ssid->mode == WPAS_MODE_IBSS)) { in wpa_supplicant_event_assoc()
4300 if (wpa_s->current_ssid && in wpa_supplicant_event_assoc()
4301 wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE && in wpa_supplicant_event_assoc()
4302 (wpa_s->drv_flags & in wpa_supplicant_event_assoc()
4305 * Set the key after having received joined-IBSS event in wpa_supplicant_event_assoc()
4309 wpa_s->current_ssid); in wpa_supplicant_event_assoc()
4321 * FT protocol completed - make sure EAPOL state machine ends in wpa_supplicant_event_assoc()
4326 eapol_sm_notify_portValid(wpa_s->eapol, true); in wpa_supplicant_event_assoc()
4327 eapol_sm_notify_eap_success(wpa_s->eapol, true); in wpa_supplicant_event_assoc()
4328 } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK) && in wpa_supplicant_event_assoc()
4329 wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) { in wpa_supplicant_event_assoc()
4332 * We are done; the driver will take care of RSN 4-way in wpa_supplicant_event_assoc()
4337 eapol_sm_notify_portValid(wpa_s->eapol, true); in wpa_supplicant_event_assoc()
4338 eapol_sm_notify_eap_success(wpa_s->eapol, true); in wpa_supplicant_event_assoc()
4342 * with the 4-way handshake. in wpa_supplicant_event_assoc()
4347 } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X) && in wpa_supplicant_event_assoc()
4348 wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt)) { in wpa_supplicant_event_assoc()
4350 * The driver will take care of RSN 4-way handshake, so we need in wpa_supplicant_event_assoc()
4354 eapol_sm_notify_portValid(wpa_s->eapol, true); in wpa_supplicant_event_assoc()
4357 wpa_s->last_eapol_matches_bssid = 0; in wpa_supplicant_event_assoc()
4360 if (wpa_s->rsne_override_eapol) { in wpa_supplicant_event_assoc()
4362 "TESTING: RSNE EAPOL-Key msg 2/4 override"); in wpa_supplicant_event_assoc()
4363 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, in wpa_supplicant_event_assoc()
4364 wpabuf_head(wpa_s->rsne_override_eapol), in wpa_supplicant_event_assoc()
4365 wpabuf_len(wpa_s->rsne_override_eapol)); in wpa_supplicant_event_assoc()
4367 if (wpa_s->rsnxe_override_eapol) { in wpa_supplicant_event_assoc()
4369 "TESTING: RSNXE EAPOL-Key msg 2/4 override"); in wpa_supplicant_event_assoc()
4370 wpa_sm_set_assoc_rsnxe(wpa_s->wpa, in wpa_supplicant_event_assoc()
4371 wpabuf_head(wpa_s->rsnxe_override_eapol), in wpa_supplicant_event_assoc()
4372 wpabuf_len(wpa_s->rsnxe_override_eapol)); in wpa_supplicant_event_assoc()
4376 if (wpa_s->pending_eapol_rx) { in wpa_supplicant_event_assoc()
4379 os_reltime_sub(&now, &wpa_s->pending_eapol_rx_time, &age); in wpa_supplicant_event_assoc()
4381 ether_addr_equal(wpa_s->pending_eapol_rx_src, in wpa_supplicant_event_assoc()
4382 wpa_s->valid_links ? wpa_s->ap_mld_addr : in wpa_supplicant_event_assoc()
4388 wpa_s, wpa_s->pending_eapol_rx_src, in wpa_supplicant_event_assoc()
4389 wpabuf_head(wpa_s->pending_eapol_rx), in wpa_supplicant_event_assoc()
4390 wpabuf_len(wpa_s->pending_eapol_rx), in wpa_supplicant_event_assoc()
4391 wpa_s->pending_eapol_encrypted); in wpa_supplicant_event_assoc()
4393 wpabuf_free(wpa_s->pending_eapol_rx); in wpa_supplicant_event_assoc()
4394 wpa_s->pending_eapol_rx = NULL; in wpa_supplicant_event_assoc()
4398 if ((wpa_s->key_mgmt == WPA_KEY_MGMT_NONE || in wpa_supplicant_event_assoc()
4399 wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA) && in wpa_supplicant_event_assoc()
4400 wpa_s->current_ssid && in wpa_supplicant_event_assoc()
4401 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE)) { in wpa_supplicant_event_assoc()
4403 wpa_set_wep_keys(wpa_s, wpa_s->current_ssid); in wpa_supplicant_event_assoc()
4408 if (wpa_s->current_ssid && in wpa_supplicant_event_assoc()
4409 wpa_s->current_ssid->mode == WPAS_MODE_IBSS && in wpa_supplicant_event_assoc()
4410 wpa_s->key_mgmt != WPA_KEY_MGMT_NONE && in wpa_supplicant_event_assoc()
4411 wpa_s->key_mgmt != WPA_KEY_MGMT_WPA_NONE && in wpa_supplicant_event_assoc()
4412 wpa_s->ibss_rsn == NULL) { in wpa_supplicant_event_assoc()
4413 wpa_s->ibss_rsn = ibss_rsn_init(wpa_s, wpa_s->current_ssid); in wpa_supplicant_event_assoc()
4414 if (!wpa_s->ibss_rsn) { in wpa_supplicant_event_assoc()
4421 ibss_rsn_set_psk(wpa_s->ibss_rsn, wpa_s->current_ssid->psk); in wpa_supplicant_event_assoc()
4429 wmm_ac_notify_assoc(wpa_s, data->assoc_info.resp_ies, in wpa_supplicant_event_assoc()
4430 data->assoc_info.resp_ies_len, in wpa_supplicant_event_assoc()
4431 &data->assoc_info.wmm_params); in wpa_supplicant_event_assoc()
4433 if (wpa_s->reassoc_same_bss) in wpa_supplicant_event_assoc()
4442 if (wpa_key_mgmt_fils(wpa_s->key_mgmt)) { in wpa_supplicant_event_assoc()
4446 wpa_sm_set_fils_cache_id(wpa_s->wpa, fils_cache_id); in wpa_supplicant_event_assoc()
4451 wpas_mbo_check_pmf(wpa_s, bss, wpa_s->current_ssid); in wpa_supplicant_event_assoc()
4455 wpa_s->dpp_pfs_fallback = 0; in wpa_supplicant_event_assoc()
4458 if (wpa_s->current_ssid && wpa_s->current_ssid->enable_4addr_mode) in wpa_supplicant_event_assoc()
4477 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) { in wpa_supplicant_event_disassoc()
4481 * IBSS for WPA-None. Ignore them for now. in wpa_supplicant_event_disassoc()
4486 bssid = wpa_s->bssid; in wpa_supplicant_event_disassoc()
4488 bssid = wpa_s->pending_bssid; in wpa_supplicant_event_disassoc()
4491 wpa_s->wpa_state >= WPA_AUTHENTICATING) { in wpa_supplicant_event_disassoc()
4503 if (wpa_s->wpa_state != WPA_4WAY_HANDSHAKE || in could_be_psk_mismatch()
4504 !wpa_s->new_connection || in could_be_psk_mismatch()
4505 !wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt) || in could_be_psk_mismatch()
4506 wpa_key_mgmt_sae(wpa_s->key_mgmt)) in could_be_psk_mismatch()
4507 return 0; /* Not in initial 4-way handshake with PSK */ in could_be_psk_mismatch()
4511 * 4-way handshake. Filter out known disconnection cases that are caused in could_be_psk_mismatch()
4533 if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) { in wpa_supplicant_event_disassoc_finish()
4537 * IBSS for WPA-None. Ignore them for now. in wpa_supplicant_event_disassoc_finish()
4539 wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - ignore in " in wpa_supplicant_event_disassoc_finish()
4540 "IBSS/WPA-None mode"); in wpa_supplicant_event_disassoc_finish()
4544 if (!wpa_s->disconnected && wpa_s->wpa_state >= WPA_AUTHENTICATING && in wpa_supplicant_event_disassoc_finish()
4550 * mac80211-based drivers use the in wpa_supplicant_event_disassoc_finish()
4555 curr = wpa_s->current_bss; in wpa_supplicant_event_disassoc_finish()
4558 wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - " in wpa_supplicant_event_disassoc_finish()
4559 "pre-shared key may be incorrect"); in wpa_supplicant_event_disassoc_finish()
4562 wpas_auth_failed(wpa_s, "WRONG_KEY", wpa_s->pending_bssid); in wpa_supplicant_event_disassoc_finish()
4569 if (!wpa_s->disconnected && in wpa_supplicant_event_disassoc_finish()
4570 (!wpa_s->auto_reconnect_disabled || in wpa_supplicant_event_disassoc_finish()
4571 wpa_s->key_mgmt == WPA_KEY_MGMT_WPS || in wpa_supplicant_event_disassoc_finish()
4576 wpa_s->key_mgmt == WPA_KEY_MGMT_WPS, in wpa_supplicant_event_disassoc_finish()
4578 wpa_s->wpa_state); in wpa_supplicant_event_disassoc_finish()
4579 if (wpa_s->wpa_state == WPA_COMPLETED && in wpa_supplicant_event_disassoc_finish()
4580 wpa_s->current_ssid && in wpa_supplicant_event_disassoc_finish()
4581 wpa_s->current_ssid->mode == WPAS_MODE_INFRA && in wpa_supplicant_event_disassoc_finish()
4582 (wpa_s->own_reconnect_req || in wpa_supplicant_event_disassoc_finish()
4593 fast_reconnect = wpa_s->current_bss; in wpa_supplicant_event_disassoc_finish()
4594 fast_reconnect_ssid = wpa_s->current_ssid; in wpa_supplicant_event_disassoc_finish()
4595 } else if (wpa_s->wpa_state >= WPA_ASSOCIATING) { in wpa_supplicant_event_disassoc_finish()
4603 "try to re-connect"); in wpa_supplicant_event_disassoc_finish()
4604 wpa_s->reassociate = 0; in wpa_supplicant_event_disassoc_finish()
4605 wpa_s->disconnected = 1; in wpa_supplicant_event_disassoc_finish()
4606 if (!wpa_s->pno) in wpa_supplicant_event_disassoc_finish()
4609 bssid = wpa_s->bssid; in wpa_supplicant_event_disassoc_finish()
4611 bssid = wpa_s->pending_bssid; in wpa_supplicant_event_disassoc_finish()
4612 if (wpa_s->wpa_state >= WPA_AUTHENTICATING) in wpa_supplicant_event_disassoc_finish()
4614 wpa_sm_notify_disassoc(wpa_s->wpa); in wpa_supplicant_event_disassoc_finish()
4615 ptksa_cache_flush(wpa_s->ptksa, wpa_s->bssid, WPA_CIPHER_NONE); in wpa_supplicant_event_disassoc_finish()
4618 wpa_s->disconnect_reason = -reason_code; in wpa_supplicant_event_disassoc_finish()
4620 wpa_s->disconnect_reason = reason_code; in wpa_supplicant_event_disassoc_finish()
4623 wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - remove keys"); in wpa_supplicant_event_disassoc_finish()
4624 wpa_clear_keys(wpa_s, wpa_s->bssid); in wpa_supplicant_event_disassoc_finish()
4633 !disallowed_bssid(wpa_s, fast_reconnect->bssid) && in wpa_supplicant_event_disassoc_finish()
4634 !disallowed_ssid(wpa_s, fast_reconnect->ssid, in wpa_supplicant_event_disassoc_finish()
4635 fast_reconnect->ssid_len) && in wpa_supplicant_event_disassoc_finish()
4663 if (!wpa_s->pending_mic_error_report) in wpa_supplicant_delayed_mic_error_report()
4667 wpa_sm_key_request(wpa_s->wpa, 1, wpa_s->pending_mic_error_pairwise); in wpa_supplicant_delayed_mic_error_report()
4668 wpa_s->pending_mic_error_report = 0; in wpa_supplicant_delayed_mic_error_report()
4681 pairwise = (data && data->michael_mic_failure.unicast); in wpa_supplicant_event_michael_mic_failure()
4683 if ((os_reltime_initialized(&wpa_s->last_michael_mic_error) && in wpa_supplicant_event_michael_mic_failure()
4684 !os_reltime_expired(&t, &wpa_s->last_michael_mic_error, 60)) || in wpa_supplicant_event_michael_mic_failure()
4685 wpa_s->pending_mic_error_report) { in wpa_supplicant_event_michael_mic_failure()
4686 if (wpa_s->pending_mic_error_report) { in wpa_supplicant_event_michael_mic_failure()
4692 wpa_sm_key_request(wpa_s->wpa, 1, in wpa_supplicant_event_michael_mic_failure()
4693 wpa_s->pending_mic_error_pairwise); in wpa_supplicant_event_michael_mic_failure()
4699 wpa_sm_key_request(wpa_s->wpa, 1, pairwise); in wpa_supplicant_event_michael_mic_failure()
4702 wpa_s->countermeasures = 1; in wpa_supplicant_event_michael_mic_failure()
4704 wpa_bssid_ignore_add(wpa_s, wpa_s->bssid); in wpa_supplicant_event_michael_mic_failure()
4726 if (wpa_s->mic_errors_seen) { in wpa_supplicant_event_michael_mic_failure()
4746 wpa_s->pending_mic_error_report = 1; in wpa_supplicant_event_michael_mic_failure()
4747 wpa_s->pending_mic_error_pairwise = pairwise; in wpa_supplicant_event_michael_mic_failure()
4756 wpa_sm_key_request(wpa_s->wpa, 1, pairwise); in wpa_supplicant_event_michael_mic_failure()
4759 wpa_sm_key_request(wpa_s->wpa, 1, pairwise); in wpa_supplicant_event_michael_mic_failure()
4762 wpa_s->last_michael_mic_error = t; in wpa_supplicant_event_michael_mic_failure()
4763 wpa_s->mic_errors_seen++; in wpa_supplicant_event_michael_mic_failure()
4772 for (wpa_s = head; wpa_s != NULL; wpa_s = wpa_s->next) in any_interfaces()
4773 if (!wpa_s->interface_removed) in any_interfaces()
4784 if (os_strcmp(wpa_s->ifname, data->interface_status.ifname) != 0) in wpa_supplicant_event_interface_status()
4787 switch (data->interface_status.ievent) { in wpa_supplicant_event_interface_status()
4789 if (!wpa_s->interface_removed) in wpa_supplicant_event_interface_status()
4791 wpa_s->interface_removed = 0; in wpa_supplicant_event_interface_status()
4799 if (!wpa_s->global->p2p && in wpa_supplicant_event_interface_status()
4800 !wpa_s->global->p2p_disabled && in wpa_supplicant_event_interface_status()
4801 !wpa_s->conf->p2p_disabled && in wpa_supplicant_event_interface_status()
4802 (wpa_s->drv_flags & in wpa_supplicant_event_interface_status()
4805 wpa_s, wpa_s->global->params.conf_p2p_dev) < 0) { in wpa_supplicant_event_interface_status()
4815 wpa_s->interface_removed = 1; in wpa_supplicant_event_interface_status()
4818 l2_packet_deinit(wpa_s->l2); in wpa_supplicant_event_interface_status()
4819 wpa_s->l2 = NULL; in wpa_supplicant_event_interface_status()
4822 if (wpa_s->global->p2p && in wpa_supplicant_event_interface_status()
4823 wpa_s->global->p2p_init_wpa_s->parent == wpa_s && in wpa_supplicant_event_interface_status()
4824 (wpa_s->drv_flags & in wpa_supplicant_event_interface_status()
4829 wpa_s->global, wpa_s->global->p2p_init_wpa_s, in wpa_supplicant_event_interface_status()
4831 wpa_s->global->p2p_init_wpa_s = NULL; in wpa_supplicant_event_interface_status()
4836 if (wpa_s->matched) { in wpa_supplicant_event_interface_status()
4837 wpa_supplicant_remove_iface(wpa_s->global, wpa_s, 0); in wpa_supplicant_event_interface_status()
4844 if (!any_interfaces(wpa_s->global->ifaces)) in wpa_supplicant_event_interface_status()
4858 switch (data->tdls.oper) { in wpa_supplicant_event_tdls()
4860 wpa_tdls_remove(wpa_s->wpa, data->tdls.peer); in wpa_supplicant_event_tdls()
4861 if (wpa_tdls_is_external_setup(wpa_s->wpa)) in wpa_supplicant_event_tdls()
4862 wpa_tdls_start(wpa_s->wpa, data->tdls.peer); in wpa_supplicant_event_tdls()
4864 wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, data->tdls.peer); in wpa_supplicant_event_tdls()
4867 if (wpa_tdls_is_external_setup(wpa_s->wpa)) in wpa_supplicant_event_tdls()
4868 wpa_tdls_teardown_link(wpa_s->wpa, data->tdls.peer, in wpa_supplicant_event_tdls()
4869 data->tdls.reason_code); in wpa_supplicant_event_tdls()
4872 data->tdls.peer); in wpa_supplicant_event_tdls()
4875 wpa_tdls_send_discovery_request(wpa_s->wpa, in wpa_supplicant_event_tdls()
4876 data->tdls.peer); in wpa_supplicant_event_tdls()
4889 switch (data->wnm.oper) { in wpa_supplicant_event_wnm()
4891 wpa_printf(MSG_DEBUG, "Start sending WNM-Sleep Request " in wpa_supplicant_event_wnm()
4893 data->wnm.sleep_action, data->wnm.sleep_intval); in wpa_supplicant_event_wnm()
4894 ieee802_11_send_wnmsleep_req(wpa_s, data->wnm.sleep_action, in wpa_supplicant_event_wnm()
4895 data->wnm.sleep_intval, NULL); in wpa_supplicant_event_wnm()
4910 if (wpa_ft_process_response(wpa_s->wpa, data->ft_ies.ies, in wpa_supplicant_event_ft_response()
4911 data->ft_ies.ies_len, in wpa_supplicant_event_ft_response()
4912 data->ft_ies.ft_action, in wpa_supplicant_event_ft_response()
4913 data->ft_ies.target_ap, in wpa_supplicant_event_ft_response()
4914 data->ft_ies.ric_ies, in wpa_supplicant_event_ft_response()
4915 data->ft_ies.ric_ies_len) < 0) { in wpa_supplicant_event_ft_response()
4927 if (wpa_s->wpa_state < WPA_ASSOCIATED) in wpa_supplicant_event_ibss_rsn_start()
4931 ssid = wpa_s->current_ssid; in wpa_supplicant_event_ibss_rsn_start()
4934 if (ssid->mode != WPAS_MODE_IBSS || !wpa_key_mgmt_wpa(ssid->key_mgmt)) in wpa_supplicant_event_ibss_rsn_start()
4937 ibss_rsn_start(wpa_s->ibss_rsn, data->ibss_rsn_start.peer); in wpa_supplicant_event_ibss_rsn_start()
4944 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpa_supplicant_event_ibss_auth()
4950 if (ssid->mode != WPAS_MODE_IBSS || !wpa_key_mgmt_wpa(ssid->key_mgmt)) in wpa_supplicant_event_ibss_auth()
4953 ibss_rsn_handle_auth(wpa_s->ibss_rsn, data->rx_mgmt.frame, in wpa_supplicant_event_ibss_auth()
4954 data->rx_mgmt.frame_len); in wpa_supplicant_event_ibss_auth()
4967 if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) in ft_rx_action()
4980 if (!ether_addr_equal(sta_addr, wpa_s->own_addr)) { in ft_rx_action()
4993 if (wpa_ft_process_response(wpa_s->wpa, data + 1 + 2 * ETH_ALEN + 2, in ft_rx_action()
4994 len - (1 + 2 * ETH_ALEN + 2), 1, in ft_rx_action()
5003 wpa_s->sme.freq = bss->freq; in ft_rx_action()
5004 wpa_s->sme.auth_alg = WPA_AUTH_ALG_FT; in ft_rx_action()
5017 "dropped: " MACSTR " -> " MACSTR in wpa_supplicant_event_unprot_deauth()
5019 MAC2STR(e->sa), MAC2STR(e->da), e->reason_code); in wpa_supplicant_event_unprot_deauth()
5020 sme_event_unprot_disconnect(wpa_s, e->sa, e->da, e->reason_code); in wpa_supplicant_event_unprot_deauth()
5028 "dropped: " MACSTR " -> " MACSTR in wpa_supplicant_event_unprot_disassoc()
5030 MAC2STR(e->sa), MAC2STR(e->da), e->reason_code); in wpa_supplicant_event_unprot_disassoc()
5031 sme_event_unprot_disconnect(wpa_s, e->sa, e->da, e->reason_code); in wpa_supplicant_event_unprot_disassoc()
5040 if (wpa_s->ap_iface && addr) { in wpas_event_disconnect()
5041 hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], addr); in wpas_event_disconnect()
5045 if (wpa_s->ap_iface) { in wpas_event_disconnect()
5052 wpa_s->own_disconnect_req = 0; in wpas_event_disconnect()
5057 ((wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt) || in wpas_event_disconnect()
5058 (wpa_s->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)) && in wpas_event_disconnect()
5059 eapol_sm_failed(wpa_s->eapol))) && in wpas_event_disconnect()
5060 !wpa_s->eap_expected_failure)) in wpas_event_disconnect()
5093 addr = info->addr; in wpas_event_disassoc()
5094 ie = info->ie; in wpas_event_disassoc()
5095 ie_len = info->ie_len; in wpas_event_disassoc()
5096 reason_code = info->reason_code; in wpas_event_disassoc()
5097 locally_generated = info->locally_generated; in wpas_event_disassoc()
5109 if (wpa_s->ap_iface && info && info->addr) { in wpas_event_disassoc()
5110 hostapd_notif_disassoc(wpa_s->ap_iface->bss[0], info->addr); in wpas_event_disassoc()
5114 if (wpa_s->ap_iface) { in wpas_event_disassoc()
5123 wpa_s, info->addr, reason_code, info->ie, info->ie_len, in wpas_event_disassoc()
5128 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpas_event_disassoc()
5148 addr = info->addr; in wpas_event_deauth()
5149 ie = info->ie; in wpas_event_deauth()
5150 ie_len = info->ie_len; in wpas_event_deauth()
5151 reason_code = info->reason_code; in wpas_event_deauth()
5152 locally_generated = info->locally_generated; in wpas_event_deauth()
5164 wpa_reset_ft_completed(wpa_s->wpa); in wpas_event_deauth()
5210 if (!attrs->freq) in wpas_beacon_hint()
5214 title, attrs->freq, attrs->max_tx_power, in wpas_beacon_hint()
5215 attrs->disabled ? " disabled=1" : "", in wpas_beacon_hint()
5216 attrs->no_ir ? " no_ir=1" : "", in wpas_beacon_hint()
5217 attrs->radar ? " radar=1" : ""); in wpas_beacon_hint()
5233 for (ifs = wpa_s; ifs->parent && ifs != ifs->parent; ifs = ifs->parent) in wpa_supplicant_update_channel_list()
5239 reg_init_str(info->initiator), reg_type_str(info->type), in wpa_supplicant_update_channel_list()
5240 info->alpha2[0] ? " alpha2=" : "", in wpa_supplicant_update_channel_list()
5241 info->alpha2[0] ? info->alpha2 : ""); in wpa_supplicant_update_channel_list()
5243 if (info->initiator == REGDOM_BEACON_HINT) { in wpa_supplicant_update_channel_list()
5245 &info->beacon_hint_before); in wpa_supplicant_update_channel_list()
5247 &info->beacon_hint_after); in wpa_supplicant_update_channel_list()
5251 if (wpa_s->drv_priv == NULL) in wpa_supplicant_update_channel_list()
5254 dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant, in wpa_supplicant_update_channel_list()
5259 ifs->ifname); in wpa_supplicant_update_channel_list()
5261 ifs->hw.modes = wpa_drv_get_hw_feature_data( in wpa_supplicant_update_channel_list()
5262 ifs, &ifs->hw.num_modes, &ifs->hw.flags, &dfs_domain); in wpa_supplicant_update_channel_list()
5264 was_6ghz_enabled = ifs->is_6ghz_enabled; in wpa_supplicant_update_channel_list()
5265 ifs->is_6ghz_enabled = wpas_is_6ghz_supported(ifs, true); in wpa_supplicant_update_channel_list()
5268 if (ifs->pno) { in wpa_supplicant_update_channel_list()
5271 } else if (ifs->sched_scanning && !ifs->pno_sched_pending) { in wpa_supplicant_update_channel_list()
5273 "Channel list changed - restart sched_scan"); in wpa_supplicant_update_channel_list()
5275 } else if (!was_6ghz_enabled && ifs->is_6ghz_enabled) { in wpa_supplicant_update_channel_list()
5279 ifs->crossed_6ghz_dom = true; in wpa_supplicant_update_channel_list()
5302 plen = len - IEEE80211_HDRLEN - 1; in wpas_event_rx_mgmt_action()
5306 MAC2STR(mgmt->sa), category, (int) plen, freq); in wpas_event_rx_mgmt_action()
5310 wmm_ac_rx_action(wpa_s, mgmt->da, mgmt->sa, payload, plen); in wpas_event_rx_mgmt_action()
5324 sme_sa_query_rx(wpa_s, mgmt->da, mgmt->sa, payload, plen); in wpas_event_rx_mgmt_action()
5330 if (mgmt->u.action.category == WLAN_ACTION_WNM) { in wpas_event_rx_mgmt_action()
5337 if ((mgmt->u.action.category == WLAN_ACTION_PUBLIC || in wpas_event_rx_mgmt_action()
5338 mgmt->u.action.category == WLAN_ACTION_PROTECTED_DUAL) && in wpas_event_rx_mgmt_action()
5339 gas_query_rx(wpa_s->gas, mgmt->da, mgmt->sa, mgmt->bssid, in wpas_event_rx_mgmt_action()
5340 mgmt->u.action.category, in wpas_event_rx_mgmt_action()
5346 if ((mgmt->u.action.category == WLAN_ACTION_PUBLIC || in wpas_event_rx_mgmt_action()
5347 mgmt->u.action.category == WLAN_ACTION_PROTECTED_DUAL) && in wpas_event_rx_mgmt_action()
5348 gas_server_rx(wpa_s->gas_server, mgmt->da, mgmt->sa, mgmt->bssid, in wpas_event_rx_mgmt_action()
5349 mgmt->u.action.category, in wpas_event_rx_mgmt_action()
5359 MAC2STR(mgmt->sa)); in wpas_event_rx_mgmt_action()
5360 if (wpa_s->valid_links && in wpas_event_rx_mgmt_action()
5361 wpa_tdls_process_discovery_response(wpa_s->wpa, mgmt->sa, in wpas_event_rx_mgmt_action()
5362 &payload[1], plen - 1)) in wpas_event_rx_mgmt_action()
5365 MACSTR, MAC2STR(mgmt->sa)); in wpas_event_rx_mgmt_action()
5374 size_t qlen = plen - 1; in wpas_event_rx_mgmt_action()
5376 MACSTR, MAC2STR(mgmt->sa)); in wpas_event_rx_mgmt_action()
5377 if (ether_addr_equal(mgmt->sa, wpa_s->bssid) && in wpas_event_rx_mgmt_action()
5379 pos[1] <= qlen - 2 && pos[1] >= 16) in wpas_event_rx_mgmt_action()
5388 wpas_rrm_handle_radio_measurement_request(wpa_s, mgmt->sa, in wpas_event_rx_mgmt_action()
5389 mgmt->da, in wpas_event_rx_mgmt_action()
5391 plen - 1); in wpas_event_rx_mgmt_action()
5397 wpas_rrm_process_neighbor_rep(wpa_s, payload + 1, plen - 1); in wpas_event_rx_mgmt_action()
5403 wpas_rrm_handle_link_measurement_request(wpa_s, mgmt->sa, in wpas_event_rx_mgmt_action()
5404 payload + 1, plen - 1, in wpas_event_rx_mgmt_action()
5411 if (mgmt->u.action.category == WLAN_ACTION_FST && wpa_s->fst) { in wpas_event_rx_mgmt_action()
5412 fst_rx_action(wpa_s->fst, mgmt, len); in wpas_event_rx_mgmt_action()
5422 plen -= 5; in wpas_event_rx_mgmt_action()
5423 wpas_nan_usd_rx_sdf(wpa_s, mgmt->sa, freq, payload, plen); in wpas_event_rx_mgmt_action()
5434 plen--; in wpas_event_rx_mgmt_action()
5435 wpas_dpp_rx_action(wpa_s, mgmt->sa, payload, plen, freq); in wpas_event_rx_mgmt_action()
5443 wpas_handle_robust_av_scs_recv_action(wpa_s, mgmt->sa, in wpas_event_rx_mgmt_action()
5444 payload + 1, plen - 1); in wpas_event_rx_mgmt_action()
5450 wpas_handle_robust_av_recv_action(wpa_s, mgmt->sa, in wpas_event_rx_mgmt_action()
5451 payload + 1, plen - 1); in wpas_event_rx_mgmt_action()
5457 wpas_handle_qos_mgmt_recv_action(wpa_s, mgmt->sa, in wpas_event_rx_mgmt_action()
5458 payload + 4, plen - 4); in wpas_event_rx_mgmt_action()
5463 wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid, in wpas_event_rx_mgmt_action()
5465 if (wpa_s->ifmsh) in wpas_event_rx_mgmt_action()
5476 list = &event->freq_range; in wpa_supplicant_notify_avoid_freq()
5478 if (list->num) in wpa_supplicant_notify_avoid_freq()
5484 if (freq_range_list_parse(&wpa_s->global->p2p_go_avoid_freq, str)) { in wpa_supplicant_notify_avoid_freq()
5505 if (wpa_s->wpa_state == WPA_ASSOCIATED) { in wpa_supplicant_event_port_authorized()
5508 eapol_sm_notify_portValid(wpa_s->eapol, true); in wpa_supplicant_event_port_authorized()
5509 eapol_sm_notify_eap_success(wpa_s->eapol, true); in wpa_supplicant_event_port_authorized()
5510 wpa_s->drv_authorized_port = 1; in wpa_supplicant_event_port_authorized()
5521 for (i = 0; i < wpa_s->hw.num_modes; i++) { in wpas_event_cac_ms()
5522 const struct hostapd_hw_modes *mode = &wpa_s->hw.modes[i]; in wpas_event_cac_ms()
5524 for (j = 0; j < mode->num_channels; j++) { in wpas_event_cac_ms()
5527 chan = &mode->channels[j]; in wpas_event_cac_ms()
5528 if (chan->freq == freq) in wpas_event_cac_ms()
5529 return chan->dfs_cac_ms; in wpas_event_cac_ms()
5541 if (wpa_s->ap_iface || wpa_s->ifmsh) { in wpas_event_dfs_cac_started()
5546 unsigned int cac_time = wpas_event_cac_ms(wpa_s, radar->freq); in wpas_event_dfs_cac_started()
5562 if (wpa_s->ap_iface || wpa_s->ifmsh) { in wpas_event_dfs_cac_finished()
5578 if (wpa_s->ap_iface || wpa_s->ifmsh) { in wpas_event_dfs_cac_aborted()
5595 wpa_s->wpa_state); in wpa_supplicant_event_assoc_auth()
5599 wpa_s->last_eapol_matches_bssid = 1; in wpa_supplicant_event_assoc_auth()
5601 wpa_sm_set_rx_replay_ctr(wpa_s->wpa, data->assoc_info.key_replay_ctr); in wpa_supplicant_event_assoc_auth()
5602 wpa_sm_set_ptk_kck_kek(wpa_s->wpa, data->assoc_info.ptk_kck, in wpa_supplicant_event_assoc_auth()
5603 data->assoc_info.ptk_kck_len, in wpa_supplicant_event_assoc_auth()
5604 data->assoc_info.ptk_kek, in wpa_supplicant_event_assoc_auth()
5605 data->assoc_info.ptk_kek_len); in wpa_supplicant_event_assoc_auth()
5607 if (wpa_s->auth_alg == WPA_AUTH_ALG_FILS) { in wpa_supplicant_event_assoc_auth()
5608 struct wpa_bss *bss = wpa_bss_get_bssid(wpa_s, wpa_s->bssid); in wpa_supplicant_event_assoc_auth()
5613 wpa_s->eapol, data->assoc_info.fils_erp_next_seq_num); in wpa_supplicant_event_assoc_auth()
5615 if (data->assoc_info.fils_pmk && data->assoc_info.fils_pmkid) { in wpa_supplicant_event_assoc_auth()
5617 wpa_sm_pmksa_cache_add(wpa_s->wpa, in wpa_supplicant_event_assoc_auth()
5618 data->assoc_info.fils_pmk, in wpa_supplicant_event_assoc_auth()
5619 data->assoc_info.fils_pmk_len, in wpa_supplicant_event_assoc_auth()
5620 data->assoc_info.fils_pmkid, in wpa_supplicant_event_assoc_auth()
5621 wpa_s->valid_links ? in wpa_supplicant_event_assoc_auth()
5622 wpa_s->ap_mld_addr : in wpa_supplicant_event_assoc_auth()
5623 wpa_s->bssid, in wpa_supplicant_event_assoc_auth()
5625 } else if (data->assoc_info.fils_pmkid) { in wpa_supplicant_event_assoc_auth()
5627 pmksa_cache_set_current(wpa_s->wpa, in wpa_supplicant_event_assoc_auth()
5628 data->assoc_info.fils_pmkid, in wpa_supplicant_event_assoc_auth()
5664 const u8 *bssid = data->assoc_reject.bssid; in wpas_event_assoc_reject()
5673 bssid = wpa_s->pending_bssid; in wpas_event_assoc_reject()
5675 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpas_event_assoc_reject()
5676 reject_bss = wpa_s->current_bss; in wpas_event_assoc_reject()
5681 if (data->assoc_reject.bssid) in wpas_event_assoc_reject()
5684 MAC2STR(data->assoc_reject.bssid), in wpas_event_assoc_reject()
5685 data->assoc_reject.status_code, in wpas_event_assoc_reject()
5686 data->assoc_reject.timed_out ? " timeout" : "", in wpas_event_assoc_reject()
5687 data->assoc_reject.timeout_reason ? "=" : "", in wpas_event_assoc_reject()
5688 data->assoc_reject.timeout_reason ? in wpas_event_assoc_reject()
5689 data->assoc_reject.timeout_reason : "", in wpas_event_assoc_reject()
5690 data->assoc_reject.reason_code != in wpas_event_assoc_reject()
5693 connect_fail_reason(data->assoc_reject.reason_code)); in wpas_event_assoc_reject()
5697 data->assoc_reject.status_code, in wpas_event_assoc_reject()
5698 data->assoc_reject.timed_out ? " timeout" : "", in wpas_event_assoc_reject()
5699 data->assoc_reject.timeout_reason ? "=" : "", in wpas_event_assoc_reject()
5700 data->assoc_reject.timeout_reason ? in wpas_event_assoc_reject()
5701 data->assoc_reject.timeout_reason : "", in wpas_event_assoc_reject()
5702 data->assoc_reject.reason_code != in wpas_event_assoc_reject()
5705 connect_fail_reason(data->assoc_reject.reason_code)); in wpas_event_assoc_reject()
5706 wpa_s->assoc_status_code = data->assoc_reject.status_code; in wpas_event_assoc_reject()
5710 if (data->assoc_reject.status_code == in wpas_event_assoc_reject()
5712 wpa_s->key_mgmt == WPA_KEY_MGMT_OWE && in wpas_event_assoc_reject()
5713 wpa_s->current_ssid && in wpas_event_assoc_reject()
5714 wpa_s->current_ssid->owe_group == 0 && in wpas_event_assoc_reject()
5715 wpa_s->last_owe_group != 21) { in wpas_event_assoc_reject()
5716 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpas_event_assoc_reject()
5717 struct wpa_bss *bss = wpa_s->current_bss; in wpas_event_assoc_reject()
5740 if (DPP_VERSION > 1 && wpa_s->current_ssid && in wpas_event_assoc_reject()
5741 (wpa_s->current_ssid->key_mgmt == WPA_KEY_MGMT_DPP || in wpas_event_assoc_reject()
5742 ((wpa_s->current_ssid->key_mgmt & WPA_KEY_MGMT_DPP) && in wpas_event_assoc_reject()
5743 wpa_s->key_mgmt == WPA_KEY_MGMT_DPP)) && in wpas_event_assoc_reject()
5744 wpa_s->current_ssid->dpp_pfs == 0 && in wpas_event_assoc_reject()
5745 (data->assoc_reject.status_code == in wpas_event_assoc_reject()
5747 data->assoc_reject.status_code == WLAN_STATUS_AKMP_NOT_VALID)) { in wpas_event_assoc_reject()
5748 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpas_event_assoc_reject()
5749 struct wpa_bss *bss = wpa_s->current_bss; in wpas_event_assoc_reject()
5751 wpa_s->current_ssid->dpp_pfs_fallback ^= 1; in wpas_event_assoc_reject()
5754 if (!bss || wpa_s->dpp_pfs_fallback) { in wpas_event_assoc_reject()
5762 wpa_s->dpp_pfs_fallback = 1; in wpas_event_assoc_reject()
5771 if (data->assoc_reject.status_code == in wpas_event_assoc_reject()
5773 reject_bss && data->assoc_reject.resp_ies) { in wpas_event_assoc_reject()
5777 data->assoc_reject.resp_ies, in wpas_event_assoc_reject()
5778 data->assoc_reject.resp_ies_len, in wpas_event_assoc_reject()
5782 "OCE: RSSI-based association rejection from " in wpas_event_assoc_reject()
5784 MAC2STR(reject_bss->bssid), in wpas_event_assoc_reject()
5787 reject_bss->bssid, in wpas_event_assoc_reject()
5789 rssi_rej[2] + reject_bss->level); in wpas_event_assoc_reject()
5796 if (ieee802_11_parse_elems(data->assoc_reject.resp_ies, in wpas_event_assoc_reject()
5797 data->assoc_reject.resp_ies_len, in wpas_event_assoc_reject()
5807 * an error. The only valid "non-error" status is in wpas_event_assoc_reject()
5819 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) { in wpas_event_assoc_reject()
5824 /* Driver-based SME cases */ in wpas_event_assoc_reject()
5827 if (wpa_s->current_ssid && in wpas_event_assoc_reject()
5828 wpa_key_mgmt_sae(wpa_s->current_ssid->key_mgmt) && in wpas_event_assoc_reject()
5829 !data->assoc_reject.timed_out) { in wpas_event_assoc_reject()
5831 wpa_sm_aborted_cached(wpa_s->wpa); in wpas_event_assoc_reject()
5832 wpa_sm_pmksa_cache_flush(wpa_s->wpa, wpa_s->current_ssid); in wpas_event_assoc_reject()
5837 if (wpa_s->current_ssid && in wpas_event_assoc_reject()
5838 wpa_s->current_ssid->key_mgmt == WPA_KEY_MGMT_DPP && in wpas_event_assoc_reject()
5839 !data->assoc_reject.timed_out) { in wpas_event_assoc_reject()
5841 wpa_sm_aborted_cached(wpa_s->wpa); in wpas_event_assoc_reject()
5842 wpa_sm_pmksa_cache_flush(wpa_s->wpa, wpa_s->current_ssid); in wpas_event_assoc_reject()
5848 if (wpa_s->auth_alg == WPA_AUTH_ALG_FILS) { in wpas_event_assoc_reject()
5851 wpa_s->eapol, in wpas_event_assoc_reject()
5852 data->assoc_reject.fils_erp_next_seq_num); in wpas_event_assoc_reject()
5868 if (!data || wpa_s->wpa_state != WPA_COMPLETED || in wpas_event_unprot_beacon()
5869 !ether_addr_equal(data->sa, wpa_s->bssid)) in wpas_event_unprot_beacon()
5872 MAC2STR(data->sa)); in wpas_event_unprot_beacon()
5883 res = wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid, in wpas_event_unprot_beacon()
5884 wpa_s->own_addr, wpa_s->bssid, in wpas_event_unprot_beacon()
5888 "Failed to send WNM-Notification Request frame"); in wpas_event_unprot_beacon()
5899 for (i = 7; i >= 0; i--) in bitmap_to_str()
5916 info->default_map); in wpas_tid_link_map()
5917 if (os_snprintf_error(end - pos, res)) in wpas_tid_link_map()
5921 if (!info->default_map) { in wpas_tid_link_map()
5922 for_each_link(info->valid_links, i) { in wpas_tid_link_map()
5926 bitmap_to_str(info->t2lmap[i].uplink, uplink_map_str); in wpas_tid_link_map()
5927 bitmap_to_str(info->t2lmap[i].downlink, in wpas_tid_link_map()
5930 res = os_snprintf(pos, end - pos, in wpas_tid_link_map()
5934 if (os_snprintf_error(end - pos, res)) in wpas_tid_link_map()
5955 if (!ether_addr_equal(bssid, wpa_s->bssid)) { in wpas_link_reconfig()
5956 os_memcpy(wpa_s->bssid, bssid, ETH_ALEN); in wpas_link_reconfig()
5957 wpa_supplicant_update_current_bss(wpa_s, wpa_s->bssid); in wpas_link_reconfig()
5978 wpa_s->valid_links); in wpas_link_reconfig()
5992 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED && in wpa_supplicant_event()
6004 if (event == EVENT_RX_MGMT && data->rx_mgmt.frame_len >= 24) { in wpa_supplicant_event()
6007 hdr = (const struct ieee80211_hdr *) data->rx_mgmt.frame; in wpa_supplicant_event()
6008 fc = le_to_host16(hdr->frame_control); in wpa_supplicant_event()
6021 if (!wpas_fst_update_mbie(wpa_s, data->auth.ies, in wpa_supplicant_event()
6022 data->auth.ies_len)) in wpa_supplicant_event()
6027 wpa_s->auth_status_code = data->auth.status_code; in wpa_supplicant_event()
6032 if (wpa_s->ignore_auth_resp) { in wpa_supplicant_event()
6034 "EVENT_ASSOC - ignore_auth_resp active!"); in wpa_supplicant_event()
6037 if (wpa_s->testing_resend_assoc) { in wpa_supplicant_event()
6039 "EVENT_DEAUTH - testing_resend_assoc"); in wpa_supplicant_event()
6043 if (wpa_s->disconnected) { in wpa_supplicant_event()
6049 wpa_s->assoc_status_code = WLAN_STATUS_SUCCESS; in wpa_supplicant_event()
6051 (data->assoc_info.authorized || in wpa_supplicant_event()
6052 (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) && in wpa_supplicant_event()
6053 wpa_fils_is_completed(wpa_s->wpa)))) in wpa_supplicant_event()
6058 data->assoc_info.subnet_status); in wpa_supplicant_event()
6063 data ? &data->disassoc_info : NULL); in wpa_supplicant_event()
6067 if (wpa_s->ignore_auth_resp) { in wpa_supplicant_event()
6069 "EVENT_DEAUTH - ignore_auth_resp active!"); in wpa_supplicant_event()
6072 if (wpa_s->testing_resend_assoc) { in wpa_supplicant_event()
6074 "EVENT_DEAUTH - testing_resend_assoc"); in wpa_supplicant_event()
6079 data ? &data->deauth_info : NULL); in wpa_supplicant_event()
6089 if (wpa_s->own_scan_requested || in wpa_supplicant_event()
6090 (data && !data->scan_info.external_scan)) { in wpa_supplicant_event()
6093 os_get_reltime(&wpa_s->scan_start_time); in wpa_supplicant_event()
6094 os_reltime_sub(&wpa_s->scan_start_time, in wpa_supplicant_event()
6095 &wpa_s->scan_trigger_time, &diff); in wpa_supplicant_event()
6098 wpa_s->own_scan_requested = 0; in wpa_supplicant_event()
6099 wpa_s->own_scan_running = 1; in wpa_supplicant_event()
6100 if (wpa_s->last_scan_req == MANUAL_SCAN_REQ && in wpa_supplicant_event()
6101 wpa_s->manual_scan_use_id) { in wpa_supplicant_event()
6104 wpa_s->manual_scan_id); in wpa_supplicant_event()
6111 wpa_s->radio->external_scan_req_interface = wpa_s; in wpa_supplicant_event()
6116 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) { in wpa_supplicant_event()
6117 wpa_s->scan_res_handler = NULL; in wpa_supplicant_event()
6118 wpa_s->own_scan_running = 0; in wpa_supplicant_event()
6119 wpa_s->radio->external_scan_req_interface = NULL; in wpa_supplicant_event()
6120 wpa_s->last_scan_req = NORMAL_SCAN_REQ; in wpa_supplicant_event()
6124 if (!(data && data->scan_info.external_scan) && in wpa_supplicant_event()
6125 os_reltime_initialized(&wpa_s->scan_start_time)) { in wpa_supplicant_event()
6128 os_reltime_sub(&now, &wpa_s->scan_start_time, &diff); in wpa_supplicant_event()
6129 wpa_s->scan_start_time.sec = 0; in wpa_supplicant_event()
6130 wpa_s->scan_start_time.usec = 0; in wpa_supplicant_event()
6131 wpa_s->wps_scan_done = true; in wpa_supplicant_event()
6137 if (!(data && data->scan_info.external_scan)) in wpa_supplicant_event()
6138 wpa_s->own_scan_running = 0; in wpa_supplicant_event()
6139 if (data && data->scan_info.nl_scan_event) in wpa_supplicant_event()
6140 wpa_s->radio->external_scan_req_interface = NULL; in wpa_supplicant_event()
6178 if (wpa_s->current_ssid && in wpa_supplicant_event()
6179 wpa_s->current_ssid->mode == WPAS_MODE_MESH) { in wpa_supplicant_event()
6184 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpa_supplicant_event()
6189 if (wpa_s->current_ssid && in wpa_supplicant_event()
6190 wpa_s->current_ssid->mode == WPAS_MODE_MESH) { in wpa_supplicant_event()
6195 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpa_supplicant_event()
6201 MAC2STR(data->tx_status.dst), in wpa_supplicant_event()
6202 data->tx_status.type, data->tx_status.stype); in wpa_supplicant_event()
6204 if (data->tx_status.type == WLAN_FC_TYPE_MGMT && in wpa_supplicant_event()
6205 data->tx_status.stype == WLAN_FC_STYPE_ACTION && in wpa_supplicant_event()
6206 wnm_btm_resp_tx_status(wpa_s, data->tx_status.data, in wpa_supplicant_event()
6207 data->tx_status.data_len) == 0) in wpa_supplicant_event()
6211 if (data->tx_status.type == WLAN_FC_TYPE_MGMT && in wpa_supplicant_event()
6212 data->tx_status.stype == WLAN_FC_STYPE_AUTH && in wpa_supplicant_event()
6213 wpas_pasn_auth_tx_status(wpa_s, data->tx_status.data, in wpa_supplicant_event()
6214 data->tx_status.data_len, in wpa_supplicant_event()
6215 data->tx_status.ack) == 0) in wpa_supplicant_event()
6219 if (wpa_s->ap_iface == NULL) { in wpa_supplicant_event()
6221 if (data->tx_status.type == WLAN_FC_TYPE_MGMT && in wpa_supplicant_event()
6222 data->tx_status.stype == WLAN_FC_STYPE_ACTION) in wpa_supplicant_event()
6224 wpa_s, data->tx_status.dst, in wpa_supplicant_event()
6225 data->tx_status.data, in wpa_supplicant_event()
6226 data->tx_status.data_len, in wpa_supplicant_event()
6227 data->tx_status.ack ? in wpa_supplicant_event()
6236 MACSTR, MAC2STR(wpa_s->p2pdev->pending_action_dst)); in wpa_supplicant_event()
6240 * Note, wpa_s->p2pdev will be the same as wpa_s->parent, in wpa_supplicant_event()
6244 if (data->tx_status.type == WLAN_FC_TYPE_MGMT && in wpa_supplicant_event()
6245 data->tx_status.stype == WLAN_FC_STYPE_ACTION && in wpa_supplicant_event()
6246 ether_addr_equal(wpa_s->p2pdev->pending_action_dst, in wpa_supplicant_event()
6247 data->tx_status.dst)) { in wpa_supplicant_event()
6249 wpa_s->p2pdev, data->tx_status.dst, in wpa_supplicant_event()
6250 data->tx_status.data, in wpa_supplicant_event()
6251 data->tx_status.data_len, in wpa_supplicant_event()
6252 data->tx_status.ack ? in wpa_supplicant_event()
6259 switch (data->tx_status.type) { in wpa_supplicant_event()
6261 ap_mgmt_tx_cb(wpa_s, data->tx_status.data, in wpa_supplicant_event()
6262 data->tx_status.data_len, in wpa_supplicant_event()
6263 data->tx_status.stype, in wpa_supplicant_event()
6264 data->tx_status.ack); in wpa_supplicant_event()
6267 ap_tx_status(wpa_s, data->tx_status.dst, in wpa_supplicant_event()
6268 data->tx_status.data, in wpa_supplicant_event()
6269 data->tx_status.data_len, in wpa_supplicant_event()
6270 data->tx_status.ack); in wpa_supplicant_event()
6277 ap_eapol_tx_status(wpa_s, data->eapol_tx_status.dst, in wpa_supplicant_event()
6278 data->eapol_tx_status.data, in wpa_supplicant_event()
6279 data->eapol_tx_status.data_len, in wpa_supplicant_event()
6280 data->eapol_tx_status.ack); in wpa_supplicant_event()
6283 ap_client_poll_ok(wpa_s, data->client_poll.addr); in wpa_supplicant_event()
6286 if (wpa_s->ap_iface == NULL) in wpa_supplicant_event()
6288 ap_rx_from_unknown_sta(wpa_s, data->rx_from_unknown.addr, in wpa_supplicant_event()
6289 data->rx_from_unknown.wds); in wpa_supplicant_event()
6295 if (!data || !wpa_s->current_ssid || in wpa_supplicant_event()
6296 !(wpa_s->valid_links & BIT(data->ch_switch.link_id))) in wpa_supplicant_event()
6304 data->ch_switch.freq, in wpa_supplicant_event()
6305 data->ch_switch.link_id, in wpa_supplicant_event()
6306 data->ch_switch.ht_enabled, in wpa_supplicant_event()
6307 data->ch_switch.ch_offset, in wpa_supplicant_event()
6308 channel_width_to_string(data->ch_switch.ch_width), in wpa_supplicant_event()
6309 data->ch_switch.cf1, in wpa_supplicant_event()
6310 data->ch_switch.cf2); in wpa_supplicant_event()
6314 wpa_s->links[data->ch_switch.link_id].freq = in wpa_supplicant_event()
6315 data->ch_switch.freq; in wpa_supplicant_event()
6316 if (wpa_s->links[data->ch_switch.link_id].bss && in wpa_supplicant_event()
6317 wpa_s->links[data->ch_switch.link_id].bss->freq != in wpa_supplicant_event()
6318 data->ch_switch.freq) { in wpa_supplicant_event()
6319 wpa_s->links[data->ch_switch.link_id].bss->freq = in wpa_supplicant_event()
6320 data->ch_switch.freq; in wpa_supplicant_event()
6323 wpa_s->links[data->ch_switch.link_id].bss); in wpa_supplicant_event()
6328 if (!data || !wpa_s->current_ssid) in wpa_supplicant_event()
6335 data->ch_switch.freq, in wpa_supplicant_event()
6336 data->ch_switch.ht_enabled, in wpa_supplicant_event()
6337 data->ch_switch.ch_offset, in wpa_supplicant_event()
6338 channel_width_to_string(data->ch_switch.ch_width), in wpa_supplicant_event()
6339 data->ch_switch.cf1, in wpa_supplicant_event()
6340 data->ch_switch.cf2); in wpa_supplicant_event()
6344 wpa_s->assoc_freq = data->ch_switch.freq; in wpa_supplicant_event()
6345 wpa_s->current_ssid->frequency = data->ch_switch.freq; in wpa_supplicant_event()
6346 if (wpa_s->current_bss && in wpa_supplicant_event()
6347 wpa_s->current_bss->freq != data->ch_switch.freq) { in wpa_supplicant_event()
6348 wpa_s->current_bss->freq = data->ch_switch.freq; in wpa_supplicant_event()
6350 wpa_s->current_bss); in wpa_supplicant_event()
6354 switch (data->ch_switch.ch_offset) { in wpa_supplicant_event()
6356 wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_ABOVE; in wpa_supplicant_event()
6358 case -1: in wpa_supplicant_event()
6359 wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_BELOW; in wpa_supplicant_event()
6362 wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_UNKNOWN; in wpa_supplicant_event()
6368 if (wpa_s->current_ssid->mode == WPAS_MODE_AP || in wpa_supplicant_event()
6369 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO || in wpa_supplicant_event()
6370 wpa_s->current_ssid->mode == WPAS_MODE_MESH || in wpa_supplicant_event()
6371 wpa_s->current_ssid->mode == in wpa_supplicant_event()
6373 wpas_ap_ch_switch(wpa_s, data->ch_switch.freq, in wpa_supplicant_event()
6374 data->ch_switch.ht_enabled, in wpa_supplicant_event()
6375 data->ch_switch.ch_offset, in wpa_supplicant_event()
6376 data->ch_switch.ch_width, in wpa_supplicant_event()
6377 data->ch_switch.cf1, in wpa_supplicant_event()
6378 data->ch_switch.cf2, in wpa_supplicant_event()
6379 data->ch_switch.punct_bitmap, in wpa_supplicant_event()
6384 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) in wpa_supplicant_event()
6395 &data->dfs_event); in wpa_supplicant_event()
6400 &data->dfs_event); in wpa_supplicant_event()
6406 wpas_event_dfs_cac_started(wpa_s, &data->dfs_event); in wpa_supplicant_event()
6410 wpas_event_dfs_cac_finished(wpa_s, &data->dfs_event); in wpa_supplicant_event()
6414 wpas_event_dfs_cac_aborted(wpa_s, &data->dfs_event); in wpa_supplicant_event()
6421 if (wpa_s->ext_mgmt_frame_handling) { in wpa_supplicant_event()
6422 struct rx_mgmt *rx = &data->rx_mgmt; in wpa_supplicant_event()
6423 size_t hex_len = 2 * rx->frame_len + 1; in wpa_supplicant_event()
6427 rx->frame, rx->frame_len); in wpa_supplicant_event()
6428 wpa_msg(wpa_s, MSG_INFO, "MGMT-RX freq=%d datarate=%u ssi_signal=%d %s", in wpa_supplicant_event()
6429 rx->freq, rx->datarate, rx->ssi_signal, in wpa_supplicant_event()
6438 data->rx_mgmt.frame; in wpa_supplicant_event()
6439 fc = le_to_host16(mgmt->frame_control); in wpa_supplicant_event()
6443 if (wpa_s->ap_iface == NULL) { in wpa_supplicant_event()
6447 data->rx_mgmt.frame_len > IEEE80211_HDRLEN) { in wpa_supplicant_event()
6448 const u8 *src = mgmt->sa; in wpa_supplicant_event()
6452 ie = data->rx_mgmt.frame + IEEE80211_HDRLEN; in wpa_supplicant_event()
6453 ie_len = data->rx_mgmt.frame_len - in wpa_supplicant_event()
6456 wpa_s, src, mgmt->da, in wpa_supplicant_event()
6457 mgmt->bssid, ie, ie_len, in wpa_supplicant_event()
6458 data->rx_mgmt.freq, in wpa_supplicant_event()
6459 data->rx_mgmt.ssi_signal); in wpa_supplicant_event()
6464 if (wpa_s->current_ssid && in wpa_supplicant_event()
6465 wpa_s->current_ssid->mode == WPAS_MODE_IBSS && in wpa_supplicant_event()
6467 data->rx_mgmt.frame_len >= 30) { in wpa_supplicant_event()
6475 wpa_s, data->rx_mgmt.frame, in wpa_supplicant_event()
6476 data->rx_mgmt.frame_len, in wpa_supplicant_event()
6477 data->rx_mgmt.freq, in wpa_supplicant_event()
6478 data->rx_mgmt.ssi_signal); in wpa_supplicant_event()
6482 if (wpa_s->ifmsh) { in wpa_supplicant_event()
6483 mesh_mpm_mgmt_rx(wpa_s, &data->rx_mgmt); in wpa_supplicant_event()
6489 data->rx_mgmt.frame_len) != -2) in wpa_supplicant_event()
6495 !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) && in wpa_supplicant_event()
6496 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SAE)) { in wpa_supplicant_event()
6498 wpa_s, data->rx_mgmt.frame, in wpa_supplicant_event()
6499 data->rx_mgmt.frame_len); in wpa_supplicant_event()
6504 "management frame in non-AP mode"); in wpa_supplicant_event()
6510 data->rx_mgmt.frame_len > IEEE80211_HDRLEN) { in wpa_supplicant_event()
6514 ie = data->rx_mgmt.frame + IEEE80211_HDRLEN; in wpa_supplicant_event()
6515 ie_len = data->rx_mgmt.frame_len - IEEE80211_HDRLEN; in wpa_supplicant_event()
6517 wpas_notify_preq(wpa_s, mgmt->sa, mgmt->da, in wpa_supplicant_event()
6518 mgmt->bssid, ie, ie_len, in wpa_supplicant_event()
6519 data->rx_mgmt.ssi_signal); in wpa_supplicant_event()
6522 ap_mgmt_rx(wpa_s, &data->rx_mgmt); in wpa_supplicant_event()
6527 if (data->rx_probe_req.sa == NULL || in wpa_supplicant_event()
6528 data->rx_probe_req.ie == NULL) in wpa_supplicant_event()
6531 if (wpa_s->ap_iface) { in wpa_supplicant_event()
6532 hostapd_probe_req_rx(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
6533 data->rx_probe_req.sa, in wpa_supplicant_event()
6534 data->rx_probe_req.da, in wpa_supplicant_event()
6535 data->rx_probe_req.bssid, in wpa_supplicant_event()
6536 data->rx_probe_req.ie, in wpa_supplicant_event()
6537 data->rx_probe_req.ie_len, in wpa_supplicant_event()
6538 data->rx_probe_req.ssi_signal); in wpa_supplicant_event()
6542 wpas_p2p_probe_req_rx(wpa_s, data->rx_probe_req.sa, in wpa_supplicant_event()
6543 data->rx_probe_req.da, in wpa_supplicant_event()
6544 data->rx_probe_req.bssid, in wpa_supplicant_event()
6545 data->rx_probe_req.ie, in wpa_supplicant_event()
6546 data->rx_probe_req.ie_len, in wpa_supplicant_event()
6548 data->rx_probe_req.ssi_signal); in wpa_supplicant_event()
6553 wpa_s, data->remain_on_channel.freq, in wpa_supplicant_event()
6554 data->remain_on_channel.duration); in wpa_supplicant_event()
6557 wpa_s, data->remain_on_channel.freq, in wpa_supplicant_event()
6558 data->remain_on_channel.duration); in wpa_supplicant_event()
6561 wpa_s, data->remain_on_channel.freq, in wpa_supplicant_event()
6562 data->remain_on_channel.duration); in wpa_supplicant_event()
6566 wpa_s, data->remain_on_channel.freq, in wpa_supplicant_event()
6567 data->remain_on_channel.duration); in wpa_supplicant_event()
6573 wpa_s, data->remain_on_channel.freq); in wpa_supplicant_event()
6576 wpa_s, data->remain_on_channel.freq); in wpa_supplicant_event()
6579 wpa_s, data->remain_on_channel.freq); in wpa_supplicant_event()
6583 wpa_s, data->remain_on_channel.freq); in wpa_supplicant_event()
6587 wpa_supplicant_rx_eapol(wpa_s, data->eapol_rx.src, in wpa_supplicant_event()
6588 data->eapol_rx.data, in wpa_supplicant_event()
6589 data->eapol_rx.data_len, in wpa_supplicant_event()
6590 data->eapol_rx.encrypted); in wpa_supplicant_event()
6595 data->signal_change.above_threshold, in wpa_supplicant_event()
6596 data->signal_change.data.signal, in wpa_supplicant_event()
6597 data->signal_change.current_noise, in wpa_supplicant_event()
6598 data->signal_change.data.current_tx_rate); in wpa_supplicant_event()
6599 wpa_bss_update_level(wpa_s->current_bss, in wpa_supplicant_event()
6600 data->signal_change.data.signal); in wpa_supplicant_event()
6602 wpa_s, data->signal_change.above_threshold, in wpa_supplicant_event()
6603 data->signal_change.data.signal, in wpa_supplicant_event()
6604 data->signal_change.current_noise, in wpa_supplicant_event()
6605 data->signal_change.data.current_tx_rate); in wpa_supplicant_event()
6606 os_memcpy(&wpa_s->last_signal_info, data, in wpa_supplicant_event()
6612 wpa_sm_pmksa_cache_flush(wpa_s->wpa, NULL); in wpa_supplicant_event()
6616 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) { in wpa_supplicant_event()
6621 os_memcpy(addr, wpa_s->own_addr, ETH_ALEN); in wpa_supplicant_event()
6623 if (!ether_addr_equal(addr, wpa_s->own_addr)) in wpa_supplicant_event()
6624 wpa_sm_pmksa_cache_flush(wpa_s->wpa, NULL); in wpa_supplicant_event()
6626 wpa_sm_pmksa_cache_reconfig(wpa_s->wpa); in wpa_supplicant_event()
6628 if (wpa_s->p2p_mgmt) { in wpa_supplicant_event()
6635 if (!wpa_s->ap_iface) { in wpa_supplicant_event()
6638 wpa_s->scan_req = NORMAL_SCAN_REQ; in wpa_supplicant_event()
6652 if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_GO || in wpa_supplicant_event()
6653 (wpa_s->current_ssid && wpa_s->current_ssid->p2p_group && in wpa_supplicant_event()
6654 wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO)) { in wpa_supplicant_event()
6665 if (wpa_s->current_ssid && in wpa_supplicant_event()
6666 wpa_s->current_ssid->p2p_group) in wpa_supplicant_event()
6676 if (wpa_s->p2p_scan_work && wpa_s->global->p2p && in wpa_supplicant_event()
6677 p2p_in_progress(wpa_s->global->p2p) > 1) { in wpa_supplicant_event()
6681 p2p_stop_find(wpa_s->global->p2p); in wpa_supplicant_event()
6685 if (wpa_s->wpa_state >= WPA_AUTHENTICATING) { in wpa_supplicant_event()
6694 os_reltime_age(&wpa_s->last_scan, &age); in wpa_supplicant_event()
6695 if (age.sec >= wpa_s->conf->scan_res_valid_for_connect) { in wpa_supplicant_event()
6696 clear_at.sec = wpa_s->conf->scan_res_valid_for_connect; in wpa_supplicant_event()
6701 tmp.sec = wpa_s->conf->scan_res_valid_for_connect; in wpa_supplicant_event()
6714 wpa_s, &data->channel_list_changed); in wpa_supplicant_event()
6722 data->best_chan.freq_24, data->best_chan.freq_5, in wpa_supplicant_event()
6723 data->best_chan.freq_overall); in wpa_supplicant_event()
6724 wpa_s->best_24_freq = data->best_chan.freq_24; in wpa_supplicant_event()
6725 wpa_s->best_5_freq = data->best_chan.freq_5; in wpa_supplicant_event()
6726 wpa_s->best_overall_freq = data->best_chan.freq_overall; in wpa_supplicant_event()
6727 wpas_p2p_update_best_channels(wpa_s, data->best_chan.freq_24, in wpa_supplicant_event()
6728 data->best_chan.freq_5, in wpa_supplicant_event()
6729 data->best_chan.freq_overall); in wpa_supplicant_event()
6733 &data->unprot_deauth); in wpa_supplicant_event()
6737 &data->unprot_disassoc); in wpa_supplicant_event()
6741 if (wpa_s->ap_iface && data) in wpa_supplicant_event()
6742 hostapd_event_sta_low_ack(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
6743 data->low_ack.addr); in wpa_supplicant_event()
6747 wpa_tdls_disable_unreachable_link(wpa_s->wpa, in wpa_supplicant_event()
6748 data->low_ack.addr); in wpa_supplicant_event()
6753 ibss_rsn_stop(wpa_s->ibss_rsn, data->ibss_peer_lost.peer); in wpa_supplicant_event()
6757 if (!ether_addr_equal(data->driver_gtk_rekey.bssid, in wpa_supplicant_event()
6758 wpa_s->bssid)) in wpa_supplicant_event()
6760 if (!wpa_s->wpa) in wpa_supplicant_event()
6762 wpa_sm_update_replay_ctr(wpa_s->wpa, in wpa_supplicant_event()
6763 data->driver_gtk_rekey.replay_ctr); in wpa_supplicant_event()
6766 wpa_s->sched_scanning = 0; in wpa_supplicant_event()
6767 resched = wpa_s->scanning && wpas_scan_scheduled(wpa_s); in wpa_supplicant_event()
6770 if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) in wpa_supplicant_event()
6777 if (!wpa_s->sched_scan_stop_req && in wpa_supplicant_event()
6778 wpa_s->wpa_state == WPA_SCANNING) { in wpa_supplicant_event()
6785 wpa_s->sched_scan_stop_req = 0; in wpa_supplicant_event()
6791 if (wpa_s->sched_scan_timed_out) { in wpa_supplicant_event()
6793 } else if (wpa_s->pno_sched_pending) { in wpa_supplicant_event()
6794 wpa_s->pno_sched_pending = 0; in wpa_supplicant_event()
6811 if (!wpa_s->ap_iface || !data) in wpa_supplicant_event()
6814 wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
6815 data->connect_failed_reason.addr, in wpa_supplicant_event()
6816 data->connect_failed_reason.code); in wpa_supplicant_event()
6821 if (!wpa_s->ifmsh || !data) in wpa_supplicant_event()
6823 wpa_mesh_notify_peer(wpa_s, data->mesh_peer.peer, in wpa_supplicant_event()
6824 data->mesh_peer.ies, in wpa_supplicant_event()
6825 data->mesh_peer.ie_len); in wpa_supplicant_event()
6830 if (!wpa_s->ap_iface) in wpa_supplicant_event()
6832 hostapd_event_get_survey(wpa_s->ap_iface, in wpa_supplicant_event()
6833 &data->survey_results); in wpa_supplicant_event()
6839 if (!wpa_s->ap_iface) in wpa_supplicant_event()
6841 hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
6842 &data->acs_selected_channels); in wpa_supplicant_event()
6848 wpa_s->p2p_lo_started = 0; in wpa_supplicant_event()
6851 data->p2p_lo_stop.reason_code); in wpa_supplicant_event()
6855 if (!wpa_s->current_bss || !wpa_s->current_ssid) in wpa_supplicant_event()
6862 if (!wpa_s->current_ssid) { in wpa_supplicant_event()
6871 wpas_pasn_auth_trigger(wpa_s, &data->pasn_auth); in wpa_supplicant_event()
6876 if (wpa_s->ap_iface && wpa_s->ap_iface->bss[0]) { in wpa_supplicant_event()
6879 sta = ap_get_sta(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
6880 data->port_authorized.sta_addr); in wpa_supplicant_event()
6882 ap_sta_set_authorized(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
6891 if (data->port_authorized.td_bitmap_len) { in wpa_supplicant_event()
6894 data->port_authorized.td_bitmap[0]); in wpa_supplicant_event()
6896 wpa_s, data->port_authorized.td_bitmap[0]); in wpa_supplicant_event()
6903 if (!wpa_s->ap_iface || !data) in wpa_supplicant_event()
6906 hostapd_event_sta_opmode_changed(wpa_s->ap_iface->bss[0], in wpa_supplicant_event()
6907 data->sta_opmode.addr, in wpa_supplicant_event()
6908 data->sta_opmode.smps_mode, in wpa_supplicant_event()
6909 data->sta_opmode.chan_width, in wpa_supplicant_event()
6910 data->sta_opmode.rx_nss); in wpa_supplicant_event()
6914 wpas_event_unprot_beacon(wpa_s, &data->unprot_beacon); in wpa_supplicant_event()
6926 wpas_tid_link_map(wpa_s, &data->t2l_map_info); in wpa_supplicant_event()
6943 wpa_s = wpa_supplicant_get_iface(ctx, data->interface_status.ifname); in wpa_supplicant_event_global()
6944 if (wpa_s && wpa_s->driver->get_ifindex) { in wpa_supplicant_event_global()
6947 ifindex = wpa_s->driver->get_ifindex(wpa_s->drv_priv); in wpa_supplicant_event_global()
6948 if (ifindex != data->interface_status.ifindex) { in wpa_supplicant_event_global()
6951 ifindex, data->interface_status.ifindex); in wpa_supplicant_event_global()
6956 else if (data->interface_status.ievent == EVENT_INTERFACE_ADDED) { in wpa_supplicant_event_global()
6960 ctx, data->interface_status.ifname); in wpa_supplicant_event_global()