• Home
  • Raw
  • Download

Lines Matching refs:wpa_s

41 static void sme_stop_sa_query(struct wpa_supplicant *wpa_s);
57 static int sme_set_sae_group(struct wpa_supplicant *wpa_s) in sme_set_sae_group() argument
59 int *groups = wpa_s->conf->sae_groups; in sme_set_sae_group()
66 if (!index_within_array(groups, wpa_s->sme.sae_group_index)) in sme_set_sae_group()
70 int group = groups[wpa_s->sme.sae_group_index]; in sme_set_sae_group()
73 if (sae_set_group(&wpa_s->sme.sae, group) == 0) { in sme_set_sae_group()
74 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Selected SAE group %d", in sme_set_sae_group()
75 wpa_s->sme.sae.group); in sme_set_sae_group()
78 wpa_s->sme.sae_group_index++; in sme_set_sae_group()
85 static struct wpabuf * sme_auth_build_sae_commit(struct wpa_supplicant *wpa_s, in sme_auth_build_sae_commit() argument
105 if (wpa_s->sae_commit_override) { in sme_auth_build_sae_commit()
107 buf = wpabuf_alloc(4 + wpabuf_len(wpa_s->sae_commit_override)); in sme_auth_build_sae_commit()
114 wpabuf_put_buf(buf, wpa_s->sae_commit_override); in sme_auth_build_sae_commit()
127 if (reuse && wpa_s->sme.sae.tmp && in sme_auth_build_sae_commit()
128 os_memcmp(bssid, wpa_s->sme.sae.tmp->bssid, ETH_ALEN) == 0) { in sme_auth_build_sae_commit()
131 use_pt = wpa_s->sme.sae.h2e; in sme_auth_build_sae_commit()
132 use_pk = wpa_s->sme.sae.pk; in sme_auth_build_sae_commit()
135 if (sme_set_sae_group(wpa_s) < 0) { in sme_auth_build_sae_commit()
140 bss = wpa_bss_get_bssid_latest(wpa_s, bssid); in sme_auth_build_sae_commit()
149 if (ssid->sae_password_id && wpa_s->conf->sae_pwe != 3) in sme_auth_build_sae_commit()
169 if (use_pt || wpa_s->conf->sae_pwe == 1 || wpa_s->conf->sae_pwe == 2) { in sme_auth_build_sae_commit()
172 if ((wpa_s->conf->sae_pwe == 1 || ssid->sae_password_id) && in sme_auth_build_sae_commit()
173 wpa_s->conf->sae_pwe != 3 && in sme_auth_build_sae_commit()
182 sae_prepare_commit_pt(&wpa_s->sme.sae, ssid->pt, in sme_auth_build_sae_commit()
183 wpa_s->own_addr, bssid, in sme_auth_build_sae_commit()
184 wpa_s->sme.sae_rejected_groups, NULL) < 0) in sme_auth_build_sae_commit()
187 sae_prepare_commit(wpa_s->own_addr, bssid, in sme_auth_build_sae_commit()
190 &wpa_s->sme.sae) < 0) { in sme_auth_build_sae_commit()
194 if (wpa_s->sme.sae.tmp) { in sme_auth_build_sae_commit()
195 os_memcpy(wpa_s->sme.sae.tmp->bssid, bssid, ETH_ALEN); in sme_auth_build_sae_commit()
197 wpa_s->sme.sae.pk = 1; in sme_auth_build_sae_commit()
199 os_memcpy(wpa_s->sme.sae.tmp->own_addr, wpa_s->own_addr, in sme_auth_build_sae_commit()
201 os_memcpy(wpa_s->sme.sae.tmp->peer_addr, bssid, ETH_ALEN); in sme_auth_build_sae_commit()
202 sae_pk_set_password(&wpa_s->sme.sae, password); in sme_auth_build_sae_commit()
207 len = wpa_s->sme.sae_token ? 3 + wpabuf_len(wpa_s->sme.sae_token) : 0; in sme_auth_build_sae_commit()
222 if (sae_write_commit(&wpa_s->sme.sae, buf, wpa_s->sme.sae_token, in sme_auth_build_sae_commit()
236 static struct wpabuf * sme_auth_build_sae_confirm(struct wpa_supplicant *wpa_s, in sme_auth_build_sae_confirm() argument
249 sae_write_confirm(&wpa_s->sme.sae, buf); in sme_auth_build_sae_confirm()
262 static void sme_auth_handle_rrm(struct wpa_supplicant *wpa_s, in sme_auth_handle_rrm() argument
269 wpa_s->rrm.rrm_used = 0; in sme_auth_handle_rrm()
273 wpa_s->drv_rrm_flags); in sme_auth_handle_rrm()
281 if (!((wpa_s->drv_rrm_flags & in sme_auth_handle_rrm()
283 (wpa_s->drv_rrm_flags & WPA_DRIVER_FLAGS_QUIET)) && in sme_auth_handle_rrm()
284 !(wpa_s->drv_rrm_flags & WPA_DRIVER_FLAGS_SUPPORT_RRM)) { in sme_auth_handle_rrm()
290 if (sizeof(wpa_s->sme.assoc_req_ie) < in sme_auth_handle_rrm()
291 wpa_s->sme.assoc_req_ie_len + rrm_ie_len + 2) { in sme_auth_handle_rrm()
298 pos = wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len; in sme_auth_handle_rrm()
304 if (wpa_s->drv_rrm_flags & WPA_DRIVER_FLAGS_TX_POWER_INSERTION) in sme_auth_handle_rrm()
311 if (wpa_s->lci) in sme_auth_handle_rrm()
314 wpa_s->sme.assoc_req_ie_len += rrm_ie_len + 2; in sme_auth_handle_rrm()
315 wpa_s->rrm.rrm_used = 1; in sme_auth_handle_rrm()
319 static void sme_send_authentication(struct wpa_supplicant *wpa_s, in sme_send_authentication() argument
344 wpa_msg(wpa_s, MSG_ERROR, "SME: No scan result available for " in sme_send_authentication()
346 wpas_connect_work_done(wpa_s); in sme_send_authentication()
350 skip_auth = wpa_s->conf->reassoc_same_bss_optim && in sme_send_authentication()
351 wpa_s->reassoc_same_bss; in sme_send_authentication()
352 wpa_s->current_bss = bss; in sme_send_authentication()
355 wpa_s->reassociate = 0; in sme_send_authentication()
363 if (wpa_s->sme.ssid_len != params.ssid_len || in sme_send_authentication()
364 os_memcmp(wpa_s->sme.ssid, params.ssid, params.ssid_len) != 0) in sme_send_authentication()
365 wpa_s->sme.prev_bssid_set = 0; in sme_send_authentication()
367 wpa_s->sme.freq = params.freq; in sme_send_authentication()
368 os_memcpy(wpa_s->sme.ssid, params.ssid, params.ssid_len); in sme_send_authentication()
369 wpa_s->sme.ssid_len = params.ssid_len; in sme_send_authentication()
382 wpa_dbg(wpa_s, MSG_DEBUG, "Automatic auth_alg selection: 0x%x", in sme_send_authentication()
386 wpa_dbg(wpa_s, MSG_DEBUG, "Overriding auth_alg selection: " in sme_send_authentication()
390 wpa_s->sme.sae_pmksa_caching = 0; in sme_send_authentication()
397 wpa_dbg(wpa_s, MSG_DEBUG, in sme_send_authentication()
403 wpa_dbg(wpa_s, MSG_DEBUG, "Prefer DPP over SAE when both are enabled"); in sme_send_authentication()
407 wpa_dbg(wpa_s, MSG_DEBUG, "Using SAE auth_alg"); in sme_send_authentication()
410 wpa_dbg(wpa_s, MSG_DEBUG, in sme_send_authentication()
436 wpa_s->conf->okc : in sme_send_authentication()
443 if (pmksa_cache_set_current(wpa_s->wpa, NULL, bss->bssid, in sme_send_authentication()
444 wpa_s->current_ssid, in sme_send_authentication()
447 eapol_sm_notify_pmkid_attempt(wpa_s->eapol); in sme_send_authentication()
448 wpa_s->sme.assoc_req_ie_len = sizeof(wpa_s->sme.assoc_req_ie); in sme_send_authentication()
449 if (wpa_supplicant_set_suites(wpa_s, bss, ssid, in sme_send_authentication()
450 wpa_s->sme.assoc_req_ie, in sme_send_authentication()
451 &wpa_s->sme.assoc_req_ie_len)) { in sme_send_authentication()
452 wpa_msg(wpa_s, MSG_WARNING, "SME: Failed to set WPA " in sme_send_authentication()
454 wpas_connect_work_done(wpa_s); in sme_send_authentication()
461 wpa_s->sme.assoc_req_ie_len = sizeof(wpa_s->sme.assoc_req_ie); in sme_send_authentication()
462 if (wpa_supplicant_set_suites(wpa_s, bss, ssid, in sme_send_authentication()
463 wpa_s->sme.assoc_req_ie, in sme_send_authentication()
464 &wpa_s->sme.assoc_req_ie_len)) { in sme_send_authentication()
465 wpa_msg(wpa_s, MSG_WARNING, "SME: Failed to set WPA " in sme_send_authentication()
467 wpas_connect_work_done(wpa_s); in sme_send_authentication()
478 wpa_supplicant_set_non_wpa_policy(wpa_s, ssid); in sme_send_authentication()
479 wpa_s->sme.assoc_req_ie_len = 0; in sme_send_authentication()
481 wpa_s->sme.assoc_req_ie_len = sizeof(wpa_s->sme.assoc_req_ie); in sme_send_authentication()
482 if (wpa_supplicant_set_suites(wpa_s, NULL, ssid, in sme_send_authentication()
483 wpa_s->sme.assoc_req_ie, in sme_send_authentication()
484 &wpa_s->sme.assoc_req_ie_len)) { in sme_send_authentication()
485 wpa_msg(wpa_s, MSG_WARNING, "SME: Failed to set WPA " in sme_send_authentication()
488 wpas_connect_work_done(wpa_s); in sme_send_authentication()
496 sizeof(wpa_s->sme.assoc_req_ie)) { in sme_send_authentication()
497 wpa_s->sme.assoc_req_ie_len = wpabuf_len(wps_ie); in sme_send_authentication()
498 os_memcpy(wpa_s->sme.assoc_req_ie, wpabuf_head(wps_ie), in sme_send_authentication()
499 wpa_s->sme.assoc_req_ie_len); in sme_send_authentication()
501 wpa_s->sme.assoc_req_ie_len = 0; in sme_send_authentication()
503 wpa_supplicant_set_non_wpa_policy(wpa_s, ssid); in sme_send_authentication()
506 wpa_supplicant_set_non_wpa_policy(wpa_s, ssid); in sme_send_authentication()
507 wpa_s->sme.assoc_req_ie_len = 0; in sme_send_authentication()
517 if (wpa_s->wpa_proto == WPA_PROTO_WPA) { in sme_send_authentication()
518 wpa_ie = os_memdup(wpa_s->sme.assoc_req_ie, in sme_send_authentication()
519 wpa_s->sme.assoc_req_ie_len); in sme_send_authentication()
521 wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Storing WPA IE"); in sme_send_authentication()
523 wpa_ie_len = wpa_s->sme.assoc_req_ie_len; in sme_send_authentication()
524 wpa_s->sme.assoc_req_ie_len = 0; in sme_send_authentication()
526 wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed copy WPA IE"); in sme_send_authentication()
527 wpas_connect_work_done(wpa_s); in sme_send_authentication()
536 wpa_sm_set_ft_params(wpa_s->wpa, ie, ie ? 2 + ie[1] : 0); in sme_send_authentication()
538 !wpa_key_mgmt_ft(wpa_s->key_mgmt))) in sme_send_authentication()
542 wpa_ft_prepare_auth_request(wpa_s->wpa, ie); in sme_send_authentication()
546 wpa_dbg(wpa_s, MSG_DEBUG, "SME: FT mobility domain %02x%02x", in sme_send_authentication()
550 if (wpa_s->sme.assoc_req_ie_len + 5 < in sme_send_authentication()
551 sizeof(wpa_s->sme.assoc_req_ie)) { in sme_send_authentication()
553 u8 *pos = wpa_s->sme.assoc_req_ie + in sme_send_authentication()
554 wpa_s->sme.assoc_req_ie_len; in sme_send_authentication()
561 wpa_s->sme.assoc_req_ie_len += 5; in sme_send_authentication()
564 if (wpa_s->sme.prev_bssid_set && wpa_s->sme.ft_used && in sme_send_authentication()
565 os_memcmp(md, wpa_s->sme.mobility_domain, 2) == 0 && in sme_send_authentication()
566 wpa_sm_has_ptk(wpa_s->wpa)) { in sme_send_authentication()
567 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying to use FT " in sme_send_authentication()
570 params.ie = wpa_s->sme.ft_ies; in sme_send_authentication()
571 params.ie_len = wpa_s->sme.ft_ies_len; in sme_send_authentication()
576 wpa_s->sme.mfp = wpas_get_ssid_pmf(wpa_s, ssid); in sme_send_authentication()
577 if (wpa_s->sme.mfp != NO_MGMT_FRAME_PROTECTION) { in sme_send_authentication()
583 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Selected AP supports " in sme_send_authentication()
585 wpa_s->sme.mfp = MGMT_FRAME_PROTECTION_REQUIRED; in sme_send_authentication()
590 if (wpa_s->global->p2p) { in sme_send_authentication()
594 pos = wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len; in sme_send_authentication()
595 len = sizeof(wpa_s->sme.assoc_req_ie) - in sme_send_authentication()
596 wpa_s->sme.assoc_req_ie_len; in sme_send_authentication()
597 res = wpas_p2p_assoc_req_ie(wpa_s, bss, pos, len, in sme_send_authentication()
600 wpa_s->sme.assoc_req_ie_len += res; in sme_send_authentication()
605 if (wpa_s->fst_ies) { in sme_send_authentication()
606 int fst_ies_len = wpabuf_len(wpa_s->fst_ies); in sme_send_authentication()
608 if (wpa_s->sme.assoc_req_ie_len + fst_ies_len <= in sme_send_authentication()
609 sizeof(wpa_s->sme.assoc_req_ie)) { in sme_send_authentication()
610 os_memcpy(wpa_s->sme.assoc_req_ie + in sme_send_authentication()
611 wpa_s->sme.assoc_req_ie_len, in sme_send_authentication()
612 wpabuf_head(wpa_s->fst_ies), in sme_send_authentication()
614 wpa_s->sme.assoc_req_ie_len += fst_ies_len; in sme_send_authentication()
619 sme_auth_handle_rrm(wpa_s, bss); in sme_send_authentication()
621 wpa_s->sme.assoc_req_ie_len += wpas_supp_op_class_ie( in sme_send_authentication()
622 wpa_s, ssid, bss, in sme_send_authentication()
623 wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, in sme_send_authentication()
624 sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len); in sme_send_authentication()
627 wpa_drv_get_ext_capa(wpa_s, WPA_IF_P2P_CLIENT); in sme_send_authentication()
629 wpa_drv_get_ext_capa(wpa_s, WPA_IF_STATION); in sme_send_authentication()
631 ext_capab_len = wpas_build_ext_capab(wpa_s, ext_capab, in sme_send_authentication()
634 u8 *pos = wpa_s->sme.assoc_req_ie; in sme_send_authentication()
635 if (wpa_s->sme.assoc_req_ie_len > 0 && pos[0] == WLAN_EID_RSN) in sme_send_authentication()
638 wpa_s->sme.assoc_req_ie_len - in sme_send_authentication()
639 (pos - wpa_s->sme.assoc_req_ie)); in sme_send_authentication()
640 wpa_s->sme.assoc_req_ie_len += ext_capab_len; in sme_send_authentication()
645 if (wpa_s->rsnxe_override_assoc && in sme_send_authentication()
646 wpabuf_len(wpa_s->rsnxe_override_assoc) <= in sme_send_authentication()
647 sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len) { in sme_send_authentication()
649 os_memcpy(wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, in sme_send_authentication()
650 wpabuf_head(wpa_s->rsnxe_override_assoc), in sme_send_authentication()
651 wpabuf_len(wpa_s->rsnxe_override_assoc)); in sme_send_authentication()
652 wpa_s->sme.assoc_req_ie_len += in sme_send_authentication()
653 wpabuf_len(wpa_s->rsnxe_override_assoc); in sme_send_authentication()
656 if (wpa_s->rsnxe_len > 0 && in sme_send_authentication()
657 wpa_s->rsnxe_len <= in sme_send_authentication()
658 sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len && in sme_send_authentication()
660 os_memcpy(wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, in sme_send_authentication()
661 wpa_s->rsnxe, wpa_s->rsnxe_len); in sme_send_authentication()
662 wpa_s->sme.assoc_req_ie_len += wpa_s->rsnxe_len; in sme_send_authentication()
666 if (is_hs20_config(wpa_s) && is_hs20_network(wpa_s, ssid, bss)) { in sme_send_authentication()
671 int pps_mo_id = hs20_get_pps_mo_id(wpa_s, ssid); in sme_send_authentication()
677 len = sizeof(wpa_s->sme.assoc_req_ie) - in sme_send_authentication()
678 wpa_s->sme.assoc_req_ie_len; in sme_send_authentication()
680 os_memcpy(wpa_s->sme.assoc_req_ie + in sme_send_authentication()
681 wpa_s->sme.assoc_req_ie_len, in sme_send_authentication()
683 wpa_s->sme.assoc_req_ie_len += wpabuf_len(hs20); in sme_send_authentication()
693 wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Reinsert WPA IE"); in sme_send_authentication()
695 len = sizeof(wpa_s->sme.assoc_req_ie) - in sme_send_authentication()
696 wpa_s->sme.assoc_req_ie_len; in sme_send_authentication()
699 os_memcpy(wpa_s->sme.assoc_req_ie + in sme_send_authentication()
700 wpa_s->sme.assoc_req_ie_len, in sme_send_authentication()
702 wpa_s->sme.assoc_req_ie_len += wpa_ie_len; in sme_send_authentication()
704 wpa_dbg(wpa_s, MSG_DEBUG, "WPA: Failed to add WPA IE"); in sme_send_authentication()
710 if (wpa_s->vendor_elem[VENDOR_ELEM_ASSOC_REQ]) { in sme_send_authentication()
711 struct wpabuf *buf = wpa_s->vendor_elem[VENDOR_ELEM_ASSOC_REQ]; in sme_send_authentication()
714 len = sizeof(wpa_s->sme.assoc_req_ie) - in sme_send_authentication()
715 wpa_s->sme.assoc_req_ie_len; in sme_send_authentication()
717 os_memcpy(wpa_s->sme.assoc_req_ie + in sme_send_authentication()
718 wpa_s->sme.assoc_req_ie_len, in sme_send_authentication()
720 wpa_s->sme.assoc_req_ie_len += wpabuf_len(buf); in sme_send_authentication()
726 if (!wpa_s->disable_mbo_oce && mbo_ie) { in sme_send_authentication()
729 len = wpas_mbo_ie(wpa_s, wpa_s->sme.assoc_req_ie + in sme_send_authentication()
730 wpa_s->sme.assoc_req_ie_len, in sme_send_authentication()
731 sizeof(wpa_s->sme.assoc_req_ie) - in sme_send_authentication()
732 wpa_s->sme.assoc_req_ie_len, in sme_send_authentication()
736 wpa_s->sme.assoc_req_ie_len += len; in sme_send_authentication()
742 pmksa_cache_set_current(wpa_s->wpa, NULL, bss->bssid, ssid, 0, in sme_send_authentication()
744 wpa_s->key_mgmt == WPA_KEY_MGMT_FT_SAE ? in sme_send_authentication()
747 wpa_dbg(wpa_s, MSG_DEBUG, in sme_send_authentication()
749 wpa_sm_set_pmk_from_pmksa(wpa_s->wpa); in sme_send_authentication()
751 wpa_s->sme.sae_pmksa_caching = 1; in sme_send_authentication()
756 resp = sme_auth_build_sae_commit(wpa_s, ssid, in sme_send_authentication()
761 resp = sme_auth_build_sae_confirm(wpa_s, 0); in sme_send_authentication()
763 wpas_connection_failed(wpa_s, bss->bssid); in sme_send_authentication()
768 wpa_s->sme.sae.state = start ? SAE_COMMITTED : SAE_CONFIRMED; in sme_send_authentication()
772 bssid_changed = !is_zero_ether_addr(wpa_s->bssid); in sme_send_authentication()
773 os_memset(wpa_s->bssid, 0, ETH_ALEN); in sme_send_authentication()
774 os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN); in sme_send_authentication()
776 wpas_notify_bssid_changed(wpa_s); in sme_send_authentication()
778 old_ssid = wpa_s->current_ssid; in sme_send_authentication()
779 wpa_s->current_ssid = ssid; in sme_send_authentication()
780 wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid); in sme_send_authentication()
781 wpa_supplicant_initiate_eapol(wpa_s); in sme_send_authentication()
823 if (wpa_s->last_con_fail_realm && in sme_send_authentication()
824 eapol_sm_get_erp_info(wpa_s->eapol, &ssid->eap, in sme_send_authentication()
828 realm && realm_len == wpa_s->last_con_fail_realm_len && in sme_send_authentication()
829 os_memcmp(realm, wpa_s->last_con_fail_realm, in sme_send_authentication()
836 if (pmksa_cache_set_current(wpa_s->wpa, NULL, bss->bssid, in sme_send_authentication()
842 resp = fils_build_auth(wpa_s->wpa, ssid->fils_dh_group, md); in sme_send_authentication()
858 wpa_s->sme.auth_alg = auth_alg; in sme_send_authentication()
864 wpa_supplicant_cancel_sched_scan(wpa_s); in sme_send_authentication()
865 wpa_supplicant_cancel_scan(wpa_s); in sme_send_authentication()
867 wpa_msg(wpa_s, MSG_INFO, "SME: Trying to authenticate with " MACSTR in sme_send_authentication()
871 eapol_sm_notify_portValid(wpa_s->eapol, false); in sme_send_authentication()
872 wpa_clear_keys(wpa_s, bss->bssid); in sme_send_authentication()
873 wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING); in sme_send_authentication()
874 if (old_ssid != wpa_s->current_ssid) in sme_send_authentication()
875 wpas_notify_network_changed(wpa_s); in sme_send_authentication()
878 hs20_configure_frame_filters(wpa_s); in sme_send_authentication()
887 if (wpa_s->num_multichan_concurrent < 2) { in sme_send_authentication()
889 num = get_shared_radio_freqs(wpa_s, &freq, 1); in sme_send_authentication()
894 if (wpas_p2p_handle_frequency_conflicts(wpa_s, in sme_send_authentication()
897 wpas_connection_failed(wpa_s, bss->bssid); in sme_send_authentication()
898 wpa_supplicant_mark_disassoc(wpa_s); in sme_send_authentication()
900 wpas_connect_work_done(wpa_s); in sme_send_authentication()
908 wpa_msg(wpa_s, MSG_DEBUG, in sme_send_authentication()
911 sme_associate(wpa_s, ssid->mode, bss->bssid, WLAN_AUTH_OPEN); in sme_send_authentication()
916 wpa_s->sme.auth_alg = params.auth_alg; in sme_send_authentication()
917 if (wpa_drv_authenticate(wpa_s, &params) < 0) { in sme_send_authentication()
918 wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the " in sme_send_authentication()
920 wpas_connection_failed(wpa_s, bss->bssid); in sme_send_authentication()
921 wpa_supplicant_mark_disassoc(wpa_s); in sme_send_authentication()
923 wpas_connect_work_done(wpa_s); in sme_send_authentication()
927 eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s, in sme_send_authentication()
942 struct wpa_supplicant *wpa_s = work->wpa_s; in sme_auth_start_cb() local
946 wpa_s->connect_work = NULL; in sme_auth_start_cb()
952 wpa_s->connect_work = work; in sme_auth_start_cb()
955 !wpas_valid_bss_ssid(wpa_s, cwork->bss, cwork->ssid) || in sme_auth_start_cb()
956 wpas_network_disabled(wpa_s, cwork->ssid)) { in sme_auth_start_cb()
957 …wpa_dbg(wpa_s, MSG_DEBUG, "SME: BSS/SSID entry for authentication not valid anymore - drop connect… in sme_auth_start_cb()
958 wpas_connect_work_done(wpa_s); in sme_auth_start_cb()
964 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0); in sme_auth_start_cb()
965 wpa_sm_set_assoc_rsnxe(wpa_s->wpa, NULL, 0); in sme_auth_start_cb()
966 wpa_s->rsnxe_len = 0; in sme_auth_start_cb()
968 sme_send_authentication(wpa_s, cwork->bss, cwork->ssid, 1); in sme_auth_start_cb()
972 void sme_authenticate(struct wpa_supplicant *wpa_s, in sme_authenticate() argument
979 if (wpa_s->connect_work) { in sme_authenticate()
980 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Reject sme_authenticate() call since connect_work exist"); in sme_authenticate()
984 if (radio_work_pending(wpa_s, "sme-connect")) { in sme_authenticate()
990 wpa_dbg(wpa_s, MSG_DEBUG, in sme_authenticate()
992 radio_remove_works(wpa_s, "sme-connect", 0); in sme_authenticate()
995 wpas_abort_ongoing_scan(wpa_s); in sme_authenticate()
1005 wpa_s->sme.sae.state = SAE_NOTHING; in sme_authenticate()
1006 wpa_s->sme.sae.send_confirm = 0; in sme_authenticate()
1007 wpa_s->sme.sae_group_index = 0; in sme_authenticate()
1010 if (radio_add_work(wpa_s, bss->freq, "sme-connect", 1, in sme_authenticate()
1045 static int sme_external_auth_send_sae_commit(struct wpa_supplicant *wpa_s, in sme_external_auth_send_sae_commit() argument
1054 resp = sme_auth_build_sae_commit(wpa_s, ssid, bssid, 1, 0, &use_pt, in sme_external_auth_send_sae_commit()
1061 wpa_s->sme.sae.state = SAE_COMMITTED; in sme_external_auth_send_sae_commit()
1068 wpa_s->sme.seq_num++; in sme_external_auth_send_sae_commit()
1075 sme_external_auth_build_buf(buf, resp, wpa_s->own_addr, in sme_external_auth_send_sae_commit()
1076 bssid, 1, wpa_s->sme.seq_num, status); in sme_external_auth_send_sae_commit()
1077 wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1, 0, 0); in sme_external_auth_send_sae_commit()
1085 static void sme_send_external_auth_status(struct wpa_supplicant *wpa_s, in sme_send_external_auth_status() argument
1092 params.ssid = wpa_s->sme.ext_auth_ssid; in sme_send_external_auth_status()
1093 params.ssid_len = wpa_s->sme.ext_auth_ssid_len; in sme_send_external_auth_status()
1094 params.bssid = wpa_s->sme.ext_auth_bssid; in sme_send_external_auth_status()
1095 if (wpa_s->conf->sae_pmkid_in_assoc && status == WLAN_STATUS_SUCCESS) in sme_send_external_auth_status()
1096 params.pmkid = wpa_s->sme.sae.pmkid; in sme_send_external_auth_status()
1097 wpa_drv_send_external_auth_status(wpa_s, &params); in sme_send_external_auth_status()
1101 static int sme_handle_external_auth_start(struct wpa_supplicant *wpa_s, in sme_handle_external_auth_start() argument
1109 for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { in sme_handle_external_auth_start()
1110 if (!wpas_network_disabled(wpa_s, ssid) && in sme_handle_external_auth_start()
1117 sme_external_auth_send_sae_commit(wpa_s, data->external_auth.bssid, in sme_handle_external_auth_start()
1125 static void sme_external_auth_send_sae_confirm(struct wpa_supplicant *wpa_s, in sme_external_auth_send_sae_confirm() argument
1130 resp = sme_auth_build_sae_confirm(wpa_s, 1); in sme_external_auth_send_sae_confirm()
1136 wpa_s->sme.sae.state = SAE_CONFIRMED; in sme_external_auth_send_sae_confirm()
1143 wpa_s->sme.seq_num++; in sme_external_auth_send_sae_confirm()
1144 sme_external_auth_build_buf(buf, resp, wpa_s->own_addr, in sme_external_auth_send_sae_confirm()
1145 da, 2, wpa_s->sme.seq_num, in sme_external_auth_send_sae_confirm()
1147 wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1, 0, 0); in sme_external_auth_send_sae_confirm()
1153 void sme_external_auth_trigger(struct wpa_supplicant *wpa_s, in sme_external_auth_trigger() argument
1163 os_memcpy(wpa_s->sme.ext_auth_bssid, data->external_auth.bssid, in sme_external_auth_trigger()
1165 os_memcpy(wpa_s->sme.ext_auth_ssid, data->external_auth.ssid, in sme_external_auth_trigger()
1167 wpa_s->sme.ext_auth_ssid_len = data->external_auth.ssid_len; in sme_external_auth_trigger()
1168 wpa_s->sme.seq_num = 0; in sme_external_auth_trigger()
1169 wpa_s->sme.sae.state = SAE_NOTHING; in sme_external_auth_trigger()
1170 wpa_s->sme.sae.send_confirm = 0; in sme_external_auth_trigger()
1171 wpa_s->sme.sae_group_index = 0; in sme_external_auth_trigger()
1172 if (sme_handle_external_auth_start(wpa_s, data) < 0) in sme_external_auth_trigger()
1173 sme_send_external_auth_status(wpa_s, in sme_external_auth_trigger()
1177 sme_send_external_auth_status(wpa_s, in sme_external_auth_trigger()
1183 static int sme_sae_is_group_enabled(struct wpa_supplicant *wpa_s, int group) in sme_sae_is_group_enabled() argument
1185 int *groups = wpa_s->conf->sae_groups; in sme_sae_is_group_enabled()
1201 static int sme_check_sae_rejected_groups(struct wpa_supplicant *wpa_s, in sme_check_sae_rejected_groups() argument
1218 enabled = sme_sae_is_group_enabled(wpa_s, group); in sme_check_sae_rejected_groups()
1229 static int sme_sae_auth(struct wpa_supplicant *wpa_s, u16 auth_transaction, in sme_sae_auth() argument
1235 wpa_dbg(wpa_s, MSG_DEBUG, "SME: SAE authentication transaction %u " in sme_sae_auth()
1240 wpa_s->sme.sae.state == SAE_COMMITTED && in sme_sae_auth()
1241 (external || wpa_s->current_bss) && wpa_s->current_ssid) { in sme_sae_auth()
1248 groups = wpa_s->conf->sae_groups; in sme_sae_auth()
1255 wpa_dbg(wpa_s, MSG_DEBUG, in sme_sae_auth()
1260 wpa_dbg(wpa_s, MSG_DEBUG, in sme_sae_auth()
1263 if (sae_group_allowed(&wpa_s->sme.sae, groups, group) != in sme_sae_auth()
1265 wpa_dbg(wpa_s, MSG_ERROR, in sme_sae_auth()
1270 wpabuf_free(wpa_s->sme.sae_token); in sme_sae_auth()
1273 h2e = wpa_s->sme.sae.h2e; in sme_sae_auth()
1276 wpa_dbg(wpa_s, MSG_DEBUG, in sme_sae_auth()
1284 wpa_dbg(wpa_s, MSG_DEBUG, in sme_sae_auth()
1291 wpa_s->sme.sae_token = wpabuf_alloc_copy(token_pos, token_len); in sme_sae_auth()
1293 wpa_s->sme.sae_token); in sme_sae_auth()
1295 sme_send_authentication(wpa_s, wpa_s->current_bss, in sme_sae_auth()
1296 wpa_s->current_ssid, 2); in sme_sae_auth()
1299 wpa_s, wpa_s->sme.ext_auth_bssid, in sme_sae_auth()
1300 wpa_s->current_ssid); in sme_sae_auth()
1306 wpa_s->sme.sae.state == SAE_COMMITTED && in sme_sae_auth()
1307 (external || wpa_s->current_bss) && wpa_s->current_ssid) { in sme_sae_auth()
1308 wpa_dbg(wpa_s, MSG_DEBUG, "SME: SAE group not supported"); in sme_sae_auth()
1309 int_array_add_unique(&wpa_s->sme.sae_rejected_groups, in sme_sae_auth()
1310 wpa_s->sme.sae.group); in sme_sae_auth()
1311 wpa_s->sme.sae_group_index++; in sme_sae_auth()
1312 if (sme_set_sae_group(wpa_s) < 0) in sme_sae_auth()
1314 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Try next enabled SAE group"); in sme_sae_auth()
1316 sme_send_authentication(wpa_s, wpa_s->current_bss, in sme_sae_auth()
1317 wpa_s->current_ssid, 1); in sme_sae_auth()
1320 wpa_s, wpa_s->sme.ext_auth_bssid, in sme_sae_auth()
1321 wpa_s->current_ssid); in sme_sae_auth()
1327 const u8 *bssid = sa ? sa : wpa_s->pending_bssid; in sme_sae_auth()
1329 wpa_msg(wpa_s, MSG_INFO, in sme_sae_auth()
1343 groups = wpa_s->conf->sae_groups; in sme_sae_auth()
1345 wpa_dbg(wpa_s, MSG_DEBUG, "SME SAE commit"); in sme_sae_auth()
1346 if ((!external && wpa_s->current_bss == NULL) || in sme_sae_auth()
1347 wpa_s->current_ssid == NULL) in sme_sae_auth()
1349 if (wpa_s->sme.sae.state != SAE_COMMITTED) { in sme_sae_auth()
1354 if (wpa_s->sme.sae.h2e && status_code == WLAN_STATUS_SUCCESS) { in sme_sae_auth()
1359 if ((!wpa_s->sme.sae.h2e || wpa_s->sme.sae.pk) && in sme_sae_auth()
1365 if (!wpa_s->sme.sae.pk && in sme_sae_auth()
1374 res = sae_parse_commit(&wpa_s->sme.sae, data, len, NULL, NULL, in sme_sae_auth()
1386 if (wpa_s->sme.sae.tmp && in sme_sae_auth()
1388 wpa_s, in sme_sae_auth()
1389 wpa_s->sme.sae.tmp->peer_rejected_groups)) in sme_sae_auth()
1392 if (sae_process_commit(&wpa_s->sme.sae) < 0) { in sme_sae_auth()
1398 wpabuf_free(wpa_s->sme.sae_token); in sme_sae_auth()
1399 wpa_s->sme.sae_token = NULL; in sme_sae_auth()
1401 sme_send_authentication(wpa_s, wpa_s->current_bss, in sme_sae_auth()
1402 wpa_s->current_ssid, 0); in sme_sae_auth()
1404 sme_external_auth_send_sae_confirm(wpa_s, sa); in sme_sae_auth()
1409 wpa_dbg(wpa_s, MSG_DEBUG, "SME SAE confirm"); in sme_sae_auth()
1410 if (wpa_s->sme.sae.state != SAE_CONFIRMED) in sme_sae_auth()
1412 if (sae_check_confirm(&wpa_s->sme.sae, data, len) < 0) in sme_sae_auth()
1414 wpa_s->sme.sae.state = SAE_ACCEPTED; in sme_sae_auth()
1415 sae_clear_temp_data(&wpa_s->sme.sae); in sme_sae_auth()
1419 sme_send_external_auth_status(wpa_s, in sme_sae_auth()
1430 static int sme_sae_set_pmk(struct wpa_supplicant *wpa_s, const u8 *bssid) in sme_sae_set_pmk() argument
1434 wpa_sm_set_pmk(wpa_s->wpa, wpa_s->sme.sae.pmk, PMK_LEN, in sme_sae_set_pmk()
1435 wpa_s->sme.sae.pmkid, bssid); in sme_sae_set_pmk()
1436 if (wpa_s->conf->sae_pmkid_in_assoc) { in sme_sae_set_pmk()
1441 if (wpa_s->sme.assoc_req_ie_len + 2 + PMKID_LEN > in sme_sae_set_pmk()
1442 sizeof(wpa_s->sme.assoc_req_ie)) { in sme_sae_set_pmk()
1443 wpa_msg(wpa_s, MSG_WARNING, in sme_sae_set_pmk()
1447 if (wpa_insert_pmkid(wpa_s->sme.assoc_req_ie, in sme_sae_set_pmk()
1448 &wpa_s->sme.assoc_req_ie_len, in sme_sae_set_pmk()
1449 wpa_s->sme.sae.pmkid) < 0) in sme_sae_set_pmk()
1453 wpa_s->sme.assoc_req_ie, in sme_sae_set_pmk()
1454 wpa_s->sme.assoc_req_ie_len); in sme_sae_set_pmk()
1461 void sme_external_auth_mgmt_rx(struct wpa_supplicant *wpa_s, in sme_external_auth_mgmt_rx() argument
1472 sme_send_external_auth_status(wpa_s, in sme_external_auth_mgmt_rx()
1481 wpa_s, le_to_host16(header->u.auth.auth_transaction), in sme_external_auth_mgmt_rx()
1488 wpa_s, WLAN_STATUS_UNSPECIFIED_FAILURE); in sme_external_auth_mgmt_rx()
1494 if (sme_sae_set_pmk(wpa_s, wpa_s->sme.ext_auth_bssid) < 0) in sme_external_auth_mgmt_rx()
1502 void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data) in sme_event_auth() argument
1504 struct wpa_ssid *ssid = wpa_s->current_ssid; in sme_event_auth()
1507 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication event " in sme_event_auth()
1512 if (wpa_s->wpa_state != WPA_AUTHENTICATING) { in sme_event_auth()
1513 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication event " in sme_event_auth()
1518 if (os_memcmp(wpa_s->pending_bssid, data->auth.peer, ETH_ALEN) != 0) { in sme_event_auth()
1519 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Ignore authentication with " in sme_event_auth()
1525 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication response: peer=" MACSTR in sme_event_auth()
1532 eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL); in sme_event_auth()
1537 res = sme_sae_auth(wpa_s, data->auth.auth_transaction, in sme_event_auth()
1541 wpas_connection_failed(wpa_s, wpa_s->pending_bssid); in sme_event_auth()
1542 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); in sme_event_auth()
1548 if (sme_sae_set_pmk(wpa_s, wpa_s->pending_bssid) < 0) in sme_event_auth()
1564 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_AUTH_REJECT MACSTR in sme_event_auth()
1573 if (wpa_s->sme.auth_alg == WPA_AUTH_ALG_FILS || in sme_event_auth()
1574 wpa_s->sme.auth_alg == WPA_AUTH_ALG_FILS_SK_PFS) in sme_event_auth()
1575 fils_connection_failure(wpa_s); in sme_event_auth()
1580 wpa_s->sme.auth_alg == data->auth.auth_type || in sme_event_auth()
1581 wpa_s->current_ssid->auth_alg == WPA_AUTH_ALG_LEAP) { in sme_event_auth()
1582 wpas_connection_failed(wpa_s, wpa_s->pending_bssid); in sme_event_auth()
1583 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); in sme_event_auth()
1587 wpas_connect_work_done(wpa_s); in sme_event_auth()
1591 wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_SHARED; in sme_event_auth()
1593 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying SHARED auth"); in sme_event_auth()
1594 wpa_supplicant_associate(wpa_s, wpa_s->current_bss, in sme_event_auth()
1595 wpa_s->current_ssid); in sme_event_auth()
1599 wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_LEAP; in sme_event_auth()
1601 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Trying LEAP auth"); in sme_event_auth()
1602 wpa_supplicant_associate(wpa_s, wpa_s->current_bss, in sme_event_auth()
1603 wpa_s->current_ssid); in sme_event_auth()
1616 if (wpa_s->ric_ies) { in sme_event_auth()
1617 ric_ies = wpabuf_head(wpa_s->ric_ies); in sme_event_auth()
1618 ric_ies_len = wpabuf_len(wpa_s->ric_ies); in sme_event_auth()
1620 if (wpa_ft_process_response(wpa_s->wpa, data->auth.ies, in sme_event_auth()
1624 wpa_dbg(wpa_s, MSG_DEBUG, in sme_event_auth()
1626 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" in sme_event_auth()
1629 MAC2STR(wpa_s->pending_bssid), in sme_event_auth()
1631 wpas_connection_failed(wpa_s, wpa_s->pending_bssid); in sme_event_auth()
1632 wpa_supplicant_mark_disassoc(wpa_s); in sme_event_auth()
1643 expect_auth_type = wpa_s->sme.auth_alg == in sme_event_auth()
1647 wpa_dbg(wpa_s, MSG_DEBUG, in sme_event_auth()
1650 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" in sme_event_auth()
1653 MAC2STR(wpa_s->pending_bssid), in sme_event_auth()
1655 wpas_connection_failed(wpa_s, wpa_s->pending_bssid); in sme_event_auth()
1656 wpa_supplicant_mark_disassoc(wpa_s); in sme_event_auth()
1660 if (fils_process_auth(wpa_s->wpa, wpa_s->pending_bssid, in sme_event_auth()
1662 wpa_dbg(wpa_s, MSG_DEBUG, in sme_event_auth()
1664 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" in sme_event_auth()
1667 MAC2STR(wpa_s->pending_bssid), in sme_event_auth()
1669 wpas_connection_failed(wpa_s, wpa_s->pending_bssid); in sme_event_auth()
1670 wpa_supplicant_mark_disassoc(wpa_s); in sme_event_auth()
1676 sme_associate(wpa_s, ssid->mode, data->auth.peer, in sme_event_auth()
1697 void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode, in sme_associate() argument
1702 struct wpa_ssid *ssid = wpa_s->current_ssid; in sme_associate()
1727 dl_list_for_each(req, &wpa_s->fils_hlp_req, struct fils_hlp_req, in sme_associate()
1734 wpabuf_put_data(hlp[num_hlp], wpa_s->own_addr, in sme_associate()
1744 buf = fils_build_assoc_req(wpa_s->wpa, &params.fils_kek, in sme_associate()
1754 wpa_s->sme.assoc_req_ie, in sme_associate()
1755 wpa_s->sme.assoc_req_ie_len); in sme_associate()
1757 if (wpa_key_mgmt_ft(wpa_s->key_mgmt)) { in sme_associate()
1761 remove_ie(wpa_s->sme.assoc_req_ie, in sme_associate()
1762 &wpa_s->sme.assoc_req_ie_len, in sme_associate()
1766 wpa_s->sme.assoc_req_ie, in sme_associate()
1767 wpa_s->sme.assoc_req_ie_len); in sme_associate()
1768 remove_ie(wpa_s->sme.assoc_req_ie, in sme_associate()
1769 &wpa_s->sme.assoc_req_ie_len, in sme_associate()
1773 wpa_s->sme.assoc_req_ie, in sme_associate()
1774 wpa_s->sme.assoc_req_ie_len); in sme_associate()
1778 if (wpa_s->sme.assoc_req_ie_len + wpabuf_len(buf) > in sme_associate()
1779 sizeof(wpa_s->sme.assoc_req_ie)) { in sme_associate()
1785 os_memcpy(wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, in sme_associate()
1787 wpa_s->sme.assoc_req_ie_len += wpabuf_len(buf); in sme_associate()
1790 wpa_s->sme.assoc_req_ie, in sme_associate()
1791 wpa_s->sme.assoc_req_ie_len); in sme_associate()
1802 if (get_ie_ext(wpa_s->sme.assoc_req_ie, wpa_s->sme.assoc_req_ie_len, in sme_associate()
1808 wpa_s->key_mgmt == WPA_KEY_MGMT_OWE) { in sme_associate()
1814 } else if (wpa_s->assoc_status_code == in sme_associate()
1816 if (wpa_s->last_owe_group == 19) in sme_associate()
1818 else if (wpa_s->last_owe_group == 20) in sme_associate()
1826 wpa_s->last_owe_group = group; in sme_associate()
1828 owe_ie = owe_build_assoc_req(wpa_s->wpa, group); in sme_associate()
1834 if (wpa_s->sme.assoc_req_ie_len + wpabuf_len(owe_ie) > in sme_associate()
1835 sizeof(wpa_s->sme.assoc_req_ie)) { in sme_associate()
1841 os_memcpy(wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, in sme_associate()
1843 wpa_s->sme.assoc_req_ie_len += wpabuf_len(owe_ie); in sme_associate()
1849 if (DPP_VERSION > 1 && wpa_s->key_mgmt == WPA_KEY_MGMT_DPP && ssid && in sme_associate()
1854 pmksa = pmksa_cache_get_current(wpa_s->wpa); in sme_associate()
1858 dpp_pfs_free(wpa_s->dpp_pfs); in sme_associate()
1859 wpa_s->dpp_pfs = dpp_pfs_init(ssid->dpp_netaccesskey, in sme_associate()
1861 if (!wpa_s->dpp_pfs) { in sme_associate()
1866 if (wpa_s->sme.assoc_req_ie_len + in sme_associate()
1867 wpabuf_len(wpa_s->dpp_pfs->ie) > in sme_associate()
1868 sizeof(wpa_s->sme.assoc_req_ie)) { in sme_associate()
1871 dpp_pfs_free(wpa_s->dpp_pfs); in sme_associate()
1872 wpa_s->dpp_pfs = NULL; in sme_associate()
1875 os_memcpy(wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, in sme_associate()
1876 wpabuf_head(wpa_s->dpp_pfs->ie), in sme_associate()
1877 wpabuf_len(wpa_s->dpp_pfs->ie)); in sme_associate()
1878 wpa_s->sme.assoc_req_ie_len += wpabuf_len(wpa_s->dpp_pfs->ie); in sme_associate()
1883 wpa_s->mscs_setup_done = false; in sme_associate()
1884 if (wpa_bss_ext_capab(wpa_s->current_bss, WLAN_EXT_CAPAB_MSCS) && in sme_associate()
1885 wpa_s->robust_av.valid_config) { in sme_associate()
1894 wpa_s->robust_av.frame_classifier_len; in sme_associate()
1902 wpa_ie_len = &wpa_s->sme.assoc_req_ie_len; in sme_associate()
1903 max_ie_len = sizeof(wpa_s->sme.assoc_req_ie); in sme_associate()
1904 wpas_populate_mscs_descriptor_ie(&wpa_s->robust_av, mscs_ie); in sme_associate()
1908 os_memcpy(wpa_s->sme.assoc_req_ie + *wpa_ie_len, in sme_associate()
1921 wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len, in sme_associate()
1922 sizeof(wpa_s->sme.assoc_req_ie) - in sme_associate()
1923 wpa_s->sme.assoc_req_ie_len, in sme_associate()
1930 wpa_s->sme.assoc_req_ie_len += multi_ap_ie_len; in sme_associate()
1934 params.ssid = wpa_s->sme.ssid; in sme_associate()
1935 params.ssid_len = wpa_s->sme.ssid_len; in sme_associate()
1936 params.freq.freq = wpa_s->sme.freq; in sme_associate()
1938 params.wpa_ie = wpa_s->sme.assoc_req_ie_len ? in sme_associate()
1939 wpa_s->sme.assoc_req_ie : NULL; in sme_associate()
1940 params.wpa_ie_len = wpa_s->sme.assoc_req_ie_len; in sme_associate()
1943 params.pairwise_suite = wpa_s->pairwise_cipher; in sme_associate()
1944 params.group_suite = wpa_s->group_cipher; in sme_associate()
1945 params.mgmt_group_suite = wpa_s->mgmt_group_cipher; in sme_associate()
1946 params.key_mgmt_suite = wpa_s->key_mgmt; in sme_associate()
1947 params.wpa_proto = wpa_s->wpa_proto; in sme_associate()
1953 wpa_supplicant_apply_ht_overrides(wpa_s, ssid, &params); in sme_associate()
1960 wpa_supplicant_apply_vht_overrides(wpa_s, ssid, &params); in sme_associate()
1963 wpa_supplicant_apply_he_overrides(wpa_s, ssid, &params); in sme_associate()
1966 if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies && in sme_associate()
1967 get_ie(wpa_s->sme.ft_ies, wpa_s->sme.ft_ies_len, in sme_associate()
1977 params.wpa_ie = wpa_s->sme.ft_ies; in sme_associate()
1978 params.wpa_ie_len = wpa_s->sme.ft_ies_len; in sme_associate()
1979 } else if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies) { in sme_associate()
1986 remove_ie(wpa_s->sme.assoc_req_ie, in sme_associate()
1987 &wpa_s->sme.assoc_req_ie_len, in sme_associate()
1989 remove_ie(wpa_s->sme.assoc_req_ie, in sme_associate()
1990 &wpa_s->sme.assoc_req_ie_len, in sme_associate()
1992 remove_ie(wpa_s->sme.assoc_req_ie, in sme_associate()
1993 &wpa_s->sme.assoc_req_ie_len, in sme_associate()
1995 rm_en = get_ie(wpa_s->sme.assoc_req_ie, in sme_associate()
1996 wpa_s->sme.assoc_req_ie_len, in sme_associate()
2004 remove_ie(wpa_s->sme.assoc_req_ie, in sme_associate()
2005 &wpa_s->sme.assoc_req_ie_len, in sme_associate()
2010 wpa_s->sme.assoc_req_ie, in sme_associate()
2011 wpa_s->sme.assoc_req_ie_len); in sme_associate()
2012 if (wpa_s->sme.assoc_req_ie_len + wpa_s->sme.ft_ies_len + in sme_associate()
2013 rm_en_len > sizeof(wpa_s->sme.assoc_req_ie)) { in sme_associate()
2020 os_memmove(wpa_s->sme.assoc_req_ie + wpa_s->sme.ft_ies_len + in sme_associate()
2022 wpa_s->sme.assoc_req_ie, in sme_associate()
2023 wpa_s->sme.assoc_req_ie_len); in sme_associate()
2024 pos = wpa_s->sme.ft_ies; in sme_associate()
2025 end = pos + wpa_s->sme.ft_ies_len; in sme_associate()
2026 wpos = wpa_s->sme.assoc_req_ie; in sme_associate()
2038 wpa_s->sme.assoc_req_ie_len += wpa_s->sme.ft_ies_len + in sme_associate()
2040 params.wpa_ie = wpa_s->sme.assoc_req_ie; in sme_associate()
2041 params.wpa_ie_len = wpa_s->sme.assoc_req_ie_len; in sme_associate()
2048 params.mgmt_frame_protection = wpa_s->sme.mfp; in sme_associate()
2049 params.rrm_used = wpa_s->rrm.rrm_used; in sme_associate()
2050 if (wpa_s->sme.prev_bssid_set) in sme_associate()
2051 params.prev_bssid = wpa_s->sme.prev_bssid; in sme_associate()
2053 wpa_msg(wpa_s, MSG_INFO, "Trying to associate with " MACSTR in sme_associate()
2058 wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATING); in sme_associate()
2063 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Could not parse own IEs?!"); in sme_associate()
2068 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.rsn_ie - 2, in sme_associate()
2072 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.wpa_ie - 2, in sme_associate()
2076 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, elems.osen - 2, in sme_associate()
2079 wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0); in sme_associate()
2081 wpa_sm_set_assoc_rsnxe(wpa_s->wpa, elems.rsnxe - 2, in sme_associate()
2084 wpa_sm_set_assoc_rsnxe(wpa_s->wpa, NULL, 0); in sme_associate()
2088 if (wpa_s->p2pdev->set_sta_uapsd) in sme_associate()
2089 params.uapsd = wpa_s->p2pdev->sta_uapsd; in sme_associate()
2093 if (wpa_drv_associate(wpa_s, &params) < 0) { in sme_associate()
2094 wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the " in sme_associate()
2096 wpas_connection_failed(wpa_s, wpa_s->pending_bssid); in sme_associate()
2097 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); in sme_associate()
2098 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); in sme_associate()
2102 eloop_register_timeout(SME_ASSOC_TIMEOUT, 0, sme_assoc_timer, wpa_s, in sme_associate()
2106 wpabuf_free(wpa_s->last_assoc_req_wpa_ie); in sme_associate()
2107 wpa_s->last_assoc_req_wpa_ie = NULL; in sme_associate()
2109 wpa_s->last_assoc_req_wpa_ie = in sme_associate()
2115 int sme_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md, in sme_update_ft_ies() argument
2119 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Remove mobility domain"); in sme_update_ft_ies()
2120 os_free(wpa_s->sme.ft_ies); in sme_update_ft_ies()
2121 wpa_s->sme.ft_ies = NULL; in sme_update_ft_ies()
2122 wpa_s->sme.ft_ies_len = 0; in sme_update_ft_ies()
2123 wpa_s->sme.ft_used = 0; in sme_update_ft_ies()
2127 os_memcpy(wpa_s->sme.mobility_domain, md, MOBILITY_DOMAIN_ID_LEN); in sme_update_ft_ies()
2129 os_free(wpa_s->sme.ft_ies); in sme_update_ft_ies()
2130 wpa_s->sme.ft_ies = os_memdup(ies, ies_len); in sme_update_ft_ies()
2131 if (wpa_s->sme.ft_ies == NULL) in sme_update_ft_ies()
2133 wpa_s->sme.ft_ies_len = ies_len; in sme_update_ft_ies()
2138 static void sme_deauth(struct wpa_supplicant *wpa_s) in sme_deauth() argument
2142 bssid_changed = !is_zero_ether_addr(wpa_s->bssid); in sme_deauth()
2144 if (wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid, in sme_deauth()
2146 wpa_msg(wpa_s, MSG_INFO, "SME: Deauth request to the driver " in sme_deauth()
2149 wpa_s->sme.prev_bssid_set = 0; in sme_deauth()
2151 wpas_connection_failed(wpa_s, wpa_s->pending_bssid); in sme_deauth()
2152 wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); in sme_deauth()
2153 os_memset(wpa_s->bssid, 0, ETH_ALEN); in sme_deauth()
2154 os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); in sme_deauth()
2156 wpas_notify_bssid_changed(wpa_s); in sme_deauth()
2160 void sme_event_assoc_reject(struct wpa_supplicant *wpa_s, in sme_event_assoc_reject() argument
2163 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association with " MACSTR " failed: " in sme_event_assoc_reject()
2164 "status code %d", MAC2STR(wpa_s->pending_bssid), in sme_event_assoc_reject()
2167 eloop_cancel_timeout(sme_assoc_timer, wpa_s, NULL); in sme_event_assoc_reject()
2170 if (wpa_s->sme.sae_pmksa_caching && wpa_s->current_ssid && in sme_event_assoc_reject()
2171 wpa_key_mgmt_sae(wpa_s->current_ssid->key_mgmt)) { in sme_event_assoc_reject()
2172 wpa_dbg(wpa_s, MSG_DEBUG, in sme_event_assoc_reject()
2174 wpa_sm_aborted_cached(wpa_s->wpa); in sme_event_assoc_reject()
2175 wpa_sm_pmksa_cache_flush(wpa_s->wpa, wpa_s->current_ssid); in sme_event_assoc_reject()
2176 if (wpa_s->current_bss) { in sme_event_assoc_reject()
2177 struct wpa_bss *bss = wpa_s->current_bss; in sme_event_assoc_reject()
2178 struct wpa_ssid *ssid = wpa_s->current_ssid; in sme_event_assoc_reject()
2180 wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid, in sme_event_assoc_reject()
2182 wpas_connect_work_done(wpa_s); in sme_event_assoc_reject()
2183 wpa_supplicant_mark_disassoc(wpa_s); in sme_event_assoc_reject()
2184 wpa_supplicant_connect(wpa_s, bss, ssid); in sme_event_assoc_reject()
2197 sme_deauth(wpa_s); in sme_event_assoc_reject()
2201 void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s, in sme_event_auth_timed_out() argument
2204 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication timed out"); in sme_event_auth_timed_out()
2205 wpas_connection_failed(wpa_s, wpa_s->pending_bssid); in sme_event_auth_timed_out()
2206 wpa_supplicant_mark_disassoc(wpa_s); in sme_event_auth_timed_out()
2210 void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s, in sme_event_assoc_timed_out() argument
2213 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association timed out"); in sme_event_assoc_timed_out()
2214 wpas_connection_failed(wpa_s, wpa_s->pending_bssid); in sme_event_assoc_timed_out()
2215 wpa_supplicant_mark_disassoc(wpa_s); in sme_event_assoc_timed_out()
2219 void sme_event_disassoc(struct wpa_supplicant *wpa_s, in sme_event_disassoc() argument
2222 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Disassociation event received"); in sme_event_disassoc()
2223 if (wpa_s->sme.prev_bssid_set) { in sme_event_disassoc()
2230 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Deauthenticate to clear " in sme_event_disassoc()
2232 wpa_drv_deauthenticate(wpa_s, wpa_s->sme.prev_bssid, in sme_event_disassoc()
2240 struct wpa_supplicant *wpa_s = eloop_ctx; in sme_auth_timer() local
2241 if (wpa_s->wpa_state == WPA_AUTHENTICATING) { in sme_auth_timer()
2242 wpa_msg(wpa_s, MSG_DEBUG, "SME: Authentication timeout"); in sme_auth_timer()
2243 sme_deauth(wpa_s); in sme_auth_timer()
2250 struct wpa_supplicant *wpa_s = eloop_ctx; in sme_assoc_timer() local
2251 if (wpa_s->wpa_state == WPA_ASSOCIATING) { in sme_assoc_timer()
2252 wpa_msg(wpa_s, MSG_DEBUG, "SME: Association timeout"); in sme_assoc_timer()
2253 sme_deauth(wpa_s); in sme_assoc_timer()
2258 void sme_state_changed(struct wpa_supplicant *wpa_s) in sme_state_changed() argument
2261 if (wpa_s->wpa_state != WPA_ASSOCIATING) in sme_state_changed()
2262 eloop_cancel_timeout(sme_assoc_timer, wpa_s, NULL); in sme_state_changed()
2263 if (wpa_s->wpa_state != WPA_AUTHENTICATING) in sme_state_changed()
2264 eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL); in sme_state_changed()
2268 void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s, in sme_disassoc_while_authenticating() argument
2276 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Allow pending authentication " in sme_disassoc_while_authenticating()
2278 wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING); in sme_disassoc_while_authenticating()
2279 os_memcpy(wpa_s->pending_bssid, prev_pending_bssid, ETH_ALEN); in sme_disassoc_while_authenticating()
2284 eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL); in sme_disassoc_while_authenticating()
2285 eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s, in sme_disassoc_while_authenticating()
2290 void sme_clear_on_disassoc(struct wpa_supplicant *wpa_s) in sme_clear_on_disassoc() argument
2292 wpa_s->sme.prev_bssid_set = 0; in sme_clear_on_disassoc()
2294 wpabuf_free(wpa_s->sme.sae_token); in sme_clear_on_disassoc()
2295 wpa_s->sme.sae_token = NULL; in sme_clear_on_disassoc()
2296 sae_clear_data(&wpa_s->sme.sae); in sme_clear_on_disassoc()
2299 if (wpa_s->sme.ft_ies || wpa_s->sme.ft_used) in sme_clear_on_disassoc()
2300 sme_update_ft_ies(wpa_s, NULL, NULL, 0); in sme_clear_on_disassoc()
2302 sme_stop_sa_query(wpa_s); in sme_clear_on_disassoc()
2306 void sme_deinit(struct wpa_supplicant *wpa_s) in sme_deinit() argument
2308 sme_clear_on_disassoc(wpa_s); in sme_deinit()
2310 os_free(wpa_s->sme.sae_rejected_groups); in sme_deinit()
2311 wpa_s->sme.sae_rejected_groups = NULL; in sme_deinit()
2314 eloop_cancel_timeout(sme_assoc_timer, wpa_s, NULL); in sme_deinit()
2315 eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL); in sme_deinit()
2316 eloop_cancel_timeout(sme_obss_scan_timeout, wpa_s, NULL); in sme_deinit()
2320 static void sme_send_2040_bss_coex(struct wpa_supplicant *wpa_s, in sme_send_2040_bss_coex() argument
2330 MAC2STR(wpa_s->bssid), num_channels, num_intol); in sme_send_2040_bss_coex()
2359 if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid, in sme_send_2040_bss_coex()
2360 wpa_s->own_addr, wpa_s->bssid, in sme_send_2040_bss_coex()
2362 wpa_msg(wpa_s, MSG_INFO, in sme_send_2040_bss_coex()
2370 int sme_proc_obss_scan(struct wpa_supplicant *wpa_s, in sme_proc_obss_scan() argument
2379 if (!wpa_s->sme.sched_obss_scan) in sme_proc_obss_scan()
2382 wpa_s->sme.sched_obss_scan = 0; in sme_proc_obss_scan()
2383 if (!wpa_s->current_bss || wpa_s->wpa_state != WPA_COMPLETED) in sme_proc_obss_scan()
2399 ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_COUNTRY); in sme_proc_obss_scan()
2405 pri_freq = wpa_s->assoc_freq; in sme_proc_obss_scan()
2407 switch (wpa_s->sme.ht_sec_chan) { in sme_proc_obss_scan()
2416 wpa_msg(wpa_s, MSG_WARNING, in sme_proc_obss_scan()
2449 sme_send_2040_bss_coex(wpa_s, chan_list, num_channels, num_intol); in sme_proc_obss_scan()
2454 static void wpa_obss_scan_freqs_list(struct wpa_supplicant *wpa_s, in wpa_obss_scan_freqs_list() argument
2462 mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, in wpa_obss_scan_freqs_list()
2470 if (wpa_s->sme.ht_sec_chan == HT_SEC_CHAN_UNKNOWN && in wpa_obss_scan_freqs_list()
2471 wpa_s->current_bss) { in wpa_obss_scan_freqs_list()
2474 ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_HT_OPERATION); in wpa_obss_scan_freqs_list()
2480 wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_ABOVE; in wpa_obss_scan_freqs_list()
2482 wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_BELOW; in wpa_obss_scan_freqs_list()
2486 start = wpa_s->assoc_freq - 10; in wpa_obss_scan_freqs_list()
2487 end = wpa_s->assoc_freq + 10; in wpa_obss_scan_freqs_list()
2488 switch (wpa_s->sme.ht_sec_chan) { in wpa_obss_scan_freqs_list()
2491 if (wpa_s->assoc_freq <= 2452) in wpa_obss_scan_freqs_list()
2494 if (wpa_s->assoc_freq >= 2432) in wpa_obss_scan_freqs_list()
2506 wpa_s->assoc_freq, start, end); in wpa_obss_scan_freqs_list()
2526 struct wpa_supplicant *wpa_s = eloop_ctx; in sme_obss_scan_timeout() local
2529 if (!wpa_s->current_bss) { in sme_obss_scan_timeout()
2535 wpa_obss_scan_freqs_list(wpa_s, &params); in sme_obss_scan_timeout()
2539 if (wpa_supplicant_trigger_scan(wpa_s, &params)) in sme_obss_scan_timeout()
2542 wpa_s->sme.sched_obss_scan = 1; in sme_obss_scan_timeout()
2545 eloop_register_timeout(wpa_s->sme.obss_scan_int, 0, in sme_obss_scan_timeout()
2546 sme_obss_scan_timeout, wpa_s, NULL); in sme_obss_scan_timeout()
2550 void sme_sched_obss_scan(struct wpa_supplicant *wpa_s, int enable) in sme_sched_obss_scan() argument
2553 struct wpa_bss *bss = wpa_s->current_bss; in sme_sched_obss_scan()
2554 struct wpa_ssid *ssid = wpa_s->current_ssid; in sme_sched_obss_scan()
2558 eloop_cancel_timeout(sme_obss_scan_timeout, wpa_s, NULL); in sme_sched_obss_scan()
2559 wpa_s->sme.sched_obss_scan = 0; in sme_sched_obss_scan()
2560 wpa_s->sme.ht_sec_chan = HT_SEC_CHAN_UNKNOWN; in sme_sched_obss_scan()
2568 if (!((wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) || in sme_sched_obss_scan()
2569 (wpa_s->drv_flags & WPA_DRIVER_FLAGS_OBSS_SCAN)) || in sme_sched_obss_scan()
2573 if (!wpa_s->hw.modes) in sme_sched_obss_scan()
2577 for (i = 0; i < wpa_s->hw.num_modes; i++) { in sme_sched_obss_scan()
2578 hw_mode = &wpa_s->hw.modes[i]; in sme_sched_obss_scan()
2584 if (i == wpa_s->hw.num_modes || !hw_mode || in sme_sched_obss_scan()
2592 ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_HT_CAP); in sme_sched_obss_scan()
2597 ie = wpa_bss_get_ie(wpa_s->current_bss, in sme_sched_obss_scan()
2602 wpa_s->sme.obss_scan_int = WPA_GET_LE16(ie + 6); in sme_sched_obss_scan()
2603 if (wpa_s->sme.obss_scan_int < 10) { in sme_sched_obss_scan()
2606 wpa_s->sme.obss_scan_int); in sme_sched_obss_scan()
2607 wpa_s->sme.obss_scan_int = 10; in sme_sched_obss_scan()
2610 wpa_s->sme.obss_scan_int); in sme_sched_obss_scan()
2611 eloop_register_timeout(wpa_s->sme.obss_scan_int, 0, in sme_sched_obss_scan()
2612 sme_obss_scan_timeout, wpa_s, NULL); in sme_sched_obss_scan()
2620 static int sme_check_sa_query_timeout(struct wpa_supplicant *wpa_s) in sme_check_sa_query_timeout() argument
2625 os_reltime_sub(&now, &wpa_s->sme.sa_query_start, &passed); in sme_check_sa_query_timeout()
2628 wpa_dbg(wpa_s, MSG_DEBUG, "SME: SA Query timed out"); in sme_check_sa_query_timeout()
2629 sme_stop_sa_query(wpa_s); in sme_check_sa_query_timeout()
2631 wpa_s, WLAN_REASON_PREV_AUTH_NOT_VALID); in sme_check_sa_query_timeout()
2639 static void sme_send_sa_query_req(struct wpa_supplicant *wpa_s, in sme_send_sa_query_req() argument
2645 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Sending SA Query Request to " in sme_send_sa_query_req()
2646 MACSTR, MAC2STR(wpa_s->bssid)); in sme_send_sa_query_req()
2654 if (wpa_sm_ocv_enabled(wpa_s->wpa)) { in sme_send_sa_query_req()
2657 if (wpa_drv_channel_info(wpa_s, &ci) != 0) { in sme_send_sa_query_req()
2664 if (wpa_s->oci_freq_override_saquery_req) { in sme_send_sa_query_req()
2668 wpa_s->oci_freq_override_saquery_req); in sme_send_sa_query_req()
2669 ci.frequency = wpa_s->oci_freq_override_saquery_req; in sme_send_sa_query_req()
2680 if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid, in sme_send_sa_query_req()
2681 wpa_s->own_addr, wpa_s->bssid, in sme_send_sa_query_req()
2683 wpa_msg(wpa_s, MSG_INFO, "SME: Failed to send SA Query " in sme_send_sa_query_req()
2690 struct wpa_supplicant *wpa_s = eloop_ctx; in sme_sa_query_timer() local
2694 if (wpa_s->sme.sa_query_count > 0 && in sme_sa_query_timer()
2695 sme_check_sa_query_timeout(wpa_s)) in sme_sa_query_timer()
2698 nbuf = os_realloc_array(wpa_s->sme.sa_query_trans_id, in sme_sa_query_timer()
2699 wpa_s->sme.sa_query_count + 1, in sme_sa_query_timer()
2702 sme_stop_sa_query(wpa_s); in sme_sa_query_timer()
2705 if (wpa_s->sme.sa_query_count == 0) { in sme_sa_query_timer()
2707 os_get_reltime(&wpa_s->sme.sa_query_start); in sme_sa_query_timer()
2709 trans_id = nbuf + wpa_s->sme.sa_query_count * WLAN_SA_QUERY_TR_ID_LEN; in sme_sa_query_timer()
2710 wpa_s->sme.sa_query_trans_id = nbuf; in sme_sa_query_timer()
2711 wpa_s->sme.sa_query_count++; in sme_sa_query_timer()
2715 sme_stop_sa_query(wpa_s); in sme_sa_query_timer()
2722 eloop_register_timeout(sec, usec, sme_sa_query_timer, wpa_s, NULL); in sme_sa_query_timer()
2724 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association SA Query attempt %d", in sme_sa_query_timer()
2725 wpa_s->sme.sa_query_count); in sme_sa_query_timer()
2727 sme_send_sa_query_req(wpa_s, trans_id); in sme_sa_query_timer()
2731 static void sme_start_sa_query(struct wpa_supplicant *wpa_s) in sme_start_sa_query() argument
2733 sme_sa_query_timer(wpa_s, NULL); in sme_start_sa_query()
2737 static void sme_stop_sa_query(struct wpa_supplicant *wpa_s) in sme_stop_sa_query() argument
2739 if (wpa_s->sme.sa_query_trans_id) in sme_stop_sa_query()
2740 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Stop SA Query"); in sme_stop_sa_query()
2741 eloop_cancel_timeout(sme_sa_query_timer, wpa_s, NULL); in sme_stop_sa_query()
2742 os_free(wpa_s->sme.sa_query_trans_id); in sme_stop_sa_query()
2743 wpa_s->sme.sa_query_trans_id = NULL; in sme_stop_sa_query()
2744 wpa_s->sme.sa_query_count = 0; in sme_stop_sa_query()
2748 void sme_event_unprot_disconnect(struct wpa_supplicant *wpa_s, const u8 *sa, in sme_event_unprot_disconnect() argument
2754 if (wpa_s->wpa_state != WPA_COMPLETED) in sme_event_unprot_disconnect()
2756 ssid = wpa_s->current_ssid; in sme_event_unprot_disconnect()
2757 if (wpas_get_ssid_pmf(wpa_s, ssid) == NO_MGMT_FRAME_PROTECTION) in sme_event_unprot_disconnect()
2759 if (os_memcmp(sa, wpa_s->bssid, ETH_ALEN) != 0) in sme_event_unprot_disconnect()
2764 if (wpa_s->sme.sa_query_count > 0) in sme_event_unprot_disconnect()
2767 if (wpa_s->disable_sa_query) in sme_event_unprot_disconnect()
2772 if (wpa_s->sme.last_unprot_disconnect.sec && in sme_event_unprot_disconnect()
2773 !os_reltime_expired(&now, &wpa_s->sme.last_unprot_disconnect, 10)) in sme_event_unprot_disconnect()
2775 wpa_s->sme.last_unprot_disconnect = now; in sme_event_unprot_disconnect()
2777 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Unprotected disconnect dropped - " in sme_event_unprot_disconnect()
2779 sme_start_sa_query(wpa_s); in sme_event_unprot_disconnect()
2783 void sme_event_ch_switch(struct wpa_supplicant *wpa_s) in sme_event_ch_switch() argument
2788 if (wpa_s->wpa_state != WPA_COMPLETED || in sme_event_ch_switch()
2789 !wpa_sm_ocv_enabled(wpa_s->wpa)) in sme_event_ch_switch()
2792 wpa_dbg(wpa_s, MSG_DEBUG, in sme_event_ch_switch()
2794 sme_stop_sa_query(wpa_s); in sme_event_ch_switch()
2799 eloop_register_timeout(0, usec, sme_sa_query_timer, wpa_s, NULL); in sme_event_ch_switch()
2803 static void sme_process_sa_query_request(struct wpa_supplicant *wpa_s, in sme_process_sa_query_request() argument
2810 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Sending SA Query Response to " in sme_process_sa_query_request()
2811 MACSTR, MAC2STR(wpa_s->bssid)); in sme_process_sa_query_request()
2818 if (wpa_sm_ocv_enabled(wpa_s->wpa)) { in sme_process_sa_query_request()
2821 if (wpa_drv_channel_info(wpa_s, &ci) != 0) { in sme_process_sa_query_request()
2828 if (wpa_s->oci_freq_override_saquery_resp) { in sme_process_sa_query_request()
2832 wpa_s->oci_freq_override_saquery_resp); in sme_process_sa_query_request()
2833 ci.frequency = wpa_s->oci_freq_override_saquery_resp; in sme_process_sa_query_request()
2844 if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid, in sme_process_sa_query_request()
2845 wpa_s->own_addr, wpa_s->bssid, in sme_process_sa_query_request()
2847 wpa_msg(wpa_s, MSG_INFO, in sme_process_sa_query_request()
2852 static void sme_process_sa_query_response(struct wpa_supplicant *wpa_s, in sme_process_sa_query_response() argument
2858 if (!wpa_s->sme.sa_query_trans_id) in sme_process_sa_query_response()
2861 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Received SA Query response from " in sme_process_sa_query_response()
2864 if (os_memcmp(sa, wpa_s->bssid, ETH_ALEN) != 0) in sme_process_sa_query_response()
2867 for (i = 0; i < wpa_s->sme.sa_query_count; i++) { in sme_process_sa_query_response()
2868 if (os_memcmp(wpa_s->sme.sa_query_trans_id + in sme_process_sa_query_response()
2874 if (i >= wpa_s->sme.sa_query_count) { in sme_process_sa_query_response()
2875 wpa_dbg(wpa_s, MSG_DEBUG, "SME: No matching SA Query " in sme_process_sa_query_response()
2880 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Reply to pending SA Query received " in sme_process_sa_query_response()
2882 sme_stop_sa_query(wpa_s); in sme_process_sa_query_response()
2886 void sme_sa_query_rx(struct wpa_supplicant *wpa_s, const u8 *sa, in sme_sa_query_rx() argument
2892 wpa_dbg(wpa_s, MSG_DEBUG, "SME: Received SA Query frame from " in sme_sa_query_rx()
2896 if (wpa_sm_ocv_enabled(wpa_s->wpa)) { in sme_sa_query_rx()
2908 if (wpa_drv_channel_info(wpa_s, &ci) != 0) { in sme_sa_query_rx()
2917 wpa_msg(wpa_s, MSG_INFO, OCV_FAILURE "addr=" MACSTR in sme_sa_query_rx()
2927 sme_process_sa_query_request(wpa_s, sa, data, len); in sme_sa_query_rx()
2929 sme_process_sa_query_response(wpa_s, sa, data, len); in sme_sa_query_rx()