Lines Matching +full:ignore +full:- +full:power +full:- +full:on +full:- +full:sel

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