Lines Matching +full:rates +full:- +full:mcs
3 * Copyright (c) 2002-2004, Instant802 Networks, Inc.
4 * Copyright (c) 2005-2006, Devicescape Software, Inc.
5 * Copyright (c) 2008-2012, Jouni Malinen <j@w1.fi>
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()
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()
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()
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()
115 * See 802.11g/D6 E-1 for recommended practice. in hostapd_eid_erp_info()
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()
176 * local max TX pwr = max TX pwr - local pwr constraint in hostapd_eid_pwr_constraint()
190 *pos++ = hapd->iconf->local_pwr_constraint; in hostapd_eid_pwr_constraint()
201 if (end - pos < 3) in hostapd_eid_country_add()
205 *pos++ = start->chan; in hostapd_eid_country_add()
207 *pos++ = (prev->chan - start->chan) / chan_spacing + 1; in hostapd_eid_country_add()
209 if (!is_6ghz_op_class(hapd->iconf->op_class)) in hostapd_eid_country_add()
210 *pos++ = start->max_tx_power; in hostapd_eid_country_add()
226 mode = hapd->iface->current_mode; in hostapd_fill_subband_triplets()
227 if (mode->mode == HOSTAPD_MODE_IEEE80211A) in hostapd_fill_subband_triplets()
231 for (i = 0; i < mode->num_channels; i++) { in hostapd_fill_subband_triplets()
232 struct hostapd_channel_data *chan = &mode->channels[i]; in hostapd_fill_subband_triplets()
233 if (chan->flag & HOSTAPD_CHAN_DISABLED) in hostapd_fill_subband_triplets()
236 prev->chan + chan_spacing == chan->chan && in hostapd_fill_subband_triplets()
237 start->max_tx_power == chan->max_tx_power) { in hostapd_fill_subband_triplets()
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()
277 * Global Operating Class (Table E-4) */ 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()
296 if ((pos - eid) & 1) { in hostapd_eid_country()
297 if (end - pos < 1) in hostapd_eid_country()
299 *pos++ = 0; /* pad for 16-bit alignment */ in hostapd_eid_country()
302 eid[1] = (pos - eid) - 2; in hostapd_eid_country()
313 ies = wpa_auth_get_wpa_ie(hapd->wpa_auth, &ies_len); in hostapd_wpa_ie()
327 ies = wpa_auth_get_wpa_ie(hapd->wpa_auth, &ies_len); in hostapd_vendor_wpa_ie()
366 if (hapd->conf->no_beacon_rsnxe) { in hostapd_get_rsnxe()
409 if (hapd->iface->cs_oper_class && hapd->iconf->ecsa_ie_only) in hostapd_eid_csa()
413 if (!hapd->cs_freq_params.channel) in hostapd_eid_csa()
418 *eid++ = hapd->cs_block_tx; in hostapd_eid_csa()
419 *eid++ = hapd->cs_freq_params.channel; in hostapd_eid_csa()
420 *eid++ = hapd->cs_count; in hostapd_eid_csa()
428 if (!hapd->cs_freq_params.channel || !hapd->iface->cs_oper_class) in hostapd_eid_ecsa()
433 *eid++ = hapd->cs_block_tx; in hostapd_eid_ecsa()
434 *eid++ = hapd->iface->cs_oper_class; in hostapd_eid_ecsa()
435 *eid++ = hapd->cs_freq_params.channel; in hostapd_eid_ecsa()
436 *eid++ = hapd->cs_count; in hostapd_eid_ecsa()
446 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) || in hostapd_eid_supported_op_classes()
447 !hapd->iface->freq) in hostapd_eid_supported_op_classes()
450 if (ieee80211_freq_to_channel_ext(hapd->iface->freq, in hostapd_eid_supported_op_classes()
451 hapd->iconf->secondary_channel, in hostapd_eid_supported_op_classes()
452 hostapd_get_oper_chwidth(hapd->iconf), in hostapd_eid_supported_op_classes()
474 struct hostapd_iface *iface = hapd->iface; in ieee802_11_build_ap_params_mbssid()
481 if (!iface->mbssid_max_interfaces || in ieee802_11_build_ap_params_mbssid()
482 iface->num_bss > iface->mbssid_max_interfaces || in ieee802_11_build_ap_params_mbssid()
483 (iface->conf->mbssid == ENHANCED_MBSSID_ENABLED && in ieee802_11_build_ap_params_mbssid()
484 !iface->ema_max_periodicity)) in ieee802_11_build_ap_params_mbssid()
487 /* Make sure bss->xrates_supported is set for all BSSs to know whether in ieee802_11_build_ap_params_mbssid()
488 * it need to be non-inherited. */ in ieee802_11_build_ap_params_mbssid()
489 for (i = 0; i < iface->num_bss; i++) { in ieee802_11_build_ap_params_mbssid()
492 hostapd_eid_ext_supp_rates(iface->bss[i], buf); in ieee802_11_build_ap_params_mbssid()
498 if (!len || (iface->conf->mbssid == ENHANCED_MBSSID_ENABLED && in ieee802_11_build_ap_params_mbssid()
499 elem_count > iface->ema_max_periodicity)) in ieee802_11_build_ap_params_mbssid()
524 params->mbssid_tx_iface = tx_bss->conf->iface; in ieee802_11_build_ap_params_mbssid()
525 params->mbssid_index = hostapd_mbssid_get_bss_index(hapd); in ieee802_11_build_ap_params_mbssid()
526 params->mbssid_elem = elem; in ieee802_11_build_ap_params_mbssid()
527 params->mbssid_elem_len = end - elem; in ieee802_11_build_ap_params_mbssid()
528 params->mbssid_elem_count = elem_count; in ieee802_11_build_ap_params_mbssid()
529 params->mbssid_elem_offset = elem_offset; in ieee802_11_build_ap_params_mbssid()
530 params->rnr_elem = rnr_elem; in ieee802_11_build_ap_params_mbssid()
531 params->rnr_elem_len = rnr_len; in ieee802_11_build_ap_params_mbssid()
532 params->rnr_elem_count = rnr_elem_count; in ieee802_11_build_ap_params_mbssid()
533 params->rnr_elem_offset = rnr_elem_offset; in ieee802_11_build_ap_params_mbssid()
534 if (iface->conf->mbssid == ENHANCED_MBSSID_ENABLED) in ieee802_11_build_ap_params_mbssid()
535 params->ema = true; in ieee802_11_build_ap_params_mbssid()
545 return -1; in ieee802_11_build_ap_params_mbssid()
552 struct hostapd_iface *iface = hapd->iface; in hostapd_eid_mbssid_config()
554 if (iface->conf->mbssid == ENHANCED_MBSSID_ENABLED) { in hostapd_eid_mbssid_config()
558 *eid++ = iface->num_bss; in hostapd_eid_mbssid_config()
571 if (!hapd->iconf->ieee80211ax || hapd->conf->disable_11ax) in he_elem_len()
578 if (is_6ghz_op_class(hapd->iconf->op_class)) { in he_elem_len()
583 if (he_reg_is_indoor(hapd->iconf->he_6ghz_reg_pwr_type)) in he_elem_len()
589 if (hapd->iconf->reg_def_cli_eirp != -1 && in he_elem_len()
590 he_reg_is_sp(hapd->iconf->he_6ghz_reg_pwr_type)) in he_elem_len()
626 ap_sta_free_sta_profile(params->mld_info); in hostapd_free_probe_resp_params()
627 os_free(params->mld_info); in hostapd_free_probe_resp_params()
628 params->mld_info = NULL; in hostapd_free_probe_resp_params()
639 if (hapd->wps_probe_resp_ie) in hostapd_probe_resp_elems_len()
640 buflen += wpabuf_len(hapd->wps_probe_resp_ie); in hostapd_probe_resp_elems_len()
643 if (hapd->p2p_probe_resp_ie) in hostapd_probe_resp_elems_len()
644 buflen += wpabuf_len(hapd->p2p_probe_resp_ie); in hostapd_probe_resp_elems_len()
647 if (hapd->iface->fst_ies) in hostapd_probe_resp_elems_len()
648 buflen += wpabuf_len(hapd->iface->fst_ies); in hostapd_probe_resp_elems_len()
650 if (hapd->conf->vendor_elements) in hostapd_probe_resp_elems_len()
651 buflen += wpabuf_len(hapd->conf->vendor_elements); in hostapd_probe_resp_elems_len()
653 if (hapd->conf->presp_elements) in hostapd_probe_resp_elems_len()
654 buflen += wpabuf_len(hapd->conf->presp_elements); in hostapd_probe_resp_elems_len()
656 if (hapd->conf->vendor_vht) { in hostapd_probe_resp_elems_len()
664 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in hostapd_probe_resp_elems_len()
667 if (hapd->iconf->punct_bitmap) in hostapd_probe_resp_elems_len()
670 if (!params->is_ml_sta_info && hapd->conf->mld_ap) { in hostapd_probe_resp_elems_len()
672 params->mld_ap ? params->mld_ap : hapd; in hostapd_probe_resp_elems_len()
675 ml_elem_ap, params->mld_info, !!params->mld_ap); in hostapd_probe_resp_elems_len()
681 params->known_bss, in hostapd_probe_resp_elems_len()
682 params->known_bss_len, NULL); in hostapd_probe_resp_elems_len()
683 if (!params->is_ml_sta_info) in hostapd_probe_resp_elems_len()
703 if (!params->is_ml_sta_info) { in hostapd_probe_resp_fill_elems()
705 *pos++ = hapd->conf->ssid.ssid_len; in hostapd_probe_resp_fill_elems()
706 os_memcpy(pos, hapd->conf->ssid.ssid, in hostapd_probe_resp_fill_elems()
707 hapd->conf->ssid.ssid_len); in hostapd_probe_resp_fill_elems()
708 pos += hapd->conf->ssid.ssid_len; in hostapd_probe_resp_fill_elems()
711 /* Supported rates */ in hostapd_probe_resp_fill_elems()
717 pos = hostapd_eid_country(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
726 if (!params->is_ml_sta_info) { in hostapd_probe_resp_fill_elems()
729 params->csa_pos = csa_pos - 1; in hostapd_probe_resp_fill_elems()
731 params->csa_pos = NULL; in hostapd_probe_resp_fill_elems()
738 /* Extended supported rates */ in hostapd_probe_resp_fill_elems()
741 pos = hostapd_get_rsne(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
742 pos = hostapd_eid_bss_load(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
744 NULL, params->known_bss, params->known_bss_len, in hostapd_probe_resp_fill_elems()
746 pos = hostapd_eid_rm_enabled_capab(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
747 pos = hostapd_get_mde(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
753 if (!params->is_ml_sta_info) { in hostapd_probe_resp_fill_elems()
756 params->ecsa_pos = csa_pos - 1; in hostapd_probe_resp_fill_elems()
758 params->ecsa_pos = NULL; in hostapd_probe_resp_fill_elems()
766 /* Probe Response frames always include all non-TX profiles except in hostapd_probe_resp_fill_elems()
769 hapd->iconf->mbssid >= MBSSID_ENABLED && in hostapd_probe_resp_fill_elems()
770 !params->known_bss_len); in hostapd_probe_resp_fill_elems()
780 if (hapd->iface->fst_ies) { in hostapd_probe_resp_fill_elems()
781 os_memcpy(pos, wpabuf_head(hapd->iface->fst_ies), in hostapd_probe_resp_fill_elems()
782 wpabuf_len(hapd->iface->fst_ies)); in hostapd_probe_resp_fill_elems()
783 pos += wpabuf_len(hapd->iface->fst_ies); in hostapd_probe_resp_fill_elems()
788 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac && in hostapd_probe_resp_fill_elems()
789 !is_6ghz_op_class(hapd->iconf->op_class)) { in hostapd_probe_resp_fill_elems()
797 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax && in hostapd_probe_resp_fill_elems()
798 is_6ghz_op_class(hapd->iconf->op_class)) in hostapd_probe_resp_fill_elems()
804 if (!params->is_ml_sta_info) in hostapd_probe_resp_fill_elems()
808 pos = hostapd_get_rsnxe(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
811 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { in hostapd_probe_resp_fill_elems()
820 params->cca_pos = cca_pos - 2; in hostapd_probe_resp_fill_elems()
822 params->cca_pos = NULL; in hostapd_probe_resp_fill_elems()
832 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in hostapd_probe_resp_fill_elems()
834 params->mld_ap ? params->mld_ap : hapd; in hostapd_probe_resp_fill_elems()
836 if (ml_elem_ap->conf->mld_ap) in hostapd_probe_resp_fill_elems()
838 ml_elem_ap, params->mld_info, in hostapd_probe_resp_fill_elems()
839 pos, !!params->mld_ap); in hostapd_probe_resp_fill_elems()
847 if (hapd->conf->vendor_vht) in hostapd_probe_resp_fill_elems()
852 pos = hostapd_get_wpa_ie(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
853 pos = hostapd_get_osen_ie(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
855 /* Wi-Fi Alliance WMM */ in hostapd_probe_resp_fill_elems()
859 if (hapd->conf->wps_state && hapd->wps_probe_resp_ie) { in hostapd_probe_resp_fill_elems()
860 os_memcpy(pos, wpabuf_head(hapd->wps_probe_resp_ie), in hostapd_probe_resp_fill_elems()
861 wpabuf_len(hapd->wps_probe_resp_ie)); in hostapd_probe_resp_fill_elems()
862 pos += wpabuf_len(hapd->wps_probe_resp_ie); in hostapd_probe_resp_fill_elems()
867 if ((hapd->conf->p2p & P2P_ENABLED) && params->is_p2p && in hostapd_probe_resp_fill_elems()
868 hapd->p2p_probe_resp_ie) { in hostapd_probe_resp_fill_elems()
869 os_memcpy(pos, wpabuf_head(hapd->p2p_probe_resp_ie), in hostapd_probe_resp_fill_elems()
870 wpabuf_len(hapd->p2p_probe_resp_ie)); in hostapd_probe_resp_fill_elems()
871 pos += wpabuf_len(hapd->p2p_probe_resp_ie); in hostapd_probe_resp_fill_elems()
875 if ((hapd->conf->p2p & (P2P_MANAGE | P2P_ENABLED | P2P_GROUP_OWNER)) == in hostapd_probe_resp_fill_elems()
884 pos = hostapd_eid_mbo(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
885 pos = hostapd_eid_owe_trans(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
886 pos = hostapd_eid_dpp_cc(hapd, pos, epos - pos); in hostapd_probe_resp_fill_elems()
888 if (hapd->conf->vendor_elements) { in hostapd_probe_resp_fill_elems()
889 os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements), in hostapd_probe_resp_fill_elems()
890 wpabuf_len(hapd->conf->vendor_elements)); in hostapd_probe_resp_fill_elems()
891 pos += wpabuf_len(hapd->conf->vendor_elements); in hostapd_probe_resp_fill_elems()
895 if (hapd->conf->presp_elements) { in hostapd_probe_resp_fill_elems()
896 os_memcpy(pos, wpabuf_head(hapd->conf->presp_elements), in hostapd_probe_resp_fill_elems()
897 wpabuf_len(hapd->conf->presp_elements)); in hostapd_probe_resp_fill_elems()
898 pos += wpabuf_len(hapd->conf->presp_elements); in hostapd_probe_resp_fill_elems()
917 params->resp = os_zalloc(buflen); in hostapd_gen_probe_resp()
918 if (!params->resp) { in hostapd_gen_probe_resp()
919 params->resp_len = 0; in hostapd_gen_probe_resp()
923 params->resp->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, in hostapd_gen_probe_resp()
928 * Std 802.11ax-2021, 26.17.2.3.2. Broadcast address is also used for in hostapd_gen_probe_resp()
931 if (params->req && (!is_6ghz_op_class(hapd->iconf->op_class) || in hostapd_gen_probe_resp()
932 hapd->conf->ignore_broadcast_ssid)) in hostapd_gen_probe_resp()
933 os_memcpy(params->resp->da, params->req->sa, ETH_ALEN); in hostapd_gen_probe_resp()
935 os_memset(params->resp->da, 0xff, ETH_ALEN); in hostapd_gen_probe_resp()
936 os_memcpy(params->resp->sa, hapd->own_addr, ETH_ALEN); in hostapd_gen_probe_resp()
938 os_memcpy(params->resp->bssid, hapd->own_addr, ETH_ALEN); in hostapd_gen_probe_resp()
939 params->resp->u.probe_resp.beacon_int = in hostapd_gen_probe_resp()
940 host_to_le16(hapd->iconf->beacon_int); in hostapd_gen_probe_resp()
942 /* hardware or low-level driver will setup seq_ctrl and timestamp */ in hostapd_gen_probe_resp()
943 params->resp->u.probe_resp.capab_info = in hostapd_gen_probe_resp()
947 params->resp->u.probe_resp.variable, in hostapd_gen_probe_resp()
950 params->resp_len = pos - (u8 *) params->resp; in hostapd_gen_probe_resp()
963 params->mld_ap = NULL; in hostapd_fill_probe_resp_ml_params()
964 params->mld_info = os_zalloc(sizeof(*params->mld_info)); in hostapd_fill_probe_resp_ml_params()
965 if (!params->mld_info) in hostapd_fill_probe_resp_ml_params()
975 u8 mld_link_id = link->mld_link_id; in hostapd_fill_probe_resp_ml_params()
985 if (mld_id != -1 && link->iface == hapd->iface) in hostapd_fill_probe_resp_ml_params()
986 params->mld_ap = link; in hostapd_fill_probe_resp_ml_params()
996 link_info = ¶ms->mld_info->links[mld_link_id]; in hostapd_fill_probe_resp_ml_params()
998 sta_info_params.req = params->req; in hostapd_fill_probe_resp_ml_params()
1018 link_info->valid = true; in hostapd_fill_probe_resp_ml_params()
1027 EHT_ML_MAX_STA_PROF_LEN - 2); in hostapd_fill_probe_resp_ml_params()
1028 link_info->resp_sta_profile_len = epos - buf; in hostapd_fill_probe_resp_ml_params()
1029 os_free(link_info->resp_sta_profile); in hostapd_fill_probe_resp_ml_params()
1030 link_info->resp_sta_profile = os_memdup( in hostapd_fill_probe_resp_ml_params()
1031 buf, link_info->resp_sta_profile_len); in hostapd_fill_probe_resp_ml_params()
1032 if (!link_info->resp_sta_profile) in hostapd_fill_probe_resp_ml_params()
1033 link_info->resp_sta_profile_len = 0; in hostapd_fill_probe_resp_ml_params()
1034 os_memcpy(link_info->local_addr, link->own_addr, ETH_ALEN); in hostapd_fill_probe_resp_ml_params()
1038 mld_link_id, link_info->resp_sta_profile_len, in hostapd_fill_probe_resp_ml_params()
1042 if (mld_id != -1 && !params->mld_ap) { in hostapd_fill_probe_resp_ml_params()
1053 params->mld_ap = NULL; in hostapd_fill_probe_resp_ml_params()
1054 params->mld_info = NULL; in hostapd_fill_probe_resp_ml_params()
1074 struct hostapd_iface *iface = hapd->iface; in ssid_match()
1080 if (ssid_len == hapd->conf->ssid.ssid_len && in ssid_match()
1081 os_memcmp(ssid, hapd->conf->ssid.ssid, ssid_len) == 0) in ssid_match()
1087 while (end - pos >= 2) { in ssid_match()
1088 if (2 + pos[1] > end - pos) in ssid_match()
1092 if (pos[1] == hapd->conf->ssid.ssid_len && in ssid_match()
1093 os_memcmp(pos + 2, hapd->conf->ssid.ssid, in ssid_match()
1103 while (end - pos >= 4) { in ssid_match()
1104 if (hapd->conf->ssid.short_ssid == WPA_GET_LE32(pos)) in ssid_match()
1113 if (!iface->interfaces || iface->interfaces->count <= 1 || in ssid_match()
1114 is_6ghz_op_class(hapd->iconf->op_class)) in ssid_match()
1117 for (i = 0; i < iface->interfaces->count; i++) { in ssid_match()
1120 colocated = iface->interfaces->iface[i]; in ssid_match()
1123 !is_6ghz_op_class(colocated->conf->op_class)) in ssid_match()
1126 for (j = 0; j < colocated->num_bss; j++) { in ssid_match()
1129 conf = colocated->bss[j]->conf; in ssid_match()
1130 if (ssid_len == conf->ssid.ssid_len && in ssid_match()
1131 os_memcmp(ssid, conf->ssid.ssid, ssid_len) == 0) in ssid_match()
1145 if (!iface->num_sta_seen) in sta_track_expire()
1149 while ((info = dl_list_first(&iface->sta_seen, struct hostapd_sta_info, in sta_track_expire()
1152 !os_reltime_expired(&now, &info->last_seen, in sta_track_expire()
1153 iface->conf->track_sta_max_age)) in sta_track_expire()
1158 MACSTR, iface->bss[0]->conf->iface, in sta_track_expire()
1159 MAC2STR(info->addr)); in sta_track_expire()
1160 dl_list_del(&info->list); in sta_track_expire()
1161 iface->num_sta_seen--; in sta_track_expire()
1172 dl_list_for_each(info, &iface->sta_seen, struct hostapd_sta_info, list) in sta_track_get()
1173 if (ether_addr_equal(addr, info->addr)) in sta_track_get()
1187 dl_list_del(&info->list); in sta_track_add()
1188 dl_list_add_tail(&iface->sta_seen, &info->list); in sta_track_add()
1189 os_get_reltime(&info->last_seen); in sta_track_add()
1190 info->ssi_signal = ssi_signal; in sta_track_add()
1198 os_memcpy(info->addr, addr, ETH_ALEN); in sta_track_add()
1199 os_get_reltime(&info->last_seen); in sta_track_add()
1200 info->ssi_signal = ssi_signal; in sta_track_add()
1202 if (iface->num_sta_seen >= iface->conf->track_sta_max_num) { in sta_track_add()
1208 MACSTR, iface->bss[0]->conf->iface, MAC2STR(addr)); in sta_track_add()
1209 dl_list_add_tail(&iface->sta_seen, &info->list); in sta_track_add()
1210 iface->num_sta_seen++; in sta_track_add()
1218 struct hapd_interfaces *interfaces = iface->interfaces; in sta_track_seen_on()
1221 for (i = 0; i < interfaces->count; i++) { in sta_track_seen_on()
1224 iface = interfaces->iface[i]; in sta_track_seen_on()
1225 for (j = 0; j < iface->num_bss; j++) { in sta_track_seen_on()
1226 hapd = iface->bss[j]; in sta_track_seen_on()
1227 if (os_strcmp(ifname, hapd->conf->iface) == 0) in sta_track_seen_on()
1251 *probe_ie_taxonomy = info->probe_ie_taxonomy; in sta_track_claim_taxonomy_info()
1252 info->probe_ie_taxonomy = NULL; in sta_track_claim_taxonomy_info()
1266 *mld_id = -1; in parse_ml_probe_req()
1272 ml_control = le_to_host16(ml->ml_control); in parse_ml_probe_req()
1284 pos = ml->variable; in parse_ml_probe_req()
1304 len = ml_len - len - sizeof(struct ieee80211_eht_ml); in parse_ml_probe_req()
1312 if (sub->datalen < in parse_ml_probe_req()
1316 sub->datalen); in parse_ml_probe_req()
1320 sta = (struct ieee80211_eht_per_sta_profile *) sub->data; in parse_ml_probe_req()
1326 sta_control = le_to_host16(sta->sta_control); in parse_ml_probe_req()
1332 "MLD: ML probe req sub-elements parsing error"); in parse_ml_probe_req()
1361 if (hapd->iconf->rssi_ignore_probe_request && ssi_signal && in handle_probe_req()
1362 ssi_signal < hapd->iconf->rssi_ignore_probe_request) in handle_probe_req()
1368 if (hapd->iconf->track_sta_max_num) in handle_probe_req()
1369 sta_track_add(hapd->iface, mgmt->sa, ssi_signal); in handle_probe_req()
1370 ie_len = len - IEEE80211_HDRLEN; in handle_probe_req()
1372 ret = hostapd_allowed_address(hapd, mgmt->sa, (const u8 *) mgmt, len, in handle_probe_req()
1375 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in handle_probe_req()
1377 " due to ACL reject ", MAC2STR(mgmt->sa)); in handle_probe_req()
1381 for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++) in handle_probe_req()
1382 if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx, in handle_probe_req()
1383 mgmt->sa, mgmt->da, mgmt->bssid, in handle_probe_req()
1387 if (!hapd->conf->send_probe_response) in handle_probe_req()
1392 MAC2STR(mgmt->sa)); in handle_probe_req()
1398 "without SSID or supported rates element", in handle_probe_req()
1399 MAC2STR(mgmt->sa)); in handle_probe_req()
1405 * channel. IEEE Std 802.11-2012 describes this as a requirement for an in handle_probe_req()
1414 hapd->iface->current_mode && in handle_probe_req()
1415 (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G || in handle_probe_req()
1416 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211B) && in handle_probe_req()
1417 hapd->iconf->channel != elems.ds_params[0]) { in handle_probe_req()
1420 hapd->iconf->channel, elems.ds_params[0]); in handle_probe_req()
1425 if (hapd->p2p && hapd->p2p_group && elems.wps_ie) { in handle_probe_req()
1428 if (wps && !p2p_group_match_dev_type(hapd->p2p_group, wps)) { in handle_probe_req()
1438 if (hapd->p2p && hapd->p2p_group && elems.p2p) { in handle_probe_req()
1441 if (p2p && !p2p_group_match_dev_id(hapd->p2p_group, p2p)) { in handle_probe_req()
1451 if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && in handle_probe_req()
1454 "broadcast SSID ignored", MAC2STR(mgmt->sa)); in handle_probe_req()
1459 if ((hapd->conf->p2p & P2P_GROUP_OWNER) && in handle_probe_req()
1473 if ((sta = ap_get_sta(hapd, mgmt->sa)) != NULL) { in handle_probe_req()
1475 } else if ((info = sta_track_get(hapd->iface, in handle_probe_req()
1476 mgmt->sa)) != NULL) { in handle_probe_req()
1487 if (!(mgmt->da[0] & 0x01)) { in handle_probe_req()
1490 MAC2STR(mgmt->sa), in handle_probe_req()
1492 MAC2STR(mgmt->da), in handle_probe_req()
1498 if (hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) { in handle_probe_req()
1500 "broadcast SSID ignored", MAC2STR(mgmt->sa)); in handle_probe_req()
1505 if (hapd->conf->interworking && in handle_probe_req()
1509 ant != hapd->conf->access_network_type) { in handle_probe_req()
1512 MAC2STR(mgmt->sa), ant); in handle_probe_req()
1517 if (hapd->conf->interworking && elems.interworking && in handle_probe_req()
1525 !ether_addr_equal(hessid, hapd->conf->hessid)) { in handle_probe_req()
1529 MAC2STR(mgmt->sa), MAC2STR(hessid)); in handle_probe_req()
1536 if ((hapd->conf->p2p & P2P_GROUP_OWNER) && in handle_probe_req()
1538 /* Indicates support for 11b rates only */ in handle_probe_req()
1540 MACSTR " with only 802.11b rates", in handle_probe_req()
1541 MAC2STR(mgmt->sa)); in handle_probe_req()
1549 if (hapd->conf->no_probe_resp_if_seen_on && in handle_probe_req()
1550 is_multicast_ether_addr(mgmt->da) && in handle_probe_req()
1551 is_multicast_ether_addr(mgmt->bssid) && in handle_probe_req()
1552 sta_track_seen_on(hapd->iface, mgmt->sa, in handle_probe_req()
1553 hapd->conf->no_probe_resp_if_seen_on)) { in handle_probe_req()
1556 hapd->conf->iface, MAC2STR(mgmt->sa), in handle_probe_req()
1557 hapd->conf->no_probe_resp_if_seen_on); in handle_probe_req()
1561 if (hapd->conf->no_probe_resp_if_max_sta && in handle_probe_req()
1562 is_multicast_ether_addr(mgmt->da) && in handle_probe_req()
1563 is_multicast_ether_addr(mgmt->bssid) && in handle_probe_req()
1564 hapd->num_sta >= hapd->conf->max_num_sta && in handle_probe_req()
1565 !ap_get_sta(hapd, mgmt->sa)) { in handle_probe_req()
1568 hapd->conf->iface, MAC2STR(mgmt->sa)); in handle_probe_req()
1573 if (hapd->iconf->ignore_probe_probability > 0.0 && in handle_probe_req()
1574 drand48() < hapd->iconf->ignore_probe_probability) { in handle_probe_req()
1577 MAC2STR(mgmt->sa)); in handle_probe_req()
1582 /* Do not send Probe Response frame from a non-transmitting multiple in handle_probe_req()
1588 wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, RX_PROBE_REQUEST "sa=" MACSTR in handle_probe_req()
1589 " signal=%d", MAC2STR(mgmt->sa), ssi_signal); in handle_probe_req()
1594 if (hapd->conf->mld_ap && elems.probe_req_mle && in handle_probe_req()
1620 is_broadcast_ether_addr(mgmt->da)); in handle_probe_req()
1623 if (hapd->csa_in_progress) { in handle_probe_req()
1626 params.csa_pos - (u8 *) params.resp; in handle_probe_req()
1630 params.ecsa_pos - (u8 *) params.resp; in handle_probe_req()
1643 "SSID", MAC2STR(mgmt->sa), in handle_probe_req()
1654 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD)) in hostapd_probe_resp_offloads()
1658 if (hapd->conf->wps_state && hapd->wps_probe_resp_ie && in hostapd_probe_resp_offloads()
1659 (!(hapd->iface->probe_resp_offloads & in hostapd_probe_resp_offloads()
1667 if ((hapd->conf->p2p & P2P_ENABLED) && hapd->p2p_probe_resp_ie && in hostapd_probe_resp_offloads()
1668 !(hapd->iface->probe_resp_offloads & in hostapd_probe_resp_offloads()
1674 if (hapd->conf->interworking && in hostapd_probe_resp_offloads()
1675 !(hapd->iface->probe_resp_offloads & in hostapd_probe_resp_offloads()
1681 /* Generate a Probe Response template for the non-P2P case */ in hostapd_probe_resp_offloads()
1698 hapd->cs_c_off_proberesp = params.csa_pos - (u8 *) params.resp; in hostapd_probe_resp_offloads()
1700 hapd->cs_c_off_ecsa_proberesp = params.ecsa_pos - in hostapd_probe_resp_offloads()
1704 hapd->cca_c_off_proberesp = params.cca_pos - (u8 *) params.resp; in hostapd_probe_resp_offloads()
1720 if (!is_6ghz_op_class(hapd->iconf->op_class)) in hostapd_unsol_bcast_probe_resp()
1723 ubpr->unsol_bcast_probe_resp_interval = in hostapd_unsol_bcast_probe_resp()
1724 hapd->conf->unsol_bcast_probe_resp_interval; in hostapd_unsol_bcast_probe_resp()
1736 ubpr->unsol_bcast_probe_resp_tmpl_len = probe_params.resp_len; in hostapd_unsol_bcast_probe_resp()
1745 wpabuf_free(info->probe_ie_taxonomy); in sta_track_del()
1746 info->probe_ie_taxonomy = NULL; in sta_track_del()
1757 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) in hostapd_gen_fils_discovery_phy_index()
1762 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) in hostapd_gen_fils_discovery_phy_index()
1767 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) in hostapd_gen_fils_discovery_phy_index()
1771 if (hapd->iconf->ieee80211n && !hapd->conf->disable_11n) in hostapd_gen_fils_discovery_phy_index()
1787 const u8 *he_mcs = mode->he_capab[IEEE80211_MODE_AP].mcs; in hostapd_gen_fils_discovery_nss()
1789 u16 mcs[6]; in hostapd_gen_fils_discovery_nss() local
1791 os_memset(mcs, 0xff, 6 * sizeof(u16)); in hostapd_gen_fils_discovery_nss()
1794 mcs[0] = WPA_GET_LE16(&he_mcs[0]); in hostapd_gen_fils_discovery_nss()
1795 mcs[1] = WPA_GET_LE16(&he_mcs[2]); in hostapd_gen_fils_discovery_nss()
1799 mcs[2] = WPA_GET_LE16(&he_mcs[4]); in hostapd_gen_fils_discovery_nss()
1800 mcs[3] = WPA_GET_LE16(&he_mcs[6]); in hostapd_gen_fils_discovery_nss()
1804 mcs[4] = WPA_GET_LE16(&he_mcs[8]); in hostapd_gen_fils_discovery_nss()
1805 mcs[5] = WPA_GET_LE16(&he_mcs[10]); in hostapd_gen_fils_discovery_nss()
1816 (((mcs[0] & nss_mask) != nss_mask) || in hostapd_gen_fils_discovery_nss()
1817 ((mcs[1] & nss_mask) != nss_mask))) { in hostapd_gen_fils_discovery_nss()
1823 (((mcs[2] & nss_mask) != nss_mask) || in hostapd_gen_fils_discovery_nss()
1824 ((mcs[3] & nss_mask) != nss_mask))) { in hostapd_gen_fils_discovery_nss()
1830 (((mcs[4] & nss_mask) != nss_mask) || in hostapd_gen_fils_discovery_nss()
1831 ((mcs[5] & nss_mask) != nss_mask))) { in hostapd_gen_fils_discovery_nss()
1838 u8 *mcs = mode->eht_capab[IEEE80211_MODE_AP].mcs; in hostapd_gen_fils_discovery_nss() local
1841 * The Supported EHT-MCS And NSS Set field for the AP contains in hostapd_gen_fils_discovery_nss()
1842 * one to three EHT-MCS Map fields based on the supported in hostapd_gen_fils_discovery_nss()
1844 * supports EHT-MCS 0-9) for each bandwidth (<= 80, in hostapd_gen_fils_discovery_nss()
1846 * the lowest MCS rates support the largest number of spatial in hostapd_gen_fils_discovery_nss()
1851 rx_nss = mcs[3 * i] & 0x0F; in hostapd_gen_fils_discovery_nss()
1855 tx_nss = (mcs[3 * i] & 0xF0) >> 4; in hostapd_gen_fils_discovery_nss()
1866 return (nss - 1) << FD_CAP_NSS_SHIFT; in hostapd_gen_fils_discovery_nss()
1876 struct hostapd_hw_modes *mode = hapd->iface->current_mode; in hostapd_fils_discovery_cap()
1879 if (hapd->conf->wpa) in hostapd_fils_discovery_cap()
1882 if (is_6ghz_op_class(hapd->iconf->op_class)) { in hostapd_fils_discovery_cap()
1883 switch (hapd->iconf->op_class) { in hostapd_fils_discovery_cap()
1902 switch (hostapd_get_oper_chwidth(hapd->iconf)) { in hostapd_fils_discovery_cap()
1914 if (hapd->iconf->secondary_channel) in hostapd_fils_discovery_cap()
1945 ctl = (sizeof(hapd->conf->ssid.short_ssid) - 1) | in hostapd_gen_fils_discovery()
1953 if (is_6ghz_op_class(hapd->iconf->op_class) && in hostapd_gen_fils_discovery()
1955 NULL, hapd->iconf->op_class, in hostapd_gen_fils_discovery()
1956 hapd->iconf->channel)) && in hostapd_gen_fils_discovery()
1957 op_class_to_bandwidth(hapd->iconf->op_class) > 20) { in hostapd_gen_fils_discovery()
1963 if (wpa_auth_write_fd_rsn_info(hapd->wpa_auth, fd_rsn_info)) { in hostapd_gen_fils_discovery()
1977 buf_len = pos - buf; in hostapd_gen_fils_discovery()
1988 head->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, in hostapd_gen_fils_discovery()
1990 os_memset(head->da, 0xff, ETH_ALEN); in hostapd_gen_fils_discovery()
1991 os_memcpy(head->sa, hapd->own_addr, ETH_ALEN); in hostapd_gen_fils_discovery()
1992 os_memcpy(head->bssid, hapd->own_addr, ETH_ALEN); in hostapd_gen_fils_discovery()
1994 head->u.action.category = WLAN_ACTION_PUBLIC; in hostapd_gen_fils_discovery()
1995 head->u.action.u.public_action.action = WLAN_PA_FILS_DISCOVERY; in hostapd_gen_fils_discovery()
1997 pos = &head->u.action.u.public_action.variable[0]; in hostapd_gen_fils_discovery()
2005 /* Hardware or low-level driver will fill in the Timestamp value */ in hostapd_gen_fils_discovery()
2009 WPA_PUT_LE16(pos, hapd->iconf->beacon_int); in hostapd_gen_fils_discovery()
2013 WPA_PUT_LE32(pos, hapd->conf->ssid.short_ssid); in hostapd_gen_fils_discovery()
2014 pos += sizeof(hapd->conf->ssid.short_ssid); in hostapd_gen_fils_discovery()
2023 /* Operating Class and Primary Channel - if a 6 GHz chan is non PSC */ in hostapd_gen_fils_discovery()
2025 *pos++ = hapd->iconf->op_class; in hostapd_gen_fils_discovery()
2026 *pos++ = hapd->iconf->channel; in hostapd_gen_fils_discovery()
2029 /* AP Configuration Sequence Number - not present */ in hostapd_gen_fils_discovery()
2031 /* Access Network Options - not present */ in hostapd_gen_fils_discovery()
2039 /* Channel Center Frequency Segment 1 - not present */ in hostapd_gen_fils_discovery()
2048 *length_pos = pos - (length_pos + 1); in hostapd_gen_fils_discovery()
2058 if (is_6ghz_op_class(hapd->iconf->op_class)) in hostapd_gen_fils_discovery()
2061 *len = pos - (u8 *) head; in hostapd_gen_fils_discovery()
2063 head, pos - (u8 *) head); in hostapd_gen_fils_discovery()
2072 params->fd_max_int = hapd->conf->fils_discovery_max_int; in hostapd_fils_discovery()
2073 if (is_6ghz_op_class(hapd->iconf->op_class) && in hostapd_fils_discovery()
2074 params->fd_max_int > FD_MAX_INTERVAL_6GHZ) in hostapd_fils_discovery()
2075 params->fd_max_int = FD_MAX_INTERVAL_6GHZ; in hostapd_fils_discovery()
2077 params->fd_min_int = hapd->conf->fils_discovery_min_int; in hostapd_fils_discovery()
2078 if (params->fd_min_int > params->fd_max_int) in hostapd_fils_discovery()
2079 params->fd_min_int = params->fd_max_int; in hostapd_fils_discovery()
2081 if (params->fd_max_int) in hostapd_fils_discovery()
2083 ¶ms->fd_frame_tmpl_len); in hostapd_fils_discovery()
2113 if (hapd->conf->wps_state && hapd->wps_beacon_ie) in ieee802_11_build_ap_params()
2114 tail_len += wpabuf_len(hapd->wps_beacon_ie); in ieee802_11_build_ap_params()
2117 if (hapd->p2p_beacon_ie) in ieee802_11_build_ap_params()
2118 tail_len += wpabuf_len(hapd->p2p_beacon_ie); in ieee802_11_build_ap_params()
2121 if (hapd->iface->fst_ies) in ieee802_11_build_ap_params()
2122 tail_len += wpabuf_len(hapd->iface->fst_ies); in ieee802_11_build_ap_params()
2124 if (hapd->conf->vendor_elements) in ieee802_11_build_ap_params()
2125 tail_len += wpabuf_len(hapd->conf->vendor_elements); in ieee802_11_build_ap_params()
2128 if (hapd->conf->vendor_vht) { in ieee802_11_build_ap_params()
2137 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in ieee802_11_build_ap_params()
2140 if (hapd->iconf->punct_bitmap) in ieee802_11_build_ap_params()
2144 * TODO: Multi-Link element has variable length and can be in ieee802_11_build_ap_params()
2148 if (hapd->conf->mld_ap) in ieee802_11_build_ap_params()
2153 if (hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED && in ieee802_11_build_ap_params()
2166 return -1; in ieee802_11_build_ap_params()
2170 head->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, in ieee802_11_build_ap_params()
2172 head->duration = host_to_le16(0); in ieee802_11_build_ap_params()
2173 os_memset(head->da, 0xff, ETH_ALEN); in ieee802_11_build_ap_params()
2175 os_memcpy(head->sa, hapd->own_addr, ETH_ALEN); in ieee802_11_build_ap_params()
2176 os_memcpy(head->bssid, hapd->own_addr, ETH_ALEN); in ieee802_11_build_ap_params()
2177 head->u.beacon.beacon_int = in ieee802_11_build_ap_params()
2178 host_to_le16(hapd->iconf->beacon_int); in ieee802_11_build_ap_params()
2180 /* hardware or low-level driver will setup seq_ctrl and timestamp */ in ieee802_11_build_ap_params()
2182 head->u.beacon.capab_info = host_to_le16(capab_info); in ieee802_11_build_ap_params()
2183 pos = &head->u.beacon.variable[0]; in ieee802_11_build_ap_params()
2187 if (hapd->conf->ignore_broadcast_ssid == 2) { in ieee802_11_build_ap_params()
2189 *pos++ = hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
2190 os_memset(pos, 0, hapd->conf->ssid.ssid_len); in ieee802_11_build_ap_params()
2191 pos += hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
2192 } else if (hapd->conf->ignore_broadcast_ssid) { in ieee802_11_build_ap_params()
2195 *pos++ = hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
2196 os_memcpy(pos, hapd->conf->ssid.ssid, in ieee802_11_build_ap_params()
2197 hapd->conf->ssid.ssid_len); in ieee802_11_build_ap_params()
2198 pos += hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
2201 /* Supported rates */ in ieee802_11_build_ap_params()
2207 head_len = pos - (u8 *) head; in ieee802_11_build_ap_params()
2209 tailpos = hostapd_eid_country(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2217 hapd->cs_c_off_beacon = csa_pos - tail - 1; in ieee802_11_build_ap_params()
2223 /* Extended supported rates */ in ieee802_11_build_ap_params()
2226 tailpos = hostapd_get_rsne(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2227 tailpos = hostapd_eid_bss_load(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2229 tailend - tailpos); in ieee802_11_build_ap_params()
2230 tailpos = hostapd_get_mde(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2235 hapd->cs_c_off_ecsa_beacon = csa_pos - tail - 1; in ieee802_11_build_ap_params()
2242 if (hapd->iconf->mbssid && hapd->iconf->num_bss > 1) { in ieee802_11_build_ap_params()
2248 return -1; in ieee802_11_build_ap_params()
2250 complete = hapd->iconf->mbssid == MBSSID_ENABLED || in ieee802_11_build_ap_params()
2251 (hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED && in ieee802_11_build_ap_params()
2252 params->mbssid_elem_count == 1); in ieee802_11_build_ap_params()
2268 if (hapd->iface->fst_ies) { in ieee802_11_build_ap_params()
2269 os_memcpy(tailpos, wpabuf_head(hapd->iface->fst_ies), in ieee802_11_build_ap_params()
2270 wpabuf_len(hapd->iface->fst_ies)); in ieee802_11_build_ap_params()
2271 tailpos += wpabuf_len(hapd->iface->fst_ies); in ieee802_11_build_ap_params()
2276 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac && in ieee802_11_build_ap_params()
2277 !is_6ghz_op_class(hapd->iconf->op_class)) { in ieee802_11_build_ap_params()
2285 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax && in ieee802_11_build_ap_params()
2286 is_6ghz_op_class(hapd->iconf->op_class)) in ieee802_11_build_ap_params()
2294 tailpos = hostapd_get_rsnxe(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2296 params->mbssid_elem_count); in ieee802_11_build_ap_params()
2299 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { in ieee802_11_build_ap_params()
2309 hapd->cca_c_off_beacon = cca_pos - tail - 2; in ieee802_11_build_ap_params()
2319 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in ieee802_11_build_ap_params()
2320 if (hapd->conf->mld_ap) in ieee802_11_build_ap_params()
2330 if (hapd->conf->vendor_vht) in ieee802_11_build_ap_params()
2335 tailpos = hostapd_get_wpa_ie(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2336 tailpos = hostapd_get_osen_ie(hapd, tailpos, tailend - tailpos); in ieee802_11_build_ap_params()
2338 /* Wi-Fi Alliance WMM */ in ieee802_11_build_ap_params()
2342 if (hapd->conf->wps_state && hapd->wps_beacon_ie) { in ieee802_11_build_ap_params()
2343 os_memcpy(tailpos, wpabuf_head(hapd->wps_beacon_ie), in ieee802_11_build_ap_params()
2344 wpabuf_len(hapd->wps_beacon_ie)); in ieee802_11_build_ap_params()
2345 tailpos += wpabuf_len(hapd->wps_beacon_ie); in ieee802_11_build_ap_params()
2350 if ((hapd->conf->p2p & P2P_ENABLED) && hapd->p2p_beacon_ie) { in ieee802_11_build_ap_params()
2351 os_memcpy(tailpos, wpabuf_head(hapd->p2p_beacon_ie), in ieee802_11_build_ap_params()
2352 wpabuf_len(hapd->p2p_beacon_ie)); in ieee802_11_build_ap_params()
2353 tailpos += wpabuf_len(hapd->p2p_beacon_ie); in ieee802_11_build_ap_params()
2357 if ((hapd->conf->p2p & (P2P_MANAGE | P2P_ENABLED | P2P_GROUP_OWNER)) == in ieee802_11_build_ap_params()
2366 tailpos = hostapd_eid_mbo(hapd, tailpos, tail + tail_len - tailpos); in ieee802_11_build_ap_params()
2368 tail + tail_len - tailpos); in ieee802_11_build_ap_params()
2369 tailpos = hostapd_eid_dpp_cc(hapd, tailpos, tail + tail_len - tailpos); in ieee802_11_build_ap_params()
2371 if (hapd->conf->vendor_elements) { in ieee802_11_build_ap_params()
2372 os_memcpy(tailpos, wpabuf_head(hapd->conf->vendor_elements), in ieee802_11_build_ap_params()
2373 wpabuf_len(hapd->conf->vendor_elements)); in ieee802_11_build_ap_params()
2374 tailpos += wpabuf_len(hapd->conf->vendor_elements); in ieee802_11_build_ap_params()
2377 tail_len = tailpos > tail ? tailpos - tail : 0; in ieee802_11_build_ap_params()
2383 if (wpa_key_mgmt_wpa_psk_no_sae(hapd->conf->wpa_key_mgmt) && in ieee802_11_build_ap_params()
2384 (hapd->iface->drv_flags2 & in ieee802_11_build_ap_params()
2386 if (hapd->conf->ssid.wpa_psk && hapd->conf->ssid.wpa_psk_set) { in ieee802_11_build_ap_params()
2387 os_memcpy(params->psk, hapd->conf->ssid.wpa_psk->psk, in ieee802_11_build_ap_params()
2389 params->psk_len = PMK_LEN; in ieee802_11_build_ap_params()
2390 } else if (hapd->conf->ssid.wpa_passphrase && in ieee802_11_build_ap_params()
2391 pbkdf2_sha1(hapd->conf->ssid.wpa_passphrase, in ieee802_11_build_ap_params()
2392 hapd->conf->ssid.ssid, in ieee802_11_build_ap_params()
2393 hapd->conf->ssid.ssid_len, 4096, in ieee802_11_build_ap_params()
2394 params->psk, PMK_LEN) == 0) { in ieee802_11_build_ap_params()
2395 params->psk_len = PMK_LEN; in ieee802_11_build_ap_params()
2403 if (wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt) && in ieee802_11_build_ap_params()
2404 (hapd->iface->drv_flags2 & WPA_DRIVER_FLAGS2_SAE_OFFLOAD_AP)) { in ieee802_11_build_ap_params()
2405 if (hostapd_sae_pk_in_use(hapd->conf)) { in ieee802_11_build_ap_params()
2408 return -1; in ieee802_11_build_ap_params()
2411 if (hostapd_sae_pw_id_in_use(hapd->conf)) { in ieee802_11_build_ap_params()
2414 return -1; in ieee802_11_build_ap_params()
2417 params->sae_password = sae_get_password(hapd, NULL, NULL, NULL, in ieee802_11_build_ap_params()
2419 if (!params->sae_password) { in ieee802_11_build_ap_params()
2421 return -1; in ieee802_11_build_ap_params()
2426 params->head = (u8 *) head; in ieee802_11_build_ap_params()
2427 params->head_len = head_len; in ieee802_11_build_ap_params()
2428 params->tail = tail; in ieee802_11_build_ap_params()
2429 params->tail_len = tail_len; in ieee802_11_build_ap_params()
2430 params->proberesp = resp; in ieee802_11_build_ap_params()
2431 params->proberesp_len = resp_len; in ieee802_11_build_ap_params()
2432 params->dtim_period = hapd->conf->dtim_period; in ieee802_11_build_ap_params()
2433 params->beacon_int = hapd->iconf->beacon_int; in ieee802_11_build_ap_params()
2434 params->basic_rates = hapd->iface->basic_rates; in ieee802_11_build_ap_params()
2435 params->beacon_rate = hapd->iconf->beacon_rate; in ieee802_11_build_ap_params()
2436 params->rate_type = hapd->iconf->rate_type; in ieee802_11_build_ap_params()
2437 params->ssid = hapd->conf->ssid.ssid; in ieee802_11_build_ap_params()
2438 params->ssid_len = hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
2439 if ((hapd->conf->wpa & (WPA_PROTO_WPA | WPA_PROTO_RSN)) == in ieee802_11_build_ap_params()
2441 params->pairwise_ciphers = hapd->conf->wpa_pairwise | in ieee802_11_build_ap_params()
2442 hapd->conf->rsn_pairwise; in ieee802_11_build_ap_params()
2443 else if (hapd->conf->wpa & WPA_PROTO_RSN) in ieee802_11_build_ap_params()
2444 params->pairwise_ciphers = hapd->conf->rsn_pairwise; in ieee802_11_build_ap_params()
2445 else if (hapd->conf->wpa & WPA_PROTO_WPA) in ieee802_11_build_ap_params()
2446 params->pairwise_ciphers = hapd->conf->wpa_pairwise; in ieee802_11_build_ap_params()
2447 params->group_cipher = hapd->conf->wpa_group; in ieee802_11_build_ap_params()
2448 params->key_mgmt_suites = hapd->conf->wpa_key_mgmt; in ieee802_11_build_ap_params()
2449 params->auth_algs = hapd->conf->auth_algs; in ieee802_11_build_ap_params()
2450 params->wpa_version = hapd->conf->wpa; in ieee802_11_build_ap_params()
2451 params->privacy = hapd->conf->wpa; in ieee802_11_build_ap_params()
2453 params->privacy |= hapd->conf->ssid.wep.keys_set || in ieee802_11_build_ap_params()
2454 (hapd->conf->ieee802_1x && in ieee802_11_build_ap_params()
2455 (hapd->conf->default_wep_key_len || in ieee802_11_build_ap_params()
2456 hapd->conf->individual_wep_key_len)); in ieee802_11_build_ap_params()
2458 switch (hapd->conf->ignore_broadcast_ssid) { in ieee802_11_build_ap_params()
2460 params->hide_ssid = NO_SSID_HIDING; in ieee802_11_build_ap_params()
2463 params->hide_ssid = HIDDEN_SSID_ZERO_LEN; in ieee802_11_build_ap_params()
2466 params->hide_ssid = HIDDEN_SSID_ZERO_CONTENTS; in ieee802_11_build_ap_params()
2469 params->isolate = hapd->conf->isolate; in ieee802_11_build_ap_params()
2471 params->cts_protect = !!(ieee802_11_erp_info(hapd) & in ieee802_11_build_ap_params()
2473 params->preamble = hapd->iface->num_sta_no_short_preamble == 0 && in ieee802_11_build_ap_params()
2474 hapd->iconf->preamble == SHORT_PREAMBLE; in ieee802_11_build_ap_params()
2475 if (hapd->iface->current_mode && in ieee802_11_build_ap_params()
2476 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ieee802_11_build_ap_params()
2477 params->short_slot_time = in ieee802_11_build_ap_params()
2478 hapd->iface->num_sta_no_short_slot_time > 0 ? 0 : 1; in ieee802_11_build_ap_params()
2480 params->short_slot_time = -1; in ieee802_11_build_ap_params()
2481 if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n) in ieee802_11_build_ap_params()
2482 params->ht_opmode = -1; in ieee802_11_build_ap_params()
2484 params->ht_opmode = hapd->iface->ht_op_mode; in ieee802_11_build_ap_params()
2486 params->interworking = hapd->conf->interworking; in ieee802_11_build_ap_params()
2487 if (hapd->conf->interworking && in ieee802_11_build_ap_params()
2488 !is_zero_ether_addr(hapd->conf->hessid)) in ieee802_11_build_ap_params()
2489 params->hessid = hapd->conf->hessid; in ieee802_11_build_ap_params()
2490 params->access_network_type = hapd->conf->access_network_type; in ieee802_11_build_ap_params()
2491 params->ap_max_inactivity = hapd->conf->ap_max_inactivity; in ieee802_11_build_ap_params()
2493 params->p2p_go_ctwindow = hapd->iconf->p2p_go_ctwindow; in ieee802_11_build_ap_params()
2496 params->disable_dgaf = hapd->conf->disable_dgaf; in ieee802_11_build_ap_params()
2497 if (hapd->conf->osen) { in ieee802_11_build_ap_params()
2498 params->privacy = 1; in ieee802_11_build_ap_params()
2499 params->osen = 1; in ieee802_11_build_ap_params()
2502 params->multicast_to_unicast = hapd->conf->multicast_to_unicast; in ieee802_11_build_ap_params()
2503 params->pbss = hapd->conf->pbss; in ieee802_11_build_ap_params()
2505 if (hapd->conf->ftm_responder) { in ieee802_11_build_ap_params()
2506 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_FTM_RESPONDER) { in ieee802_11_build_ap_params()
2507 params->ftm_responder = 1; in ieee802_11_build_ap_params()
2508 params->lci = hapd->iface->conf->lci; in ieee802_11_build_ap_params()
2509 params->civic = hapd->iface->conf->civic; in ieee802_11_build_ap_params()
2517 if (hapd->conf->mld_ap && hapd->iconf->ieee80211be && in ieee802_11_build_ap_params()
2518 !hapd->conf->disable_11be) { in ieee802_11_build_ap_params()
2519 params->mld_ap = true; in ieee802_11_build_ap_params()
2520 params->mld_link_id = hapd->mld_link_id; in ieee802_11_build_ap_params()
2530 os_free(params->tail); in ieee802_11_free_ap_params()
2531 params->tail = NULL; in ieee802_11_free_ap_params()
2532 os_free(params->head); in ieee802_11_free_ap_params()
2533 params->head = NULL; in ieee802_11_free_ap_params()
2534 os_free(params->proberesp); in ieee802_11_free_ap_params()
2535 params->proberesp = NULL; in ieee802_11_free_ap_params()
2536 os_free(params->mbssid_elem); in ieee802_11_free_ap_params()
2537 params->mbssid_elem = NULL; in ieee802_11_free_ap_params()
2538 os_free(params->mbssid_elem_offset); in ieee802_11_free_ap_params()
2539 params->mbssid_elem_offset = NULL; in ieee802_11_free_ap_params()
2540 os_free(params->rnr_elem); in ieee802_11_free_ap_params()
2541 params->rnr_elem = NULL; in ieee802_11_free_ap_params()
2542 os_free(params->rnr_elem_offset); in ieee802_11_free_ap_params()
2543 params->rnr_elem_offset = NULL; in ieee802_11_free_ap_params()
2545 os_free(params->fd_frame_tmpl); in ieee802_11_free_ap_params()
2546 params->fd_frame_tmpl = NULL; in ieee802_11_free_ap_params()
2549 os_free(params->ubpr.unsol_bcast_probe_resp_tmpl); in ieee802_11_free_ap_params()
2550 params->ubpr.unsol_bcast_probe_resp_tmpl = NULL; in ieee802_11_free_ap_params()
2552 os_free(params->allowed_freqs); in ieee802_11_free_ap_params()
2553 params->allowed_freqs = NULL; in ieee802_11_free_ap_params()
2561 struct hostapd_iface *iface = hapd->iface; in __ieee802_11_set_beacon()
2562 struct hostapd_config *iconf = iface->conf; in __ieee802_11_set_beacon()
2563 struct hostapd_hw_modes *cmode = iface->current_mode; in __ieee802_11_set_beacon()
2566 int res, ret = -1, i; in __ieee802_11_set_beacon()
2569 if (!hapd->drv_priv) { in __ieee802_11_set_beacon()
2571 return -1; in __ieee802_11_set_beacon()
2574 if (hapd->csa_in_progress) { in __ieee802_11_set_beacon()
2576 return -1; in __ieee802_11_set_beacon()
2579 hapd->beacon_set_done = 1; in __ieee802_11_set_beacon()
2582 return -1; in __ieee802_11_set_beacon()
2591 params.reenable = hapd->reenable_beacon; in __ieee802_11_set_beacon()
2593 params.he_spr_ctrl = hapd->iface->conf->spr.sr_control; in __ieee802_11_set_beacon()
2595 hapd->iface->conf->spr.non_srg_obss_pd_max_offset; in __ieee802_11_set_beacon()
2597 hapd->iface->conf->spr.srg_obss_pd_min_offset; in __ieee802_11_set_beacon()
2599 hapd->iface->conf->spr.srg_obss_pd_max_offset; in __ieee802_11_set_beacon()
2601 hapd->iface->conf->spr.srg_bss_color_bitmap, 8); in __ieee802_11_set_beacon()
2603 hapd->iface->conf->spr.srg_partial_bssid_bitmap, 8); in __ieee802_11_set_beacon()
2605 hapd->iface->conf->he_op.he_bss_color_disabled; in __ieee802_11_set_beacon()
2607 hapd->iface->conf->he_op.he_bss_color_partial; in __ieee802_11_set_beacon()
2608 params.he_bss_color = hapd->iface->conf->he_op.he_bss_color; in __ieee802_11_set_beacon()
2616 hapd->reenable_beacon = 0; in __ieee802_11_set_beacon()
2618 params.sae_pwe = hapd->conf->sae_pwe; in __ieee802_11_set_beacon()
2626 params.punct_bitmap = iconf->punct_bitmap; in __ieee802_11_set_beacon()
2630 hostapd_set_freq_params(&freq, iconf->hw_mode, iface->freq, in __ieee802_11_set_beacon()
2631 iconf->channel, iconf->enable_edmg, in __ieee802_11_set_beacon()
2632 iconf->edmg_channel, iconf->ieee80211n, in __ieee802_11_set_beacon()
2633 iconf->ieee80211ac, iconf->ieee80211ax, in __ieee802_11_set_beacon()
2634 iconf->ieee80211be, in __ieee802_11_set_beacon()
2635 iconf->secondary_channel, in __ieee802_11_set_beacon()
2639 cmode->vht_capab, in __ieee802_11_set_beacon()
2640 &cmode->he_capab[IEEE80211_MODE_AP], in __ieee802_11_set_beacon()
2641 &cmode->eht_capab[IEEE80211_MODE_AP], in __ieee802_11_set_beacon()
2643 freq.link_id = -1; in __ieee802_11_set_beacon()
2645 if (hapd->conf->mld_ap) in __ieee802_11_set_beacon()
2646 freq.link_id = hapd->mld_link_id; in __ieee802_11_set_beacon()
2651 for (i = 0; i < hapd->iface->num_hw_features; i++) { in __ieee802_11_set_beacon()
2652 mode = &hapd->iface->hw_features[i]; in __ieee802_11_set_beacon()
2654 if (iconf->hw_mode != HOSTAPD_MODE_IEEE80211ANY && in __ieee802_11_set_beacon()
2655 iconf->hw_mode != mode->mode) in __ieee802_11_set_beacon()
2659 !(iconf->acs_freq_list.num || in __ieee802_11_set_beacon()
2660 iconf->acs_ch_list.num), in __ieee802_11_set_beacon()
2684 struct hostapd_iface *iface = hapd->iface; in ieee802_11_set_beacon()
2693 if (!iface->interfaces || iface->interfaces->count <= 1) in ieee802_11_set_beacon()
2697 hapd_mld = hapd->conf->mld_ap; in ieee802_11_set_beacon()
2701 is_6g = is_6ghz_op_class(iface->conf->op_class); in ieee802_11_set_beacon()
2702 for (j = 0; j < iface->interfaces->count; j++) { in ieee802_11_set_beacon()
2706 other = iface->interfaces->iface[j]; in ieee802_11_set_beacon()
2707 if (other == iface || !other || !other->conf) in ieee802_11_set_beacon()
2710 other_iface_6g = is_6ghz_op_class(other->conf->op_class); in ieee802_11_set_beacon()
2715 for (i = 0; i < other->num_bss; i++) { in ieee802_11_set_beacon()
2718 !(hapd_mld && other->bss[i]->conf->mld_ap && in ieee802_11_set_beacon()
2719 hostapd_is_ml_partner(hapd, other->bss[i]))) in ieee802_11_set_beacon()
2723 if (other->bss[i] && other->bss[i]->started) in ieee802_11_set_beacon()
2724 __ieee802_11_set_beacon(other->bss[i]); in ieee802_11_set_beacon()
2737 for (i = 0; i < iface->num_bss; i++) { in ieee802_11_set_beacons()
2738 if (iface->bss[i]->started && in ieee802_11_set_beacons()
2739 ieee802_11_set_beacon(iface->bss[i]) < 0) in ieee802_11_set_beacons()
2740 ret = -1; in ieee802_11_set_beacons()
2753 for (i = 0; i < iface->num_bss; i++) { in ieee802_11_update_beacons()
2754 if (iface->bss[i]->beacon_set_done && iface->bss[i]->started && in ieee802_11_update_beacons()
2755 ieee802_11_set_beacon(iface->bss[i]) < 0) in ieee802_11_update_beacons()
2756 ret = -1; in ieee802_11_update_beacons()