Lines Matching refs:hapd

40 static u8 * hostapd_eid_bss_load(struct hostapd_data *hapd, u8 *eid, size_t len)  in hostapd_eid_bss_load()  argument
46 if (hapd->conf->bss_load_test_set) { in hostapd_eid_bss_load()
49 os_memcpy(eid, hapd->conf->bss_load_test, 5); in hostapd_eid_bss_load()
54 if (hapd->conf->bss_load_update_period) { in hostapd_eid_bss_load()
57 WPA_PUT_LE16(eid, hapd->num_sta); in hostapd_eid_bss_load()
59 *eid++ = hapd->iface->channel_utilization; in hostapd_eid_bss_load()
67 static u8 ieee802_11_erp_info(struct hostapd_data *hapd) in ieee802_11_erp_info() argument
71 if (hapd->iface->current_mode == NULL || in ieee802_11_erp_info()
72 hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) in ieee802_11_erp_info()
75 if (hapd->iface->olbc) in ieee802_11_erp_info()
77 if (hapd->iface->num_sta_non_erp > 0) { in ieee802_11_erp_info()
81 if (hapd->iface->num_sta_no_short_preamble > 0 || in ieee802_11_erp_info()
82 hapd->iconf->preamble == LONG_PREAMBLE) in ieee802_11_erp_info()
89 static u8 * hostapd_eid_ds_params(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_ds_params() argument
91 enum hostapd_hw_mode hw_mode = hapd->iconf->hw_mode; in hostapd_eid_ds_params()
99 *eid++ = hapd->iconf->channel; in hostapd_eid_ds_params()
104 static u8 * hostapd_eid_erp_info(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_erp_info() argument
106 if (hapd->iface->current_mode == NULL || in hostapd_eid_erp_info()
107 hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) in hostapd_eid_erp_info()
122 *eid++ = ieee802_11_erp_info(hapd); in hostapd_eid_erp_info()
128 static u8 * hostapd_eid_pwr_constraint(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_pwr_constraint() argument
134 if (hapd->iface->current_mode == NULL || in hostapd_eid_pwr_constraint()
135 hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A) in hostapd_eid_pwr_constraint()
139 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) in hostapd_eid_pwr_constraint()
146 if (!hapd->iconf->ieee80211h && in hostapd_eid_pwr_constraint()
147 hapd->iconf->local_pwr_constraint == -1) in hostapd_eid_pwr_constraint()
151 dfs = hostapd_is_dfs_required(hapd->iface); in hostapd_eid_pwr_constraint()
158 if (dfs == 0 && hapd->iconf->local_pwr_constraint == -1) in hostapd_eid_pwr_constraint()
169 if (hapd->iconf->local_pwr_constraint == -1) in hostapd_eid_pwr_constraint()
190 *pos++ = hapd->iconf->local_pwr_constraint; in hostapd_eid_pwr_constraint()
196 static u8 * hostapd_eid_country_add(struct hostapd_data *hapd, u8 *pos, in hostapd_eid_country_add() argument
209 if (!is_6ghz_op_class(hapd->iconf->op_class)) in hostapd_eid_country_add()
218 static u8 * hostapd_fill_subband_triplets(struct hostapd_data *hapd, u8 *pos, in hostapd_fill_subband_triplets() argument
226 mode = hapd->iface->current_mode; in hostapd_fill_subband_triplets()
243 pos = hostapd_eid_country_add(hapd, pos, end, in hostapd_fill_subband_triplets()
252 pos = hostapd_eid_country_add(hapd, pos, end, chan_spacing, in hostapd_fill_subband_triplets()
260 static u8 * hostapd_eid_country(struct hostapd_data *hapd, u8 *eid, in hostapd_eid_country() argument
266 if (!hapd->iconf->ieee80211d || max_len < 6 || in hostapd_eid_country()
267 hapd->iface->current_mode == NULL) in hostapd_eid_country()
272 os_memcpy(pos, hapd->iconf->country, 3); /* e.g., 'US ' */ in hostapd_eid_country()
275 if (is_6ghz_op_class(hapd->iconf->op_class)) { in hostapd_eid_country()
285 *pos++ = hapd->iconf->op_class; in hostapd_eid_country()
289 if (hapd->iconf->op_class == 131 || in hostapd_eid_country()
290 hapd->iconf->op_class == 136) in hostapd_eid_country()
291 pos = hostapd_fill_subband_triplets(hapd, pos, end); in hostapd_eid_country()
293 pos = hostapd_fill_subband_triplets(hapd, pos, end); in hostapd_eid_country()
308 const u8 * hostapd_wpa_ie(struct hostapd_data *hapd, u8 eid) in hostapd_wpa_ie() argument
313 ies = wpa_auth_get_wpa_ie(hapd->wpa_auth, &ies_len); in hostapd_wpa_ie()
321 static const u8 * hostapd_vendor_wpa_ie(struct hostapd_data *hapd, in hostapd_vendor_wpa_ie() argument
327 ies = wpa_auth_get_wpa_ie(hapd->wpa_auth, &ies_len); in hostapd_vendor_wpa_ie()
335 static u8 * hostapd_get_rsne(struct hostapd_data *hapd, u8 *pos, size_t len) in hostapd_get_rsne() argument
339 ie = hostapd_wpa_ie(hapd, WLAN_EID_RSN); in hostapd_get_rsne()
348 static u8 * hostapd_get_mde(struct hostapd_data *hapd, u8 *pos, size_t len) in hostapd_get_mde() argument
352 ie = hostapd_wpa_ie(hapd, WLAN_EID_MOBILITY_DOMAIN); in hostapd_get_mde()
361 static u8 * hostapd_get_rsnxe(struct hostapd_data *hapd, u8 *pos, size_t len) in hostapd_get_rsnxe() argument
366 if (hapd->conf->no_beacon_rsnxe) { in hostapd_get_rsnxe()
371 ie = hostapd_wpa_ie(hapd, WLAN_EID_RSNX); in hostapd_get_rsnxe()
380 static u8 * hostapd_get_wpa_ie(struct hostapd_data *hapd, u8 *pos, size_t len) in hostapd_get_wpa_ie() argument
384 ie = hostapd_vendor_wpa_ie(hapd, WPA_IE_VENDOR_TYPE); in hostapd_get_wpa_ie()
393 static u8 * hostapd_get_osen_ie(struct hostapd_data *hapd, u8 *pos, size_t len) in hostapd_get_osen_ie() argument
397 ie = hostapd_vendor_wpa_ie(hapd, OSEN_IE_VENDOR_TYPE); in hostapd_get_osen_ie()
406 static u8 * hostapd_get_rsne_override(struct hostapd_data *hapd, u8 *pos, in hostapd_get_rsne_override() argument
411 ie = hostapd_vendor_wpa_ie(hapd, RSNE_OVERRIDE_IE_VENDOR_TYPE); in hostapd_get_rsne_override()
420 static u8 * hostapd_get_rsne_override_2(struct hostapd_data *hapd, u8 *pos, in hostapd_get_rsne_override_2() argument
425 ie = hostapd_vendor_wpa_ie(hapd, RSNE_OVERRIDE_2_IE_VENDOR_TYPE); in hostapd_get_rsne_override_2()
434 static u8 * hostapd_get_rsnxe_override(struct hostapd_data *hapd, u8 *pos, in hostapd_get_rsnxe_override() argument
439 ie = hostapd_vendor_wpa_ie(hapd, RSNXE_OVERRIDE_IE_VENDOR_TYPE); in hostapd_get_rsnxe_override()
448 static size_t hostapd_get_rsne_override_len(struct hostapd_data *hapd) in hostapd_get_rsne_override_len() argument
452 ie = hostapd_vendor_wpa_ie(hapd, RSNE_OVERRIDE_IE_VENDOR_TYPE); in hostapd_get_rsne_override_len()
459 static size_t hostapd_get_rsne_override_2_len(struct hostapd_data *hapd) in hostapd_get_rsne_override_2_len() argument
463 ie = hostapd_vendor_wpa_ie(hapd, RSNE_OVERRIDE_2_IE_VENDOR_TYPE); in hostapd_get_rsne_override_2_len()
470 static size_t hostapd_get_rsnxe_override_len(struct hostapd_data *hapd) in hostapd_get_rsnxe_override_len() argument
474 ie = hostapd_vendor_wpa_ie(hapd, RSNXE_OVERRIDE_IE_VENDOR_TYPE); in hostapd_get_rsnxe_override_len()
481 static u8 * hostapd_eid_csa(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_csa() argument
484 if (hapd->iface->cs_oper_class && hapd->iconf->ecsa_ie_only) in hostapd_eid_csa()
488 if (!hapd->cs_freq_params.channel) in hostapd_eid_csa()
493 *eid++ = hapd->cs_block_tx; in hostapd_eid_csa()
494 *eid++ = hapd->cs_freq_params.channel; in hostapd_eid_csa()
495 *eid++ = hapd->cs_count; in hostapd_eid_csa()
501 static u8 * hostapd_eid_ecsa(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_ecsa() argument
503 if (!hapd->cs_freq_params.channel || !hapd->iface->cs_oper_class) in hostapd_eid_ecsa()
508 *eid++ = hapd->cs_block_tx; in hostapd_eid_ecsa()
509 *eid++ = hapd->iface->cs_oper_class; in hostapd_eid_ecsa()
510 *eid++ = hapd->cs_freq_params.channel; in hostapd_eid_ecsa()
511 *eid++ = hapd->cs_count; in hostapd_eid_ecsa()
517 static u8 * hostapd_eid_supported_op_classes(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_supported_op_classes() argument
521 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) || in hostapd_eid_supported_op_classes()
522 !hapd->iface->freq) in hostapd_eid_supported_op_classes()
525 if (ieee80211_freq_to_channel_ext(hapd->iface->freq, in hostapd_eid_supported_op_classes()
526 hapd->iconf->secondary_channel, in hostapd_eid_supported_op_classes()
527 hostapd_get_oper_chwidth(hapd->iconf), in hostapd_eid_supported_op_classes()
546 ieee802_11_build_ap_params_mbssid(struct hostapd_data *hapd, in ieee802_11_build_ap_params_mbssid() argument
549 struct hostapd_iface *iface = hapd->iface; in ieee802_11_build_ap_params_mbssid()
570 tx_bss = hostapd_mbssid_get_tx_bss(hapd); in ieee802_11_build_ap_params_mbssid()
600 params->mbssid_index = hostapd_mbssid_get_bss_index(hapd); in ieee802_11_build_ap_params_mbssid()
624 static u8 * hostapd_eid_mbssid_config(struct hostapd_data *hapd, u8 *eid, in hostapd_eid_mbssid_config() argument
627 struct hostapd_iface *iface = hapd->iface; in hostapd_eid_mbssid_config()
641 static size_t he_elem_len(struct hostapd_data *hapd) in he_elem_len() argument
646 if (!hapd->iconf->ieee80211ax || hapd->conf->disable_11ax) in he_elem_len()
653 if (is_6ghz_op_class(hapd->iconf->op_class)) { in he_elem_len()
658 if (he_reg_is_indoor(hapd->iconf->he_6ghz_reg_pwr_type)) in he_elem_len()
664 if (hapd->iconf->reg_def_cli_eirp != -1 && in he_elem_len()
665 he_reg_is_sp(hapd->iconf->he_6ghz_reg_pwr_type)) in he_elem_len()
708 static size_t hostapd_probe_resp_elems_len(struct hostapd_data *hapd, in hostapd_probe_resp_elems_len() argument
714 if (hapd->wps_probe_resp_ie) in hostapd_probe_resp_elems_len()
715 buflen += wpabuf_len(hapd->wps_probe_resp_ie); in hostapd_probe_resp_elems_len()
718 if (hapd->p2p_probe_resp_ie) in hostapd_probe_resp_elems_len()
719 buflen += wpabuf_len(hapd->p2p_probe_resp_ie); in hostapd_probe_resp_elems_len()
722 if (hapd->iface->fst_ies) in hostapd_probe_resp_elems_len()
723 buflen += wpabuf_len(hapd->iface->fst_ies); in hostapd_probe_resp_elems_len()
725 if (hapd->conf->vendor_elements) in hostapd_probe_resp_elems_len()
726 buflen += wpabuf_len(hapd->conf->vendor_elements); in hostapd_probe_resp_elems_len()
728 if (hapd->conf->presp_elements) in hostapd_probe_resp_elems_len()
729 buflen += wpabuf_len(hapd->conf->presp_elements); in hostapd_probe_resp_elems_len()
731 if (hapd->conf->vendor_vht) { in hostapd_probe_resp_elems_len()
736 buflen += he_elem_len(hapd); in hostapd_probe_resp_elems_len()
739 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in hostapd_probe_resp_elems_len()
740 buflen += hostapd_eid_eht_capab_len(hapd, IEEE80211_MODE_AP); in hostapd_probe_resp_elems_len()
742 if (hapd->iconf->punct_bitmap) in hostapd_probe_resp_elems_len()
745 if (!params->is_ml_sta_info && hapd->conf->mld_ap) { in hostapd_probe_resp_elems_len()
747 params->mld_ap ? params->mld_ap : hapd; in hostapd_probe_resp_elems_len()
755 buflen += hostapd_eid_mbssid_len(hapd, WLAN_FC_STYPE_PROBE_RESP, NULL, in hostapd_probe_resp_elems_len()
759 buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP, in hostapd_probe_resp_elems_len()
761 buflen += hostapd_mbo_ie_len(hapd); in hostapd_probe_resp_elems_len()
762 buflen += hostapd_eid_owe_trans_len(hapd); in hostapd_probe_resp_elems_len()
763 buflen += hostapd_eid_dpp_cc_len(hapd); in hostapd_probe_resp_elems_len()
764 buflen += hostapd_get_rsne_override_len(hapd); in hostapd_probe_resp_elems_len()
765 buflen += hostapd_get_rsne_override_2_len(hapd); in hostapd_probe_resp_elems_len()
766 buflen += hostapd_get_rsnxe_override_len(hapd); in hostapd_probe_resp_elems_len()
772 static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, in hostapd_probe_resp_fill_elems() argument
783 *pos++ = hapd->conf->ssid.ssid_len; in hostapd_probe_resp_fill_elems()
784 os_memcpy(pos, hapd->conf->ssid.ssid, in hostapd_probe_resp_fill_elems()
785 hapd->conf->ssid.ssid_len); in hostapd_probe_resp_fill_elems()
786 pos += hapd->conf->ssid.ssid_len; in hostapd_probe_resp_fill_elems()
790 pos = hostapd_eid_supp_rates(hapd, pos); in hostapd_probe_resp_fill_elems()
793 pos = hostapd_eid_ds_params(hapd, pos); in hostapd_probe_resp_fill_elems()
795 pos = hostapd_eid_country(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
798 pos = hostapd_eid_pwr_constraint(hapd, pos); in hostapd_probe_resp_fill_elems()
805 csa_pos = hostapd_eid_csa(hapd, pos); in hostapd_probe_resp_fill_elems()
814 pos = hostapd_eid_erp_info(hapd, pos); in hostapd_probe_resp_fill_elems()
817 pos = hostapd_eid_ext_supp_rates(hapd, pos); in hostapd_probe_resp_fill_elems()
819 pos = hostapd_get_rsne(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
820 pos = hostapd_eid_bss_load(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
821 pos = hostapd_eid_mbssid(hapd, pos, epos, WLAN_FC_STYPE_PROBE_RESP, 0, in hostapd_probe_resp_fill_elems()
824 pos = hostapd_eid_rm_enabled_capab(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
825 pos = hostapd_get_mde(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
832 csa_pos = hostapd_eid_ecsa(hapd, pos); in hostapd_probe_resp_fill_elems()
840 pos = hostapd_eid_supported_op_classes(hapd, pos); in hostapd_probe_resp_fill_elems()
841 pos = hostapd_eid_ht_capabilities(hapd, pos); in hostapd_probe_resp_fill_elems()
842 pos = hostapd_eid_ht_operation(hapd, pos); in hostapd_probe_resp_fill_elems()
846 pos = hostapd_eid_ext_capab(hapd, pos, in hostapd_probe_resp_fill_elems()
847 hapd->iconf->mbssid >= MBSSID_ENABLED && in hostapd_probe_resp_fill_elems()
850 pos = hostapd_eid_time_adv(hapd, pos); in hostapd_probe_resp_fill_elems()
851 pos = hostapd_eid_time_zone(hapd, pos); in hostapd_probe_resp_fill_elems()
853 pos = hostapd_eid_interworking(hapd, pos); in hostapd_probe_resp_fill_elems()
854 pos = hostapd_eid_adv_proto(hapd, pos); in hostapd_probe_resp_fill_elems()
855 pos = hostapd_eid_roaming_consortium(hapd, pos); in hostapd_probe_resp_fill_elems()
858 if (hapd->iface->fst_ies) { in hostapd_probe_resp_fill_elems()
859 os_memcpy(pos, wpabuf_head(hapd->iface->fst_ies), in hostapd_probe_resp_fill_elems()
860 wpabuf_len(hapd->iface->fst_ies)); in hostapd_probe_resp_fill_elems()
861 pos += wpabuf_len(hapd->iface->fst_ies); in hostapd_probe_resp_fill_elems()
866 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac && in hostapd_probe_resp_fill_elems()
867 !is_6ghz_op_class(hapd->iconf->op_class)) { in hostapd_probe_resp_fill_elems()
868 pos = hostapd_eid_vht_capabilities(hapd, pos, 0); in hostapd_probe_resp_fill_elems()
869 pos = hostapd_eid_vht_operation(hapd, pos); in hostapd_probe_resp_fill_elems()
870 pos = hostapd_eid_txpower_envelope(hapd, pos); in hostapd_probe_resp_fill_elems()
875 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax && in hostapd_probe_resp_fill_elems()
876 is_6ghz_op_class(hapd->iconf->op_class)) in hostapd_probe_resp_fill_elems()
877 pos = hostapd_eid_txpower_envelope(hapd, pos); in hostapd_probe_resp_fill_elems()
880 pos = hostapd_eid_wb_chsw_wrapper(hapd, pos); in hostapd_probe_resp_fill_elems()
883 pos = hostapd_eid_rnr(hapd, pos, WLAN_FC_STYPE_PROBE_RESP, in hostapd_probe_resp_fill_elems()
885 pos = hostapd_eid_fils_indic(hapd, pos, 0); in hostapd_probe_resp_fill_elems()
886 pos = hostapd_get_rsnxe(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
889 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { in hostapd_probe_resp_fill_elems()
892 pos = hostapd_eid_he_capab(hapd, pos, IEEE80211_MODE_AP); in hostapd_probe_resp_fill_elems()
893 pos = hostapd_eid_he_operation(hapd, pos); in hostapd_probe_resp_fill_elems()
896 cca_pos = hostapd_eid_cca(hapd, pos); in hostapd_probe_resp_fill_elems()
903 pos = hostapd_eid_spatial_reuse(hapd, pos); in hostapd_probe_resp_fill_elems()
904 pos = hostapd_eid_he_mu_edca_parameter_set(hapd, pos); in hostapd_probe_resp_fill_elems()
905 pos = hostapd_eid_he_6ghz_band_cap(hapd, pos); in hostapd_probe_resp_fill_elems()
910 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in hostapd_probe_resp_fill_elems()
912 params->mld_ap ? params->mld_ap : hapd; in hostapd_probe_resp_fill_elems()
919 pos = hostapd_eid_eht_capab(hapd, pos, IEEE80211_MODE_AP); in hostapd_probe_resp_fill_elems()
920 pos = hostapd_eid_eht_operation(hapd, pos); in hostapd_probe_resp_fill_elems()
925 if (hapd->conf->vendor_vht) in hostapd_probe_resp_fill_elems()
926 pos = hostapd_eid_vendor_vht(hapd, pos); in hostapd_probe_resp_fill_elems()
930 pos = hostapd_get_wpa_ie(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
931 pos = hostapd_get_osen_ie(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
934 pos = hostapd_eid_wmm(hapd, pos); in hostapd_probe_resp_fill_elems()
937 if (hapd->conf->wps_state && hapd->wps_probe_resp_ie) { in hostapd_probe_resp_fill_elems()
938 os_memcpy(pos, wpabuf_head(hapd->wps_probe_resp_ie), in hostapd_probe_resp_fill_elems()
939 wpabuf_len(hapd->wps_probe_resp_ie)); in hostapd_probe_resp_fill_elems()
940 pos += wpabuf_len(hapd->wps_probe_resp_ie); in hostapd_probe_resp_fill_elems()
945 if ((hapd->conf->p2p & P2P_ENABLED) && params->is_p2p && in hostapd_probe_resp_fill_elems()
946 hapd->p2p_probe_resp_ie) { in hostapd_probe_resp_fill_elems()
947 os_memcpy(pos, wpabuf_head(hapd->p2p_probe_resp_ie), in hostapd_probe_resp_fill_elems()
948 wpabuf_len(hapd->p2p_probe_resp_ie)); in hostapd_probe_resp_fill_elems()
949 pos += wpabuf_len(hapd->p2p_probe_resp_ie); in hostapd_probe_resp_fill_elems()
953 if ((hapd->conf->p2p & (P2P_MANAGE | P2P_ENABLED | P2P_GROUP_OWNER)) == in hostapd_probe_resp_fill_elems()
955 pos = hostapd_eid_p2p_manage(hapd, pos); in hostapd_probe_resp_fill_elems()
959 pos = hostapd_eid_hs20_indication(hapd, pos); in hostapd_probe_resp_fill_elems()
962 pos = hostapd_eid_mbo(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
963 pos = hostapd_eid_owe_trans(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
964 pos = hostapd_eid_dpp_cc(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
966 pos = hostapd_get_rsne_override(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
967 pos = hostapd_get_rsne_override_2(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
968 pos = hostapd_get_rsnxe_override(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
970 if (hapd->conf->vendor_elements) { in hostapd_probe_resp_fill_elems()
971 os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements), in hostapd_probe_resp_fill_elems()
972 wpabuf_len(hapd->conf->vendor_elements)); in hostapd_probe_resp_fill_elems()
973 pos += wpabuf_len(hapd->conf->vendor_elements); in hostapd_probe_resp_fill_elems()
977 if (hapd->conf->presp_elements) { in hostapd_probe_resp_fill_elems()
978 os_memcpy(pos, wpabuf_head(hapd->conf->presp_elements), in hostapd_probe_resp_fill_elems()
979 wpabuf_len(hapd->conf->presp_elements)); in hostapd_probe_resp_fill_elems()
980 pos += wpabuf_len(hapd->conf->presp_elements); in hostapd_probe_resp_fill_elems()
988 static void hostapd_gen_probe_resp(struct hostapd_data *hapd, in hostapd_gen_probe_resp() argument
994 hapd = hostapd_mbssid_get_tx_bss(hapd); in hostapd_gen_probe_resp()
998 buflen += hostapd_probe_resp_elems_len(hapd, params); in hostapd_gen_probe_resp()
1013 if (params->req && (!is_6ghz_op_class(hapd->iconf->op_class) || in hostapd_gen_probe_resp()
1014 hapd->conf->ignore_broadcast_ssid)) in hostapd_gen_probe_resp()
1018 os_memcpy(params->resp->sa, hapd->own_addr, ETH_ALEN); in hostapd_gen_probe_resp()
1020 os_memcpy(params->resp->bssid, hapd->own_addr, ETH_ALEN); in hostapd_gen_probe_resp()
1022 host_to_le16(hapd->iconf->beacon_int); in hostapd_gen_probe_resp()
1026 host_to_le16(hostapd_own_capab_info(hapd)); in hostapd_gen_probe_resp()
1028 pos = hostapd_probe_resp_fill_elems(hapd, params, in hostapd_gen_probe_resp()
1037 static void hostapd_fill_probe_resp_ml_params(struct hostapd_data *hapd, in hostapd_fill_probe_resp_ml_params() argument
1054 for_each_mld_link(link, hapd) { in hostapd_fill_probe_resp_ml_params()
1067 if (mld_id != -1 && link->iface == hapd->iface) in hostapd_fill_probe_resp_ml_params()
1071 if (link == hapd) in hostapd_fill_probe_resp_ml_params()
1104 WPA_PUT_LE16(epos, hostapd_own_capab_info(hapd)); in hostapd_fill_probe_resp_ml_params()
1148 static enum ssid_match_result ssid_match(struct hostapd_data *hapd, in ssid_match() argument
1156 struct hostapd_iface *iface = hapd->iface; in ssid_match()
1162 if (ssid_len == hapd->conf->ssid.ssid_len && in ssid_match()
1163 os_memcmp(ssid, hapd->conf->ssid.ssid, ssid_len) == 0) in ssid_match()
1174 if (pos[1] == hapd->conf->ssid.ssid_len && in ssid_match()
1175 os_memcmp(pos + 2, hapd->conf->ssid.ssid, in ssid_match()
1186 if (hapd->conf->ssid.short_ssid == WPA_GET_LE32(pos)) in ssid_match()
1196 is_6ghz_op_class(hapd->iconf->op_class)) in ssid_match()
1304 struct hostapd_data *hapd = NULL; in sta_track_seen_on() local
1308 hapd = iface->bss[j]; in sta_track_seen_on()
1309 if (os_strcmp(ifname, hapd->conf->iface) == 0) in sta_track_seen_on()
1311 hapd = NULL; in sta_track_seen_on()
1314 if (hapd && sta_track_get(iface, addr)) in sta_track_seen_on()
1315 return hapd; in sta_track_seen_on()
1423 void handle_probe_req(struct hostapd_data *hapd, in handle_probe_req() argument
1443 if (hapd->iconf->rssi_ignore_probe_request && ssi_signal && in handle_probe_req()
1444 ssi_signal < hapd->iconf->rssi_ignore_probe_request) in handle_probe_req()
1450 if (hapd->iconf->track_sta_max_num) in handle_probe_req()
1451 sta_track_add(hapd->iface, mgmt->sa, ssi_signal); in handle_probe_req()
1454 ret = hostapd_allowed_address(hapd, mgmt->sa, (const u8 *) mgmt, len, in handle_probe_req()
1457 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in handle_probe_req()
1463 for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++) in handle_probe_req()
1464 if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx, in handle_probe_req()
1469 if (!hapd->conf->send_probe_response) in handle_probe_req()
1496 hapd->iface->current_mode && in handle_probe_req()
1497 (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G || in handle_probe_req()
1498 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211B) && in handle_probe_req()
1499 hapd->iconf->channel != elems.ds_params[0]) { in handle_probe_req()
1502 hapd->iconf->channel, elems.ds_params[0]); in handle_probe_req()
1507 if (hapd->p2p && hapd->p2p_group && elems.wps_ie) { in handle_probe_req()
1510 if (wps && !p2p_group_match_dev_type(hapd->p2p_group, wps)) { in handle_probe_req()
1520 if (hapd->p2p && hapd->p2p_group && elems.p2p) { in handle_probe_req()
1523 if (p2p && !p2p_group_match_dev_id(hapd->p2p_group, p2p)) { in handle_probe_req()
1533 if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && in handle_probe_req()
1541 if ((hapd->conf->p2p & P2P_GROUP_OWNER) && in handle_probe_req()
1555 if ((sta = ap_get_sta(hapd, mgmt->sa)) != NULL) { in handle_probe_req()
1556 taxonomy_sta_info_probe_req(hapd, sta, ie, ie_len); in handle_probe_req()
1557 } else if ((info = sta_track_get(hapd->iface, in handle_probe_req()
1559 taxonomy_hostapd_sta_info_probe_req(hapd, info, in handle_probe_req()
1565 res = ssid_match(hapd, elems.ssid, elems.ssid_len, in handle_probe_req()
1580 if (hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) { in handle_probe_req()
1587 if (hapd->conf->interworking && in handle_probe_req()
1591 ant != hapd->conf->access_network_type) { in handle_probe_req()
1599 if (hapd->conf->interworking && elems.interworking && in handle_probe_req()
1607 !ether_addr_equal(hessid, hapd->conf->hessid)) { in handle_probe_req()
1618 if ((hapd->conf->p2p & P2P_GROUP_OWNER) && in handle_probe_req()
1631 if (hapd->conf->no_probe_resp_if_seen_on && in handle_probe_req()
1634 sta_track_seen_on(hapd->iface, mgmt->sa, in handle_probe_req()
1635 hapd->conf->no_probe_resp_if_seen_on)) { in handle_probe_req()
1638 hapd->conf->iface, MAC2STR(mgmt->sa), in handle_probe_req()
1639 hapd->conf->no_probe_resp_if_seen_on); in handle_probe_req()
1643 if (hapd->conf->no_probe_resp_if_max_sta && in handle_probe_req()
1646 hapd->num_sta >= hapd->conf->max_num_sta && in handle_probe_req()
1647 !ap_get_sta(hapd, mgmt->sa)) { in handle_probe_req()
1650 hapd->conf->iface, MAC2STR(mgmt->sa)); in handle_probe_req()
1655 if (hapd->iconf->ignore_probe_probability > 0.0 && in handle_probe_req()
1656 drand48() < hapd->iconf->ignore_probe_probability) { in handle_probe_req()
1667 if (hapd != hostapd_mbssid_get_tx_bss(hapd) && res != EXACT_SSID_MATCH) in handle_probe_req()
1670 wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, RX_PROBE_REQUEST "sa=" MACSTR in handle_probe_req()
1676 if (hapd->conf->mld_ap && elems.probe_req_mle && in handle_probe_req()
1679 hostapd_fill_probe_resp_ml_params(hapd, &params, mgmt, in handle_probe_req()
1690 hostapd_gen_probe_resp(hapd, &params); in handle_probe_req()
1705 if (hapd->csa_in_progress) { in handle_probe_req()
1715 ret = hostapd_drv_send_mlme(hapd, params.resp, params.resp_len, noack, in handle_probe_req()
1730 static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd, in hostapd_probe_resp_offloads() argument
1736 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD)) in hostapd_probe_resp_offloads()
1740 if (hapd->conf->wps_state && hapd->wps_probe_resp_ie && in hostapd_probe_resp_offloads()
1741 (!(hapd->iface->probe_resp_offloads & in hostapd_probe_resp_offloads()
1749 if ((hapd->conf->p2p & P2P_ENABLED) && hapd->p2p_probe_resp_ie && in hostapd_probe_resp_offloads()
1750 !(hapd->iface->probe_resp_offloads & in hostapd_probe_resp_offloads()
1756 if (hapd->conf->interworking && in hostapd_probe_resp_offloads()
1757 !(hapd->iface->probe_resp_offloads & in hostapd_probe_resp_offloads()
1773 hostapd_gen_probe_resp(hapd, &params); in hostapd_probe_resp_offloads()
1780 hapd->cs_c_off_proberesp = params.csa_pos - (u8 *) params.resp; in hostapd_probe_resp_offloads()
1782 hapd->cs_c_off_ecsa_proberesp = params.ecsa_pos - in hostapd_probe_resp_offloads()
1786 hapd->cca_c_off_proberesp = params.cca_pos - (u8 *) params.resp; in hostapd_probe_resp_offloads()
1797 u8 * hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd, in hostapd_unsol_bcast_probe_resp() argument
1802 if (!is_6ghz_op_class(hapd->iconf->op_class)) in hostapd_unsol_bcast_probe_resp()
1806 hapd->conf->unsol_bcast_probe_resp_interval; in hostapd_unsol_bcast_probe_resp()
1817 hostapd_gen_probe_resp(hapd, &probe_params); in hostapd_unsol_bcast_probe_resp()
1836 static u16 hostapd_gen_fils_discovery_phy_index(struct hostapd_data *hapd) in hostapd_gen_fils_discovery_phy_index() argument
1839 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) in hostapd_gen_fils_discovery_phy_index()
1844 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) in hostapd_gen_fils_discovery_phy_index()
1849 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) in hostapd_gen_fils_discovery_phy_index()
1853 if (hapd->iconf->ieee80211n && !hapd->conf->disable_11n) in hostapd_gen_fils_discovery_phy_index()
1954 static u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd) in hostapd_fils_discovery_cap() argument
1958 struct hostapd_hw_modes *mode = hapd->iface->current_mode; in hostapd_fils_discovery_cap()
1961 if (hapd->conf->wpa) in hostapd_fils_discovery_cap()
1964 if (is_6ghz_op_class(hapd->iconf->op_class)) { in hostapd_fils_discovery_cap()
1965 switch (hapd->iconf->op_class) { in hostapd_fils_discovery_cap()
1984 switch (hostapd_get_oper_chwidth(hapd->iconf)) { in hostapd_fils_discovery_cap()
1996 if (hapd->iconf->secondary_channel) in hostapd_fils_discovery_cap()
2006 phy_index = hostapd_gen_fils_discovery_phy_index(hapd); in hostapd_fils_discovery_cap()
2015 static u8 * hostapd_gen_fils_discovery(struct hostapd_data *hapd, size_t *len) in hostapd_gen_fils_discovery() argument
2027 ctl = (sizeof(hapd->conf->ssid.short_ssid) - 1) | in hostapd_gen_fils_discovery()
2035 if (is_6ghz_op_class(hapd->iconf->op_class) && in hostapd_gen_fils_discovery()
2037 NULL, hapd->iconf->op_class, in hostapd_gen_fils_discovery()
2038 hapd->iconf->channel)) && in hostapd_gen_fils_discovery()
2039 op_class_to_bandwidth(hapd->iconf->op_class) > 20) { in hostapd_gen_fils_discovery()
2045 if (wpa_auth_write_fd_rsn_info(hapd->wpa_auth, fd_rsn_info)) { in hostapd_gen_fils_discovery()
2050 mobility_domain = hostapd_wpa_ie(hapd, WLAN_EID_MOBILITY_DOMAIN); in hostapd_gen_fils_discovery()
2056 total_len += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_ACTION, true); in hostapd_gen_fils_discovery()
2058 pos = hostapd_eid_fils_indic(hapd, buf, 0); in hostapd_gen_fils_discovery()
2064 total_len += he_elem_len(hapd); in hostapd_gen_fils_discovery()
2073 os_memcpy(head->sa, hapd->own_addr, ETH_ALEN); in hostapd_gen_fils_discovery()
2074 os_memcpy(head->bssid, hapd->own_addr, ETH_ALEN); in hostapd_gen_fils_discovery()
2091 WPA_PUT_LE16(pos, hapd->iconf->beacon_int); in hostapd_gen_fils_discovery()
2095 WPA_PUT_LE32(pos, hapd->conf->ssid.short_ssid); in hostapd_gen_fils_discovery()
2096 pos += sizeof(hapd->conf->ssid.short_ssid); in hostapd_gen_fils_discovery()
2102 WPA_PUT_LE16(pos, hostapd_fils_discovery_cap(hapd)); in hostapd_gen_fils_discovery()
2107 *pos++ = hapd->iconf->op_class; in hostapd_gen_fils_discovery()
2108 *pos++ = hapd->iconf->channel; in hostapd_gen_fils_discovery()
2132 pos = hostapd_eid_rnr(hapd, pos, WLAN_FC_STYPE_ACTION, true); in hostapd_gen_fils_discovery()
2140 if (is_6ghz_op_class(hapd->iconf->op_class)) in hostapd_gen_fils_discovery()
2141 pos = hostapd_eid_txpower_envelope(hapd, pos); in hostapd_gen_fils_discovery()
2151 static u8 * hostapd_fils_discovery(struct hostapd_data *hapd, in hostapd_fils_discovery() argument
2154 params->fd_max_int = hapd->conf->fils_discovery_max_int; in hostapd_fils_discovery()
2155 if (is_6ghz_op_class(hapd->iconf->op_class) && in hostapd_fils_discovery()
2159 params->fd_min_int = hapd->conf->fils_discovery_min_int; in hostapd_fils_discovery()
2164 return hostapd_gen_fils_discovery(hapd, in hostapd_fils_discovery()
2173 int ieee802_11_build_ap_params(struct hostapd_data *hapd, in ieee802_11_build_ap_params() argument
2195 if (hapd->conf->wps_state && hapd->wps_beacon_ie) in ieee802_11_build_ap_params()
2196 tail_len += wpabuf_len(hapd->wps_beacon_ie); in ieee802_11_build_ap_params()
2199 if (hapd->p2p_beacon_ie) in ieee802_11_build_ap_params()
2200 tail_len += wpabuf_len(hapd->p2p_beacon_ie); in ieee802_11_build_ap_params()
2203 if (hapd->iface->fst_ies) in ieee802_11_build_ap_params()
2204 tail_len += wpabuf_len(hapd->iface->fst_ies); in ieee802_11_build_ap_params()
2206 if (hapd->conf->vendor_elements) in ieee802_11_build_ap_params()
2207 tail_len += wpabuf_len(hapd->conf->vendor_elements); in ieee802_11_build_ap_params()
2210 if (hapd->conf->vendor_vht) { in ieee802_11_build_ap_params()
2216 tail_len += he_elem_len(hapd); in ieee802_11_build_ap_params()
2219 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in ieee802_11_build_ap_params()
2220 tail_len += hostapd_eid_eht_capab_len(hapd, IEEE80211_MODE_AP); in ieee802_11_build_ap_params()
2222 if (hapd->iconf->punct_bitmap) in ieee802_11_build_ap_params()
2230 if (hapd->conf->mld_ap) in ieee802_11_build_ap_params()
2235 if (hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED && in ieee802_11_build_ap_params()
2236 hapd == hostapd_mbssid_get_tx_bss(hapd)) in ieee802_11_build_ap_params()
2238 tail_len += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_BEACON, true); in ieee802_11_build_ap_params()
2239 tail_len += hostapd_mbo_ie_len(hapd); in ieee802_11_build_ap_params()
2240 tail_len += hostapd_eid_owe_trans_len(hapd); in ieee802_11_build_ap_params()
2241 tail_len += hostapd_eid_dpp_cc_len(hapd); in ieee802_11_build_ap_params()
2242 tail_len += hostapd_get_rsne_override_len(hapd); in ieee802_11_build_ap_params()
2243 tail_len += hostapd_get_rsne_override_2_len(hapd); in ieee802_11_build_ap_params()
2244 tail_len += hostapd_get_rsnxe_override_len(hapd); in ieee802_11_build_ap_params()
2260 os_memcpy(head->sa, hapd->own_addr, ETH_ALEN); in ieee802_11_build_ap_params()
2261 os_memcpy(head->bssid, hapd->own_addr, ETH_ALEN); in ieee802_11_build_ap_params()
2263 host_to_le16(hapd->iconf->beacon_int); in ieee802_11_build_ap_params()
2266 capab_info = hostapd_own_capab_info(hapd); in ieee802_11_build_ap_params()
2272 if (hapd->conf->ignore_broadcast_ssid == 2) { in ieee802_11_build_ap_params()
2274 *pos++ = hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
2275 os_memset(pos, 0, hapd->conf->ssid.ssid_len); in ieee802_11_build_ap_params()
2276 pos += hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
2277 } else if (hapd->conf->ignore_broadcast_ssid) { in ieee802_11_build_ap_params()
2280 *pos++ = hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
2281 os_memcpy(pos, hapd->conf->ssid.ssid, in ieee802_11_build_ap_params()
2282 hapd->conf->ssid.ssid_len); in ieee802_11_build_ap_params()
2283 pos += hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
2287 pos = hostapd_eid_supp_rates(hapd, pos); in ieee802_11_build_ap_params()
2290 pos = hostapd_eid_ds_params(hapd, pos); in ieee802_11_build_ap_params()
2294 tailpos = hostapd_eid_country(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2297 tailpos = hostapd_eid_pwr_constraint(hapd, tailpos); in ieee802_11_build_ap_params()
2300 csa_pos = hostapd_eid_csa(hapd, tailpos); in ieee802_11_build_ap_params()
2302 hapd->cs_c_off_beacon = csa_pos - tail - 1; in ieee802_11_build_ap_params()
2306 tailpos = hostapd_eid_erp_info(hapd, tailpos); in ieee802_11_build_ap_params()
2309 tailpos = hostapd_eid_ext_supp_rates(hapd, tailpos); in ieee802_11_build_ap_params()
2311 tailpos = hostapd_get_rsne(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2312 tailpos = hostapd_eid_bss_load(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2313 tailpos = hostapd_eid_rm_enabled_capab(hapd, tailpos, in ieee802_11_build_ap_params()
2315 tailpos = hostapd_get_mde(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2318 csa_pos = hostapd_eid_ecsa(hapd, tailpos); in ieee802_11_build_ap_params()
2320 hapd->cs_c_off_ecsa_beacon = csa_pos - tail - 1; in ieee802_11_build_ap_params()
2323 tailpos = hostapd_eid_supported_op_classes(hapd, tailpos); in ieee802_11_build_ap_params()
2324 tailpos = hostapd_eid_ht_capabilities(hapd, tailpos); in ieee802_11_build_ap_params()
2325 tailpos = hostapd_eid_ht_operation(hapd, tailpos); in ieee802_11_build_ap_params()
2327 if (hapd->iconf->mbssid && hapd->iconf->num_bss > 1) { in ieee802_11_build_ap_params()
2328 if (ieee802_11_build_ap_params_mbssid(hapd, params)) { in ieee802_11_build_ap_params()
2335 complete = hapd->iconf->mbssid == MBSSID_ENABLED || in ieee802_11_build_ap_params()
2336 (hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED && in ieee802_11_build_ap_params()
2340 tailpos = hostapd_eid_ext_capab(hapd, tailpos, complete); in ieee802_11_build_ap_params()
2346 tailpos = hostapd_eid_time_adv(hapd, tailpos); in ieee802_11_build_ap_params()
2348 tailpos = hostapd_eid_interworking(hapd, tailpos); in ieee802_11_build_ap_params()
2349 tailpos = hostapd_eid_adv_proto(hapd, tailpos); in ieee802_11_build_ap_params()
2350 tailpos = hostapd_eid_roaming_consortium(hapd, tailpos); in ieee802_11_build_ap_params()
2353 if (hapd->iface->fst_ies) { in ieee802_11_build_ap_params()
2354 os_memcpy(tailpos, wpabuf_head(hapd->iface->fst_ies), in ieee802_11_build_ap_params()
2355 wpabuf_len(hapd->iface->fst_ies)); in ieee802_11_build_ap_params()
2356 tailpos += wpabuf_len(hapd->iface->fst_ies); in ieee802_11_build_ap_params()
2361 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac && in ieee802_11_build_ap_params()
2362 !is_6ghz_op_class(hapd->iconf->op_class)) { in ieee802_11_build_ap_params()
2363 tailpos = hostapd_eid_vht_capabilities(hapd, tailpos, 0); in ieee802_11_build_ap_params()
2364 tailpos = hostapd_eid_vht_operation(hapd, tailpos); in ieee802_11_build_ap_params()
2365 tailpos = hostapd_eid_txpower_envelope(hapd, tailpos); in ieee802_11_build_ap_params()
2370 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax && in ieee802_11_build_ap_params()
2371 is_6ghz_op_class(hapd->iconf->op_class)) in ieee802_11_build_ap_params()
2372 tailpos = hostapd_eid_txpower_envelope(hapd, tailpos); in ieee802_11_build_ap_params()
2375 tailpos = hostapd_eid_wb_chsw_wrapper(hapd, tailpos); in ieee802_11_build_ap_params()
2377 tailpos = hostapd_eid_rnr(hapd, tailpos, WLAN_FC_STYPE_BEACON, true); in ieee802_11_build_ap_params()
2378 tailpos = hostapd_eid_fils_indic(hapd, tailpos, 0); in ieee802_11_build_ap_params()
2379 tailpos = hostapd_get_rsnxe(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2380 tailpos = hostapd_eid_mbssid_config(hapd, tailpos, in ieee802_11_build_ap_params()
2384 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { in ieee802_11_build_ap_params()
2387 tailpos = hostapd_eid_he_capab(hapd, tailpos, in ieee802_11_build_ap_params()
2389 tailpos = hostapd_eid_he_operation(hapd, tailpos); in ieee802_11_build_ap_params()
2392 cca_pos = hostapd_eid_cca(hapd, tailpos); in ieee802_11_build_ap_params()
2394 hapd->cca_c_off_beacon = cca_pos - tail - 2; in ieee802_11_build_ap_params()
2397 tailpos = hostapd_eid_spatial_reuse(hapd, tailpos); in ieee802_11_build_ap_params()
2398 tailpos = hostapd_eid_he_mu_edca_parameter_set(hapd, tailpos); in ieee802_11_build_ap_params()
2399 tailpos = hostapd_eid_he_6ghz_band_cap(hapd, tailpos); in ieee802_11_build_ap_params()
2404 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in ieee802_11_build_ap_params()
2405 if (hapd->conf->mld_ap) in ieee802_11_build_ap_params()
2406 tailpos = hostapd_eid_eht_ml_beacon(hapd, NULL, in ieee802_11_build_ap_params()
2408 tailpos = hostapd_eid_eht_capab(hapd, tailpos, in ieee802_11_build_ap_params()
2410 tailpos = hostapd_eid_eht_operation(hapd, tailpos); in ieee802_11_build_ap_params()
2415 if (hapd->conf->vendor_vht) in ieee802_11_build_ap_params()
2416 tailpos = hostapd_eid_vendor_vht(hapd, tailpos); in ieee802_11_build_ap_params()
2420 tailpos = hostapd_get_wpa_ie(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2421 tailpos = hostapd_get_osen_ie(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2424 tailpos = hostapd_eid_wmm(hapd, tailpos); in ieee802_11_build_ap_params()
2427 if (hapd->conf->wps_state && hapd->wps_beacon_ie) { in ieee802_11_build_ap_params()
2428 os_memcpy(tailpos, wpabuf_head(hapd->wps_beacon_ie), in ieee802_11_build_ap_params()
2429 wpabuf_len(hapd->wps_beacon_ie)); in ieee802_11_build_ap_params()
2430 tailpos += wpabuf_len(hapd->wps_beacon_ie); in ieee802_11_build_ap_params()
2435 if ((hapd->conf->p2p & P2P_ENABLED) && hapd->p2p_beacon_ie) { in ieee802_11_build_ap_params()
2436 os_memcpy(tailpos, wpabuf_head(hapd->p2p_beacon_ie), in ieee802_11_build_ap_params()
2437 wpabuf_len(hapd->p2p_beacon_ie)); in ieee802_11_build_ap_params()
2438 tailpos += wpabuf_len(hapd->p2p_beacon_ie); in ieee802_11_build_ap_params()
2442 if ((hapd->conf->p2p & (P2P_MANAGE | P2P_ENABLED | P2P_GROUP_OWNER)) == in ieee802_11_build_ap_params()
2444 tailpos = hostapd_eid_p2p_manage(hapd, tailpos); in ieee802_11_build_ap_params()
2448 tailpos = hostapd_eid_hs20_indication(hapd, tailpos); in ieee802_11_build_ap_params()
2451 tailpos = hostapd_eid_mbo(hapd, tailpos, tail + tail_len - tailpos); in ieee802_11_build_ap_params()
2452 tailpos = hostapd_eid_owe_trans(hapd, tailpos, in ieee802_11_build_ap_params()
2454 tailpos = hostapd_eid_dpp_cc(hapd, tailpos, tail + tail_len - tailpos); in ieee802_11_build_ap_params()
2456 tailpos = hostapd_get_rsne_override(hapd, tailpos, in ieee802_11_build_ap_params()
2458 tailpos = hostapd_get_rsne_override_2(hapd, tailpos, in ieee802_11_build_ap_params()
2460 tailpos = hostapd_get_rsnxe_override(hapd, tailpos, in ieee802_11_build_ap_params()
2463 if (hapd->conf->vendor_elements) { in ieee802_11_build_ap_params()
2464 os_memcpy(tailpos, wpabuf_head(hapd->conf->vendor_elements), in ieee802_11_build_ap_params()
2465 wpabuf_len(hapd->conf->vendor_elements)); in ieee802_11_build_ap_params()
2466 tailpos += wpabuf_len(hapd->conf->vendor_elements); in ieee802_11_build_ap_params()
2471 resp = hostapd_probe_resp_offloads(hapd, &resp_len); in ieee802_11_build_ap_params()
2475 if (wpa_key_mgmt_wpa_psk_no_sae(hapd->conf->wpa_key_mgmt) && in ieee802_11_build_ap_params()
2476 (hapd->iface->drv_flags2 & in ieee802_11_build_ap_params()
2478 if (hapd->conf->ssid.wpa_psk && hapd->conf->ssid.wpa_psk_set) { in ieee802_11_build_ap_params()
2479 os_memcpy(params->psk, hapd->conf->ssid.wpa_psk->psk, in ieee802_11_build_ap_params()
2482 } else if (hapd->conf->ssid.wpa_passphrase && in ieee802_11_build_ap_params()
2483 pbkdf2_sha1(hapd->conf->ssid.wpa_passphrase, in ieee802_11_build_ap_params()
2484 hapd->conf->ssid.ssid, in ieee802_11_build_ap_params()
2485 hapd->conf->ssid.ssid_len, 4096, in ieee802_11_build_ap_params()
2495 if (wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt | in ieee802_11_build_ap_params()
2496 hapd->conf->rsn_override_key_mgmt | in ieee802_11_build_ap_params()
2497 hapd->conf->rsn_override_key_mgmt_2) && in ieee802_11_build_ap_params()
2498 (hapd->iface->drv_flags2 & WPA_DRIVER_FLAGS2_SAE_OFFLOAD_AP)) { in ieee802_11_build_ap_params()
2499 if (hostapd_sae_pk_in_use(hapd->conf)) { in ieee802_11_build_ap_params()
2505 if (hostapd_sae_pw_id_in_use(hapd->conf)) { in ieee802_11_build_ap_params()
2511 params->sae_password = sae_get_password(hapd, NULL, NULL, NULL, in ieee802_11_build_ap_params()
2526 params->dtim_period = hapd->conf->dtim_period; in ieee802_11_build_ap_params()
2527 params->beacon_int = hapd->iconf->beacon_int; in ieee802_11_build_ap_params()
2528 params->basic_rates = hapd->iface->basic_rates; in ieee802_11_build_ap_params()
2529 params->beacon_rate = hapd->iconf->beacon_rate; in ieee802_11_build_ap_params()
2530 params->rate_type = hapd->iconf->rate_type; in ieee802_11_build_ap_params()
2531 params->ssid = hapd->conf->ssid.ssid; in ieee802_11_build_ap_params()
2532 params->ssid_len = hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
2533 if ((hapd->conf->wpa & (WPA_PROTO_WPA | WPA_PROTO_RSN)) == in ieee802_11_build_ap_params()
2535 params->pairwise_ciphers = hapd->conf->wpa_pairwise | in ieee802_11_build_ap_params()
2536 hapd->conf->rsn_pairwise; in ieee802_11_build_ap_params()
2537 else if (hapd->conf->wpa & WPA_PROTO_RSN) in ieee802_11_build_ap_params()
2538 params->pairwise_ciphers = hapd->conf->rsn_pairwise; in ieee802_11_build_ap_params()
2539 else if (hapd->conf->wpa & WPA_PROTO_WPA) in ieee802_11_build_ap_params()
2540 params->pairwise_ciphers = hapd->conf->wpa_pairwise; in ieee802_11_build_ap_params()
2541 params->group_cipher = hapd->conf->wpa_group; in ieee802_11_build_ap_params()
2542 params->key_mgmt_suites = hapd->conf->wpa_key_mgmt | in ieee802_11_build_ap_params()
2543 hapd->conf->rsn_override_key_mgmt | in ieee802_11_build_ap_params()
2544 hapd->conf->rsn_override_key_mgmt_2; in ieee802_11_build_ap_params()
2545 params->auth_algs = hapd->conf->auth_algs; in ieee802_11_build_ap_params()
2546 params->wpa_version = hapd->conf->wpa; in ieee802_11_build_ap_params()
2547 params->privacy = hapd->conf->wpa; in ieee802_11_build_ap_params()
2549 params->privacy |= hapd->conf->ssid.wep.keys_set || in ieee802_11_build_ap_params()
2550 (hapd->conf->ieee802_1x && in ieee802_11_build_ap_params()
2551 (hapd->conf->default_wep_key_len || in ieee802_11_build_ap_params()
2552 hapd->conf->individual_wep_key_len)); in ieee802_11_build_ap_params()
2554 switch (hapd->conf->ignore_broadcast_ssid) { in ieee802_11_build_ap_params()
2565 params->isolate = hapd->conf->isolate; in ieee802_11_build_ap_params()
2567 params->cts_protect = !!(ieee802_11_erp_info(hapd) & in ieee802_11_build_ap_params()
2569 params->preamble = hapd->iface->num_sta_no_short_preamble == 0 && in ieee802_11_build_ap_params()
2570 hapd->iconf->preamble == SHORT_PREAMBLE; in ieee802_11_build_ap_params()
2571 if (hapd->iface->current_mode && in ieee802_11_build_ap_params()
2572 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ieee802_11_build_ap_params()
2574 hapd->iface->num_sta_no_short_slot_time > 0 ? 0 : 1; in ieee802_11_build_ap_params()
2577 if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n) in ieee802_11_build_ap_params()
2580 params->ht_opmode = hapd->iface->ht_op_mode; in ieee802_11_build_ap_params()
2582 params->interworking = hapd->conf->interworking; in ieee802_11_build_ap_params()
2583 if (hapd->conf->interworking && in ieee802_11_build_ap_params()
2584 !is_zero_ether_addr(hapd->conf->hessid)) in ieee802_11_build_ap_params()
2585 params->hessid = hapd->conf->hessid; in ieee802_11_build_ap_params()
2586 params->access_network_type = hapd->conf->access_network_type; in ieee802_11_build_ap_params()
2587 params->ap_max_inactivity = hapd->conf->ap_max_inactivity; in ieee802_11_build_ap_params()
2589 params->p2p_go_ctwindow = hapd->iconf->p2p_go_ctwindow; in ieee802_11_build_ap_params()
2592 params->disable_dgaf = hapd->conf->disable_dgaf; in ieee802_11_build_ap_params()
2593 if (hapd->conf->osen) { in ieee802_11_build_ap_params()
2598 params->multicast_to_unicast = hapd->conf->multicast_to_unicast; in ieee802_11_build_ap_params()
2599 params->pbss = hapd->conf->pbss; in ieee802_11_build_ap_params()
2601 if (hapd->conf->ftm_responder) { in ieee802_11_build_ap_params()
2602 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_FTM_RESPONDER) { in ieee802_11_build_ap_params()
2604 params->lci = hapd->iface->conf->lci; in ieee802_11_build_ap_params()
2605 params->civic = hapd->iface->conf->civic; in ieee802_11_build_ap_params()
2613 if (hapd->conf->mld_ap && hapd->iconf->ieee80211be && in ieee802_11_build_ap_params()
2614 !hapd->conf->disable_11be) { in ieee802_11_build_ap_params()
2616 params->mld_link_id = hapd->mld_link_id; in ieee802_11_build_ap_params()
2653 static int __ieee802_11_set_beacon(struct hostapd_data *hapd) in __ieee802_11_set_beacon() argument
2657 struct hostapd_iface *iface = hapd->iface; in __ieee802_11_set_beacon()
2665 if (!hapd->drv_priv) { in __ieee802_11_set_beacon()
2670 if (hapd->csa_in_progress) { in __ieee802_11_set_beacon()
2675 hapd->beacon_set_done = 1; in __ieee802_11_set_beacon()
2677 if (ieee802_11_build_ap_params(hapd, &params) < 0) in __ieee802_11_set_beacon()
2680 if (hostapd_build_ap_extra_ies(hapd, &beacon, &proberesp, &assocresp) < in __ieee802_11_set_beacon()
2687 params.reenable = hapd->reenable_beacon; in __ieee802_11_set_beacon()
2689 params.he_spr_ctrl = hapd->iface->conf->spr.sr_control; in __ieee802_11_set_beacon()
2691 hapd->iface->conf->spr.non_srg_obss_pd_max_offset; in __ieee802_11_set_beacon()
2693 hapd->iface->conf->spr.srg_obss_pd_min_offset; in __ieee802_11_set_beacon()
2695 hapd->iface->conf->spr.srg_obss_pd_max_offset; in __ieee802_11_set_beacon()
2697 hapd->iface->conf->spr.srg_bss_color_bitmap, 8); in __ieee802_11_set_beacon()
2699 hapd->iface->conf->spr.srg_partial_bssid_bitmap, 8); in __ieee802_11_set_beacon()
2701 hapd->iface->conf->he_op.he_bss_color_disabled; in __ieee802_11_set_beacon()
2703 hapd->iface->conf->he_op.he_bss_color_partial; in __ieee802_11_set_beacon()
2704 params.he_bss_color = hapd->iface->conf->he_op.he_bss_color; in __ieee802_11_set_beacon()
2705 twt_he_responder = hostapd_get_he_twt_responder(hapd, in __ieee802_11_set_beacon()
2708 hostapd_unsol_bcast_probe_resp(hapd, &params.ubpr); in __ieee802_11_set_beacon()
2711 twt_he_responder || hostapd_get_ht_vht_twt_responder(hapd); in __ieee802_11_set_beacon()
2712 hapd->reenable_beacon = 0; in __ieee802_11_set_beacon()
2714 params.sae_pwe = hapd->conf->sae_pwe; in __ieee802_11_set_beacon()
2718 params.fd_frame_tmpl = hostapd_fils_discovery(hapd, &params); in __ieee802_11_set_beacon()
2738 hostapd_get_punct_bitmap(hapd)) == 0) { in __ieee802_11_set_beacon()
2741 if (hapd->conf->mld_ap) in __ieee802_11_set_beacon()
2742 freq.link_id = hapd->mld_link_id; in __ieee802_11_set_beacon()
2747 for (i = 0; i < hapd->iface->num_hw_features; i++) { in __ieee802_11_set_beacon()
2748 mode = &hapd->iface->hw_features[i]; in __ieee802_11_set_beacon()
2754 hostapd_get_hw_mode_any_channels(hapd, mode, in __ieee802_11_set_beacon()
2760 res = hostapd_drv_set_ap(hapd, &params); in __ieee802_11_set_beacon()
2761 hostapd_free_ap_extra_ies(hapd, beacon, proberesp, assocresp); in __ieee802_11_set_beacon()
2772 void ieee802_11_set_beacon_per_bss_only(struct hostapd_data *hapd) in ieee802_11_set_beacon_per_bss_only() argument
2774 __ieee802_11_set_beacon(hapd); in ieee802_11_set_beacon_per_bss_only()
2778 int ieee802_11_set_beacon(struct hostapd_data *hapd) in ieee802_11_set_beacon() argument
2780 struct hostapd_iface *iface = hapd->iface; in ieee802_11_set_beacon()
2785 ret = __ieee802_11_set_beacon(hapd); in ieee802_11_set_beacon()
2793 hapd_mld = hapd->conf->mld_ap; in ieee802_11_set_beacon()
2815 hostapd_is_ml_partner(hapd, other->bss[i]))) in ieee802_11_set_beacon()