Lines Matching +full:common +full:- +full:auth

3  * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc.
10 #include "utils/common.h"
71 if (he_oper_chwidth != -1) in ieee80211_eht_mcs_set_size()
116 mode = hapd->iface->current_mode; in hostapd_eid_eht_capab_len()
120 eht_cap = &mode->eht_capab[opmode]; in hostapd_eid_eht_capab_len()
121 if (!eht_cap->eht_supported) in hostapd_eid_eht_capab_len()
124 len += ieee80211_eht_mcs_set_size(mode->mode, hapd->iconf->op_class, in hostapd_eid_eht_capab_len()
125 hapd->iconf->he_oper_chwidth, in hostapd_eid_eht_capab_len()
126 mode->he_capab[opmode].phy_cap, in hostapd_eid_eht_capab_len()
127 eht_cap->phy_cap); in hostapd_eid_eht_capab_len()
128 len += ieee80211_eht_ppet_size(WPA_GET_LE16(&eht_cap->ppet[0]), in hostapd_eid_eht_capab_len()
129 eht_cap->phy_cap); in hostapd_eid_eht_capab_len()
144 mode = hapd->iface->current_mode; in hostapd_eid_eht_capab()
148 eht_cap = &mode->eht_capab[opmode]; in hostapd_eid_eht_capab()
149 if (!eht_cap->eht_supported) in hostapd_eid_eht_capab()
158 cap->mac_cap = host_to_le16(eht_cap->mac_cap); in hostapd_eid_eht_capab()
159 os_memcpy(cap->phy_cap, eht_cap->phy_cap, EHT_PHY_CAPAB_LEN); in hostapd_eid_eht_capab()
161 if (!is_6ghz_op_class(hapd->iconf->op_class)) in hostapd_eid_eht_capab()
162 cap->phy_cap[EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX] &= in hostapd_eid_eht_capab()
164 if (!hapd->iface->conf->eht_phy_capab.su_beamformer) in hostapd_eid_eht_capab()
165 cap->phy_cap[EHT_PHYCAP_SU_BEAMFORMER_IDX] &= in hostapd_eid_eht_capab()
168 if (!hapd->iface->conf->eht_phy_capab.su_beamformee) in hostapd_eid_eht_capab()
169 cap->phy_cap[EHT_PHYCAP_SU_BEAMFORMEE_IDX] &= in hostapd_eid_eht_capab()
172 if (!hapd->iface->conf->eht_phy_capab.mu_beamformer) in hostapd_eid_eht_capab()
173 cap->phy_cap[EHT_PHYCAP_MU_BEAMFORMER_IDX] &= in hostapd_eid_eht_capab()
176 pos = cap->optional; in hostapd_eid_eht_capab()
178 mcs_nss_len = ieee80211_eht_mcs_set_size(mode->mode, in hostapd_eid_eht_capab()
179 hapd->iconf->op_class, in hostapd_eid_eht_capab()
180 hapd->iconf->he_oper_chwidth, in hostapd_eid_eht_capab()
181 mode->he_capab[opmode].phy_cap, in hostapd_eid_eht_capab()
182 eht_cap->phy_cap); in hostapd_eid_eht_capab()
184 os_memcpy(pos, eht_cap->mcs, mcs_nss_len); in hostapd_eid_eht_capab()
189 WPA_GET_LE16(&eht_cap->ppet[0]), in hostapd_eid_eht_capab()
190 eht_cap->phy_cap); in hostapd_eid_eht_capab()
192 os_memcpy(pos, eht_cap->ppet, ppe_thresh_len); in hostapd_eid_eht_capab()
196 *length_pos = pos - (eid + 2); in hostapd_eid_eht_capab()
203 struct hostapd_config *conf = hapd->iconf; in hostapd_eid_eht_operation()
211 if (!hapd->iface->current_mode) in hostapd_eid_eht_operation()
214 if (is_6ghz_op_class(conf->op_class)) in hostapd_eid_eht_operation()
215 chwidth = op_class_to_ch_width(conf->op_class); in hostapd_eid_eht_operation()
217 chwidth = conf->eht_oper_chwidth; in hostapd_eid_eht_operation()
233 oper->oper_params = 0; in hostapd_eid_eht_operation()
235 if (hapd->iconf->eht_default_pe_duration) in hostapd_eid_eht_operation()
236 oper->oper_params |= EHT_OPER_DEFAULT_PE_DURATION; in hostapd_eid_eht_operation()
238 /* TODO: Fill in appropriate EHT-MCS max Nss information */ in hostapd_eid_eht_operation()
239 oper->basic_eht_mcs_nss_set[0] = 0x11; in hostapd_eid_eht_operation()
240 oper->basic_eht_mcs_nss_set[1] = 0x00; in hostapd_eid_eht_operation()
241 oper->basic_eht_mcs_nss_set[2] = 0x00; in hostapd_eid_eht_operation()
242 oper->basic_eht_mcs_nss_set[3] = 0x00; in hostapd_eid_eht_operation()
247 oper->oper_params |= EHT_OPER_INFO_PRESENT; in hostapd_eid_eht_operation()
252 oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_320MHZ; in hostapd_eid_eht_operation()
254 if (hapd->iconf->channel < seg0) in hostapd_eid_eht_operation()
255 seg0 -= 16; in hostapd_eid_eht_operation()
260 oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_160MHZ; in hostapd_eid_eht_operation()
262 if (hapd->iconf->channel < seg0) in hostapd_eid_eht_operation()
263 seg0 -= 8; in hostapd_eid_eht_operation()
268 oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_80MHZ; in hostapd_eid_eht_operation()
272 oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_40MHZ; in hostapd_eid_eht_operation()
278 oper->oper_info.ccfs0 = seg0 ? seg0 : hapd->iconf->channel; in hostapd_eid_eht_operation()
279 oper->oper_info.ccfs1 = seg1; in hostapd_eid_eht_operation()
282 oper->oper_params |= EHT_OPER_DISABLED_SUBCHAN_BITMAP_PRESENT; in hostapd_eid_eht_operation()
283 oper->oper_info.disabled_chan_bitmap = in hostapd_eid_eht_operation()
326 mode = hapd->iface->current_mode; in check_valid_eht_mcs()
330 ap_mcs = mode->eht_capab[opmode].mcs; in check_valid_eht_mcs()
332 sta_mcs = capab->optional; in check_valid_eht_mcs()
334 if (ieee80211_eht_mcs_set_size(mode->mode, hapd->iconf->op_class, in check_valid_eht_mcs()
335 hapd->iconf->he_oper_chwidth, in check_valid_eht_mcs()
336 mode->he_capab[opmode].phy_cap, in check_valid_eht_mcs()
337 mode->eht_capab[opmode].phy_cap) == in check_valid_eht_mcs()
343 switch (hapd->iface->conf->eht_oper_chwidth) { in check_valid_eht_mcs()
371 he_phy_cap = he_capab->he_phy_capab_info; in ieee80211_invalid_eht_cap_size()
373 cap_len = sizeof(*cap) - sizeof(cap->optional); in ieee80211_invalid_eht_cap_size()
377 cap_len += ieee80211_eht_mcs_set_size(mode, opclass, -1, he_phy_cap, in ieee80211_invalid_eht_cap_size()
378 cap->phy_cap); in ieee80211_invalid_eht_cap_size()
384 cap_len += ieee80211_eht_ppet_size(ppe_thres_hdr, cap->phy_cap); in ieee80211_invalid_eht_cap_size()
395 struct hostapd_hw_modes *c_mode = hapd->iface->current_mode; in copy_sta_eht_capab()
396 enum hostapd_hw_mode mode = c_mode ? c_mode->mode : NUM_HOSTAPD_MODES; in copy_sta_eht_capab()
398 if (!hapd->iconf->ieee80211be || hapd->conf->disable_11be || in copy_sta_eht_capab()
401 ieee80211_invalid_eht_cap_size(mode, hapd->iconf->op_class, in copy_sta_eht_capab()
405 sta->flags &= ~WLAN_STA_EHT; in copy_sta_eht_capab()
406 os_free(sta->eht_capab); in copy_sta_eht_capab()
407 sta->eht_capab = NULL; in copy_sta_eht_capab()
411 os_free(sta->eht_capab); in copy_sta_eht_capab()
412 sta->eht_capab = os_memdup(eht_capab, eht_capab_len); in copy_sta_eht_capab()
413 if (!sta->eht_capab) { in copy_sta_eht_capab()
414 sta->eht_capab_len = 0; in copy_sta_eht_capab()
418 sta->flags |= WLAN_STA_EHT; in copy_sta_eht_capab()
419 sta->eht_capab_len = eht_capab_len; in copy_sta_eht_capab()
457 * As the Multi-Link element can exceed the size of 255 bytes need to in hostapd_eid_eht_basic_ml_common()
464 /* Multi-Link Control field */ in hostapd_eid_eht_basic_ml_common()
472 * Set the basic Multi-Link common information. Hard code the common in hostapd_eid_eht_basic_ml_common()
492 wpabuf_put_data(buf, hapd->mld->mld_addr, ETH_ALEN); in hostapd_eid_eht_basic_ml_common()
495 wpabuf_put_u8(buf, hapd->mld_link_id); in hostapd_eid_eht_basic_ml_common()
501 hapd->iface->mld_eml_capa); in hostapd_eid_eht_basic_ml_common()
502 wpabuf_put_le16(buf, hapd->iface->mld_eml_capa); in hostapd_eid_eht_basic_ml_common()
504 mld_cap = hapd->iface->mld_mld_capa; in hostapd_eid_eht_basic_ml_common()
506 active_links = hapd->mld->num_links - 1; in hostapd_eid_eht_basic_ml_common()
536 struct mld_link_info *link = &mld_info->links[link_id]; in hostapd_eid_eht_basic_ml_common()
546 link->resp_sta_profile_len; in hostapd_eid_eht_basic_ml_common()
549 if (link_id == hapd->mld_link_id || !link->valid) in hostapd_eid_eht_basic_ml_common()
555 "MLD: Couldn't find link BSS - skip it"); in hostapd_eid_eht_basic_ml_common()
559 /* Per-STA Profile subelement */ in hostapd_eid_eht_basic_ml_common()
580 wpabuf_put_u8(buf, EHT_ML_STA_INFO_LEN - 2); in hostapd_eid_eht_basic_ml_common()
581 wpabuf_put_data(buf, link->local_addr, ETH_ALEN); in hostapd_eid_eht_basic_ml_common()
582 wpabuf_put_le16(buf, link_bss->iconf->beacon_int); in hostapd_eid_eht_basic_ml_common()
593 wpabuf_put_u8(buf, link_bss->conf->dtim_period); in hostapd_eid_eht_basic_ml_common()
596 wpabuf_put_u8(buf, hapd->eht_mld_bss_param_change); in hostapd_eid_eht_basic_ml_common()
598 if (!link->resp_sta_profile) in hostapd_eid_eht_basic_ml_common()
603 wpabuf_put_data(buf, link->resp_sta_profile, in hostapd_eid_eht_basic_ml_common()
604 link->resp_sta_profile_len); in hostapd_eid_eht_basic_ml_common()
606 ptr = link->resp_sta_profile; in hostapd_eid_eht_basic_ml_common()
607 len = link->resp_sta_profile_len; in hostapd_eid_eht_basic_ml_common()
609 slice_len = 255 - EHT_ML_STA_INFO_LEN; in hostapd_eid_eht_basic_ml_common()
612 len -= slice_len; in hostapd_eid_eht_basic_ml_common()
625 len -= slice_len; in hostapd_eid_eht_basic_ml_common()
632 /* Fragment the Multi-Link element, if needed */ in hostapd_eid_eht_basic_ml_common()
648 len -= slice_len; in hostapd_eid_eht_basic_ml_common()
662 len -= slice_len; in hostapd_eid_eht_basic_ml_common()
681 for (i = 0; i < hapd->iface->interfaces->count; i++) { in hostapd_eid_eht_reconf_ml()
682 other_hapd = hapd->iface->interfaces->iface[i]->bss[0]; in hostapd_eid_eht_reconf_ml()
685 other_hapd->eht_mld_link_removal_count); in hostapd_eid_eht_reconf_ml()
687 if (other_hapd->eht_mld_link_removal_count) in hostapd_eid_eht_reconf_ml()
692 if (i == hapd->iface->interfaces->count) in hostapd_eid_eht_reconf_ml()
702 /* Set the Multi-Link Control field */ in hostapd_eid_eht_reconf_ml()
707 /* Common Info doesn't include any information */ in hostapd_eid_eht_reconf_ml()
711 for (i = 0; i < hapd->iface->interfaces->count; i++) { in hostapd_eid_eht_reconf_ml()
712 other_hapd = hapd->iface->interfaces->iface[i]->bss[0]; in hostapd_eid_eht_reconf_ml()
713 if (!other_hapd->eht_mld_link_removal_count) in hostapd_eid_eht_reconf_ml()
720 control = other_hapd->mld_link_id | in hostapd_eid_eht_reconf_ml()
729 WPA_PUT_LE16(pos, other_hapd->eht_mld_link_removal_count); in hostapd_eid_eht_reconf_ml()
733 eid[1] = pos - eid - 2; in hostapd_eid_eht_reconf_ml()
753 for (link_id = 0; info && link_id < ARRAY_SIZE(info->links); in hostapd_eid_eht_ml_len()
758 link = &info->links[link_id]; in hostapd_eid_eht_ml_len()
759 if (!link->valid) in hostapd_eid_eht_ml_len()
762 sta_len += link->resp_sta_profile_len; in hostapd_eid_eht_ml_len()
800 eid = hostapd_eid_eht_basic_ml_common(hapd, eid, &info->mld_info, in hostapd_eid_eht_ml_assoc()
802 ap_sta_free_sta_profile(&info->mld_info); in hostapd_eid_eht_ml_assoc()
827 wpabuf_put_data(buf, hapd->mld->mld_addr, ETH_ALEN); in hostapd_ml_auth_resp()
867 prime_len = dh->prime_len; in sae_commit_skip_fixed_fields()
884 if (pos - mgmt->u.auth.variable > (int) len) { in sae_commit_skip_fixed_fields()
891 pos, (int) len - (pos - mgmt->u.auth.variable)); in sae_commit_skip_fixed_fields()
914 sta = ap_get_sta(hapd, mgmt->sa); in sae_confirm_skip_fixed_fields()
920 if (!sta->sae || sta->sae->state < SAE_COMMITTED || !sta->sae->tmp) { in sae_confirm_skip_fixed_fields()
921 if (sta->sae) in sae_confirm_skip_fixed_fields()
923 sta->sae->state); in sae_confirm_skip_fixed_fields()
930 sta->sae->tmp->kck_len); in sae_confirm_skip_fixed_fields()
932 pos += sta->sae->tmp->kck_len; in sae_confirm_skip_fixed_fields()
934 if (pos - mgmt->u.auth.variable > (int) len) { in sae_confirm_skip_fixed_fields()
950 u16 auth_alg = le_to_host16(mgmt->u.auth.auth_alg); in auth_skip_fixed_fields()
952 u16 auth_transaction = le_to_host16(mgmt->u.auth.auth_transaction); in auth_skip_fixed_fields()
953 u16 status_code = le_to_host16(mgmt->u.auth.status_code); in auth_skip_fixed_fields()
955 const u8 *pos = mgmt->u.auth.variable; in auth_skip_fixed_fields()
957 /* Skip fixed fields as based on IEE P802.11-REVme/D3.0, Table 9-69 in auth_skip_fixed_fields()
1007 if (!hapd->conf->mld_ap) in hostapd_process_ml_auth()
1010 len -= offsetof(struct ieee80211_mgmt, u.auth.variable); in hostapd_process_ml_auth()
1017 (int)len - (pos - mgmt->u.auth.variable), in hostapd_process_ml_auth()
1034 struct mld_info *info = &sta->mld_info; in hostapd_mld_validate_assoc_info()
1037 wpa_printf(MSG_DEBUG, "MLD: Not a non-AP MLD"); in hostapd_mld_validate_assoc_info()
1053 if (!info->links[link_id].valid || link_id == hapd->mld_link_id) in hostapd_mld_validate_assoc_info()
1060 return -1; in hostapd_mld_validate_assoc_info()
1063 os_memcpy(info->links[link_id].local_addr, other_hapd->own_addr, in hostapd_mld_validate_assoc_info()
1080 int ret = -1; in hostapd_process_ml_assoc_req_addr()
1092 ml_control = le_to_host16(ml->ml_control); in hostapd_process_ml_assoc_req_addr()
1100 /* Common Info Length and MLD MAC Address must always be present */ in hostapd_process_ml_assoc_req_addr()
1127 wpa_printf(MSG_DEBUG, "MLD: Not enough bytes for common info"); in hostapd_process_ml_assoc_req_addr()
1131 common_info = (struct eht_ml_basic_common_info *) ml->variable; in hostapd_process_ml_assoc_req_addr()
1133 /* Common information length includes the length octet */ in hostapd_process_ml_assoc_req_addr()
1134 if (common_info->len != common_info_len) { in hostapd_process_ml_assoc_req_addr()
1136 "MLD: Invalid common info len=%u", common_info->len); in hostapd_process_ml_assoc_req_addr()
1141 os_memcpy(mld_addr, common_info->mld_addr, ETH_ALEN); in hostapd_process_ml_assoc_req_addr()
1159 struct mld_info *info = &sta->mld_info; in hostapd_process_ml_assoc_req()
1161 int ret = -1; in hostapd_process_ml_assoc_req()
1164 mlbuf = ieee802_11_defrag(elems->basic_mle, elems->basic_mle_len, true); in hostapd_process_ml_assoc_req()
1171 ml_control = le_to_host16(ml->ml_control); in hostapd_process_ml_assoc_req()
1179 /* Common Info length and MLD MAC address must always be present */ in hostapd_process_ml_assoc_req()
1215 wpa_printf(MSG_DEBUG, "MLD: Not enough bytes for common info"); in hostapd_process_ml_assoc_req()
1219 common_info = (const struct eht_ml_basic_common_info *) ml->variable; in hostapd_process_ml_assoc_req()
1221 /* Common information length includes the length octet */ in hostapd_process_ml_assoc_req()
1222 if (common_info->len != common_info_len) { in hostapd_process_ml_assoc_req()
1224 "MLD: Invalid common info len=%u (expected %zu)", in hostapd_process_ml_assoc_req()
1225 common_info->len, common_info_len); in hostapd_process_ml_assoc_req()
1229 pos = common_info->variable; in hostapd_process_ml_assoc_req()
1232 info->common_info.eml_capa = WPA_GET_LE16(pos); in hostapd_process_ml_assoc_req()
1235 info->common_info.eml_capa = 0; in hostapd_process_ml_assoc_req()
1238 info->common_info.mld_capa = WPA_GET_LE16(pos); in hostapd_process_ml_assoc_req()
1242 MAC2STR(info->common_info.mld_addr), in hostapd_process_ml_assoc_req()
1243 info->common_info.eml_capa, info->common_info.mld_capa); in hostapd_process_ml_assoc_req()
1246 if (!ether_addr_equal(info->common_info.mld_addr, in hostapd_process_ml_assoc_req()
1247 common_info->mld_addr)) { in hostapd_process_ml_assoc_req()
1251 MAC2STR(info->common_info.mld_addr), in hostapd_process_ml_assoc_req()
1252 MAC2STR(common_info->mld_addr)); in hostapd_process_ml_assoc_req()
1256 info->links[hapd->mld_link_id].valid = 1; in hostapd_process_ml_assoc_req()
1259 ml_len -= sizeof(*ml) + common_info_len; in hostapd_process_ml_assoc_req()
1281 ml_len -= 2 + sub_elem_len; in hostapd_process_ml_assoc_req()
1287 "MLD: Skip unknown Multi-Link element subelement ID=%u", in hostapd_process_ml_assoc_req()
1290 ml_len -= 2 + sub_elem_len; in hostapd_process_ml_assoc_req()
1296 ml_len -= 2; in hostapd_process_ml_assoc_req()
1301 "MLD: Too short Per-STA Profile subelement"); in hostapd_process_ml_assoc_req()
1305 link_info = &info->links[control & in hostapd_process_ml_assoc_req()
1308 ml_len -= 2; in hostapd_process_ml_assoc_req()
1309 sub_elem_len -= 2; in hostapd_process_ml_assoc_req()
1313 "MLD: Per-STA complete profile expected"); in hostapd_process_ml_assoc_req()
1319 "MLD: Per-STA MAC address not present"); in hostapd_process_ml_assoc_req()
1335 link_info->nstr_bitmap_len = 2; in hostapd_process_ml_assoc_req()
1337 link_info->nstr_bitmap_len = 1; in hostapd_process_ml_assoc_req()
1340 sta_info_len += link_info->nstr_bitmap_len; in hostapd_process_ml_assoc_req()
1350 ml_len--; in hostapd_process_ml_assoc_req()
1353 os_memcpy(link_info->peer_addr, pos, ETH_ALEN); in hostapd_process_ml_assoc_req()
1357 MAC2STR(link_info->peer_addr)); in hostapd_process_ml_assoc_req()
1360 ml_len -= ETH_ALEN; in hostapd_process_ml_assoc_req()
1363 if (link_info->nstr_bitmap_len) { in hostapd_process_ml_assoc_req()
1364 os_memcpy(link_info->nstr_bitmap, pos, in hostapd_process_ml_assoc_req()
1365 link_info->nstr_bitmap_len); in hostapd_process_ml_assoc_req()
1366 pos += link_info->nstr_bitmap_len; in hostapd_process_ml_assoc_req()
1367 ml_len -= link_info->nstr_bitmap_len; in hostapd_process_ml_assoc_req()
1370 sub_elem_len -= sta_info_len; in hostapd_process_ml_assoc_req()
1377 link_info->capability = WPA_GET_LE16(pos); in hostapd_process_ml_assoc_req()
1380 ml_len -= sub_elem_len; in hostapd_process_ml_assoc_req()
1384 control, MAC2STR(link_info->peer_addr), in hostapd_process_ml_assoc_req()
1385 link_info->nstr_bitmap_len); in hostapd_process_ml_assoc_req()
1387 link_info->valid = true; in hostapd_process_ml_assoc_req()