Lines Matching refs:hapd

65 prepare_auth_resp_fils(struct hostapd_data *hapd,
76 static void pasn_fils_auth_resp(struct hostapd_data *hapd,
84 static void handle_auth(struct hostapd_data *hapd,
87 static int add_associated_sta(struct hostapd_data *hapd,
91 static u8 * hostapd_eid_multi_ap(struct hostapd_data *hapd, u8 *eid, size_t len) in hostapd_eid_multi_ap() argument
95 if (!hapd->conf->multi_ap) in hostapd_eid_multi_ap()
98 if (hapd->conf->multi_ap & BACKHAUL_BSS) in hostapd_eid_multi_ap()
100 if (hapd->conf->multi_ap & FRONTHAUL_BSS) in hostapd_eid_multi_ap()
103 if (hapd->conf->multi_ap_client_disallow & in hostapd_eid_multi_ap()
107 if (hapd->conf->multi_ap_client_disallow & in hostapd_eid_multi_ap()
112 multi_ap.profile = hapd->conf->multi_ap_profile; in hostapd_eid_multi_ap()
113 multi_ap.vlanid = hapd->conf->multi_ap_vlanid; in hostapd_eid_multi_ap()
119 u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_supp_rates() argument
125 if (hapd->iface->current_rates == NULL) in hostapd_eid_supp_rates()
129 num = hapd->iface->num_rates; in hostapd_eid_supp_rates()
130 if (hapd->iconf->ieee80211n && hapd->iconf->require_ht) in hostapd_eid_supp_rates()
132 if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht) in hostapd_eid_supp_rates()
135 if (hapd->iconf->ieee80211ax && hapd->iconf->require_he) in hostapd_eid_supp_rates()
138 h2e_required = (hapd->conf->sae_pwe == SAE_PWE_HASH_TO_ELEMENT || in hostapd_eid_supp_rates()
139 hostapd_sae_pw_id_in_use(hapd->conf) == 2) && in hostapd_eid_supp_rates()
140 hapd->conf->sae_pwe != SAE_PWE_FORCE_HUNT_AND_PECK && in hostapd_eid_supp_rates()
141 wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt); in hostapd_eid_supp_rates()
151 for (i = 0, count = 0; i < hapd->iface->num_rates && count < num; in hostapd_eid_supp_rates()
154 *pos = hapd->iface->current_rates[i].rate / 5; in hostapd_eid_supp_rates()
155 if (hapd->iface->current_rates[i].flags & HOSTAPD_RATE_BASIC) in hostapd_eid_supp_rates()
160 if (hapd->iconf->ieee80211n && hapd->iconf->require_ht && count < 8) { in hostapd_eid_supp_rates()
165 if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht && count < 8) { in hostapd_eid_supp_rates()
171 if (hapd->iconf->ieee80211ax && hapd->iconf->require_he && count < 8) { in hostapd_eid_supp_rates()
186 u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_ext_supp_rates() argument
192 hapd->conf->xrates_supported = false; in hostapd_eid_ext_supp_rates()
193 if (hapd->iface->current_rates == NULL) in hostapd_eid_ext_supp_rates()
196 num = hapd->iface->num_rates; in hostapd_eid_ext_supp_rates()
197 if (hapd->iconf->ieee80211n && hapd->iconf->require_ht) in hostapd_eid_ext_supp_rates()
199 if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht) in hostapd_eid_ext_supp_rates()
202 if (hapd->iconf->ieee80211ax && hapd->iconf->require_he) in hostapd_eid_ext_supp_rates()
205 h2e_required = (hapd->conf->sae_pwe == SAE_PWE_HASH_TO_ELEMENT || in hostapd_eid_ext_supp_rates()
206 hostapd_sae_pw_id_in_use(hapd->conf) == 2) && in hostapd_eid_ext_supp_rates()
207 hapd->conf->sae_pwe != SAE_PWE_FORCE_HUNT_AND_PECK && in hostapd_eid_ext_supp_rates()
208 wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt); in hostapd_eid_ext_supp_rates()
217 for (i = 0, count = 0; i < hapd->iface->num_rates && count < num + 8; in hostapd_eid_ext_supp_rates()
222 *pos = hapd->iface->current_rates[i].rate / 5; in hostapd_eid_ext_supp_rates()
223 if (hapd->iface->current_rates[i].flags & HOSTAPD_RATE_BASIC) in hostapd_eid_ext_supp_rates()
228 if (hapd->iconf->ieee80211n && hapd->iconf->require_ht) { in hostapd_eid_ext_supp_rates()
234 if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht) { in hostapd_eid_ext_supp_rates()
241 if (hapd->iconf->ieee80211ax && hapd->iconf->require_he) { in hostapd_eid_ext_supp_rates()
254 hapd->conf->xrates_supported = true; in hostapd_eid_ext_supp_rates()
259 u8 * hostapd_eid_rm_enabled_capab(struct hostapd_data *hapd, u8 *eid, in hostapd_eid_rm_enabled_capab() argument
265 if (hapd->conf->radio_measurements[i]) in hostapd_eid_rm_enabled_capab()
274 os_memcpy(eid, hapd->conf->radio_measurements, RRM_CAPABILITIES_IE_LEN); in hostapd_eid_rm_enabled_capab()
280 u16 hostapd_own_capab_info(struct hostapd_data *hapd) in hostapd_own_capab_info() argument
288 dfs = hostapd_is_dfs_required(hapd->iface); in hostapd_own_capab_info()
295 if (hapd->iface->num_sta_no_short_preamble == 0 && in hostapd_own_capab_info()
296 hapd->iconf->preamble == SHORT_PREAMBLE) in hostapd_own_capab_info()
300 privacy = hapd->conf->ssid.wep.keys_set; in hostapd_own_capab_info()
302 if (hapd->conf->ieee802_1x && in hostapd_own_capab_info()
303 (hapd->conf->default_wep_key_len || in hostapd_own_capab_info()
304 hapd->conf->individual_wep_key_len)) in hostapd_own_capab_info()
308 if (hapd->conf->wpa) in hostapd_own_capab_info()
312 if (hapd->conf->osen) in hostapd_own_capab_info()
319 if (hapd->iface->current_mode && in hostapd_own_capab_info()
320 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G && in hostapd_own_capab_info()
321 hapd->iface->num_sta_no_short_slot_time == 0) in hostapd_own_capab_info()
330 if (hapd->iface->current_mode && in hostapd_own_capab_info()
331 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && in hostapd_own_capab_info()
332 (hapd->iconf->spectrum_mgmt_required || dfs)) in hostapd_own_capab_info()
336 if (hapd->conf->radio_measurements[i]) { in hostapd_own_capab_info()
348 static u16 auth_shared_key(struct hostapd_data *hapd, struct sta_info *sta, in auth_shared_key() argument
352 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in auth_shared_key()
385 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in auth_shared_key()
392 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in auth_shared_key()
406 static int send_auth_reply(struct hostapd_data *hapd, struct sta_info *sta, in send_auth_reply() argument
415 const u8 *sa = hapd->own_addr; in send_auth_reply()
419 if (ap_sta_is_mld(hapd, sta)) { in send_auth_reply()
420 ml_resp = hostapd_ml_auth_resp(hapd); in send_auth_reply()
463 if (hapd->conf->sae_confirm_immediate == 2 && in send_auth_reply()
480 if (hostapd_drv_send_mlme(hapd, in send_auth_reply()
492 if (hostapd_drv_send_mlme(hapd, reply, rlen, 0, NULL, 0, 0) < 0) in send_auth_reply()
508 struct hostapd_data *hapd = ctx; in handle_auth_ft_finish() local
512 reply_res = send_auth_reply(hapd, NULL, dst, WLAN_AUTH_FT, in handle_auth_ft_finish()
516 sta = ap_get_sta(hapd, dst); in handle_auth_ft_finish()
522 hostapd_drv_sta_remove(hapd, sta->addr); in handle_auth_ft_finish()
530 hostapd_logger(hapd, dst, HOSTAPD_MODULE_IEEE80211, in handle_auth_ft_finish()
533 mlme_authenticate_indication(hapd, sta); in handle_auth_ft_finish()
550 const char * sae_get_password(struct hostapd_data *hapd, in sae_get_password() argument
563 for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) { in sae_get_password()
575 if (!(hapd->conf->mesh & MESH_ENABLED)) in sae_get_password()
580 password = hapd->conf->ssid.wpa_passphrase; in sae_get_password()
581 pt = hapd->conf->ssid.pt; in sae_get_password()
604 static struct wpabuf * auth_build_sae_commit(struct hostapd_data *hapd, in auth_build_sae_commit() argument
615 const u8 *own_addr = hapd->own_addr; in auth_build_sae_commit()
618 if (ap_sta_is_mld(hapd, sta)) in auth_build_sae_commit()
619 own_addr = hapd->mld->mld_addr; in auth_build_sae_commit()
631 if (rx_id && hapd->conf->sae_pwe != SAE_PWE_FORCE_HUNT_AND_PECK) in auth_build_sae_commit()
639 password = sae_get_password(hapd, sta, rx_id, &pw, &pt, &pk); in auth_build_sae_commit()
681 static struct wpabuf * auth_build_sae_confirm(struct hostapd_data *hapd, in auth_build_sae_confirm() argument
693 sta->sae->tmp->omit_pk_elem = hapd->conf->sae_pk_omit; in auth_build_sae_confirm()
706 static int auth_sae_send_commit(struct hostapd_data *hapd, in auth_sae_send_commit() argument
714 data = auth_build_sae_commit(hapd, sta, update, status_code); in auth_sae_send_commit()
727 if (hapd->conf->sae_commit_status >= 0 && in auth_sae_send_commit()
728 hapd->conf->sae_commit_status != status) { in auth_sae_send_commit()
731 status, hapd->conf->sae_commit_status); in auth_sae_send_commit()
732 status = hapd->conf->sae_commit_status; in auth_sae_send_commit()
735 reply_res = send_auth_reply(hapd, sta, sta->addr, in auth_sae_send_commit()
746 static int auth_sae_send_confirm(struct hostapd_data *hapd, in auth_sae_send_confirm() argument
752 data = auth_build_sae_confirm(hapd, sta); in auth_sae_send_confirm()
756 reply_res = send_auth_reply(hapd, sta, sta->addr, in auth_sae_send_confirm()
771 static int use_anti_clogging(struct hostapd_data *hapd) in use_anti_clogging() argument
776 if (hapd->conf->anti_clogging_threshold == 0) in use_anti_clogging()
779 for (sta = hapd->sta_list; sta; sta = sta->next) { in use_anti_clogging()
790 if (open >= hapd->conf->anti_clogging_threshold) in use_anti_clogging()
798 if (open + dl_list_len(&hapd->sae_commit_queue) >= in use_anti_clogging()
799 hapd->conf->anti_clogging_threshold) in use_anti_clogging()
811 static int sae_check_big_sync(struct hostapd_data *hapd, struct sta_info *sta) in sae_check_big_sync() argument
813 if (sta->sae->sync > hapd->conf->sae_sync) { in sae_check_big_sync()
853 struct hostapd_data *hapd = eloop_ctx; in auth_sae_retransmit_timer() local
857 if (sae_check_big_sync(hapd, sta)) in auth_sae_retransmit_timer()
867 ret = auth_sae_send_commit(hapd, sta, 0, -1); in auth_sae_retransmit_timer()
869 hapd->dot11RSNASAERetransPeriod * 1000, in auth_sae_retransmit_timer()
870 auth_sae_retransmit_timer, hapd, sta); in auth_sae_retransmit_timer()
873 ret = auth_sae_send_confirm(hapd, sta); in auth_sae_retransmit_timer()
875 hapd->dot11RSNASAERetransPeriod * 1000, in auth_sae_retransmit_timer()
876 auth_sae_retransmit_timer, hapd, sta); in auth_sae_retransmit_timer()
888 void sae_clear_retransmit_timer(struct hostapd_data *hapd, struct sta_info *sta) in sae_clear_retransmit_timer() argument
890 eloop_cancel_timeout(auth_sae_retransmit_timer, hapd, sta); in sae_clear_retransmit_timer()
894 static void sae_set_retransmit_timer(struct hostapd_data *hapd, in sae_set_retransmit_timer() argument
897 if (!(hapd->conf->mesh & MESH_ENABLED)) in sae_set_retransmit_timer()
900 eloop_cancel_timeout(auth_sae_retransmit_timer, hapd, sta); in sae_set_retransmit_timer()
901 eloop_register_timeout(0, hapd->dot11RSNASAERetransPeriod * 1000, in sae_set_retransmit_timer()
902 auth_sae_retransmit_timer, hapd, sta); in sae_set_retransmit_timer()
906 static void sae_sme_send_external_auth_status(struct hostapd_data *hapd, in sae_sme_send_external_auth_status() argument
915 if (ap_sta_is_mld(hapd, sta)) in sae_sme_send_external_auth_status()
923 !hapd->conf->disable_pmksa_caching) in sae_sme_send_external_auth_status()
926 hostapd_drv_send_external_auth_status(hapd, &params); in sae_sme_send_external_auth_status()
930 void sae_accept_sta(struct hostapd_data *hapd, struct sta_info *sta) in sae_accept_sta() argument
940 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_VLAN_OFFLOAD)) { in sae_accept_sta()
944 if (!hostapd_vlan_valid(hapd->conf->vlan, &vlan_desc)) { in sae_accept_sta()
951 if (ap_sta_set_vlan(hapd, sta, &vlan_desc) < 0 || in sae_accept_sta()
952 ap_sta_bind_vlan(hapd, sta) < 0) { in sae_accept_sta()
967 mlme_authenticate_indication(hapd, sta); in sae_accept_sta()
973 wpa_auth_pmksa_add_sae(hapd->wpa_auth, sta->addr, in sae_accept_sta()
976 sae_sme_send_external_auth_status(hapd, sta, WLAN_STATUS_SUCCESS); in sae_accept_sta()
980 static int sae_sm_step(struct hostapd_data *hapd, struct sta_info *sta, in sae_sm_step() argument
1012 ret = auth_sae_send_commit(hapd, sta, in sae_sm_step()
1031 if ((hapd->conf->mesh & MESH_ENABLED) || in sae_sm_step()
1032 hapd->conf->sae_confirm_immediate) { in sae_sm_step()
1038 ret = auth_sae_send_confirm(hapd, sta); in sae_sm_step()
1054 sae_set_retransmit_timer(hapd, sta); in sae_sm_step()
1056 hostapd_logger(hapd, sta->addr, in sae_sm_step()
1063 sae_clear_retransmit_timer(hapd, sta); in sae_sm_step()
1068 ret = auth_sae_send_confirm(hapd, sta); in sae_sm_step()
1073 sae_set_retransmit_timer(hapd, sta); in sae_sm_step()
1074 } else if (hapd->conf->mesh & MESH_ENABLED) { in sae_sm_step()
1079 if (sae_check_big_sync(hapd, sta)) in sae_sm_step()
1083 ret = auth_sae_send_commit(hapd, sta, 0, status_code); in sae_sm_step()
1087 sae_set_retransmit_timer(hapd, sta); in sae_sm_step()
1094 ret = auth_sae_send_confirm(hapd, sta); in sae_sm_step()
1105 return sae_sm_step(hapd, sta, auth_transaction, in sae_sm_step()
1110 sae_clear_retransmit_timer(hapd, sta); in sae_sm_step()
1112 if (sae_check_big_sync(hapd, sta)) in sae_sm_step()
1116 ret = auth_sae_send_commit(hapd, sta, 1, status_code); in sae_sm_step()
1123 ret = auth_sae_send_confirm(hapd, sta); in sae_sm_step()
1127 sae_set_retransmit_timer(hapd, sta); in sae_sm_step()
1130 sae_accept_sta(hapd, sta); in sae_sm_step()
1135 (hapd->conf->mesh & MESH_ENABLED)) { in sae_sm_step()
1139 wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); in sae_sm_step()
1140 ap_free_sta(hapd, sta); in sae_sm_step()
1144 ret = auth_sae_send_commit(hapd, sta, 1, status_code); in sae_sm_step()
1152 sae_set_retransmit_timer(hapd, sta); in sae_sm_step()
1154 if (sae_check_big_sync(hapd, sta)) in sae_sm_step()
1158 ret = auth_sae_send_confirm(hapd, sta); in sae_sm_step()
1173 static void sae_pick_next_group(struct hostapd_data *hapd, struct sta_info *sta) in sae_pick_next_group() argument
1176 int i, *groups = hapd->conf->sae_groups; in sae_pick_next_group()
1214 static int sae_status_success(struct hostapd_data *hapd, u16 status_code) in sae_status_success() argument
1216 enum sae_pwe sae_pwe = hapd->conf->sae_pwe; in sae_status_success()
1220 id_in_use = hostapd_sae_pw_id_in_use(hapd->conf); in sae_status_success()
1226 sae_pk = hostapd_sae_pk_in_use(hapd->conf); in sae_status_success()
1231 (hapd->conf->wpa_key_mgmt & in sae_status_success()
1248 static int sae_is_group_enabled(struct hostapd_data *hapd, int group) in sae_is_group_enabled() argument
1250 int *groups = hapd->conf->sae_groups; in sae_is_group_enabled()
1266 static int check_sae_rejected_groups(struct hostapd_data *hapd, in check_sae_rejected_groups() argument
1295 enabled = sae_is_group_enabled(hapd, group); in check_sae_rejected_groups()
1306 static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta, in handle_auth_sae() argument
1312 int *groups = hapd->conf->sae_groups; in handle_auth_sae()
1322 if (hapd->conf->sae_reflection_attack && auth_transaction == 1) { in handle_auth_sae()
1327 send_auth_reply(hapd, sta, sta->addr, in handle_auth_sae()
1334 if (hapd->conf->sae_commit_override && auth_transaction == 1) { in handle_auth_sae()
1336 send_auth_reply(hapd, sta, sta->addr, in handle_auth_sae()
1339 wpabuf_head(hapd->conf->sae_commit_override), in handle_auth_sae()
1340 wpabuf_len(hapd->conf->sae_commit_override), in handle_auth_sae()
1347 !sae_status_success(hapd, status_code)) { in handle_auth_sae()
1365 wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); in handle_auth_sae()
1374 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth_sae()
1379 if ((hapd->conf->mesh & MESH_ENABLED) && in handle_auth_sae()
1416 resp = auth_sae_send_commit(hapd, sta, 0, status_code); in handle_auth_sae()
1425 sae_set_retransmit_timer(hapd, sta); in handle_auth_sae()
1429 if ((hapd->conf->mesh & MESH_ENABLED) && in handle_auth_sae()
1435 sae_pick_next_group(hapd, sta); in handle_auth_sae()
1439 if (!sae_status_success(hapd, status_code)) in handle_auth_sae()
1448 if (!(hapd->conf->mesh & MESH_ENABLED) && in handle_auth_sae()
1490 wpa_msg(hapd->msg_ctx, MSG_INFO, in handle_auth_sae()
1493 sae_clear_retransmit_timer(hapd, sta); in handle_auth_sae()
1500 check_comeback_token(hapd->comeback_key, in handle_auth_sae()
1501 hapd->comeback_pending_idx, sta->addr, in handle_auth_sae()
1514 if (check_sae_rejected_groups(hapd, sta->sae)) { in handle_auth_sae()
1519 if (!token && use_anti_clogging(hapd) && !allow_reuse) { in handle_auth_sae()
1531 &hapd->last_comeback_key_update, in handle_auth_sae()
1532 hapd->comeback_key, in handle_auth_sae()
1533 hapd->comeback_idx, in handle_auth_sae()
1534 hapd->comeback_pending_idx, in handle_auth_sae()
1535 sizeof(hapd->comeback_pending_idx), in handle_auth_sae()
1539 if (hapd->conf->mesh & MESH_ENABLED) in handle_auth_sae()
1545 resp = sae_sm_step(hapd, sta, auth_transaction, in handle_auth_sae()
1548 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth_sae()
1555 !(hapd->conf->mesh & MESH_ENABLED)) { in handle_auth_sae()
1588 resp = sae_sm_step(hapd, sta, auth_transaction, in handle_auth_sae()
1591 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth_sae()
1612 sae_sme_send_external_auth_status(hapd, sta, resp); in handle_auth_sae()
1613 send_auth_reply(hapd, sta, sta->addr, in handle_auth_sae()
1630 success_status = sae_status_success(hapd, status_code); in handle_auth_sae()
1635 hostapd_drv_sta_remove(hapd, sta->addr); in handle_auth_sae()
1652 int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta) in auth_sae_init_committed() argument
1662 ret = auth_sae_send_commit(hapd, sta, 0, -1); in auth_sae_init_committed()
1668 sae_set_retransmit_timer(hapd, sta); in auth_sae_init_committed()
1676 struct hostapd_data *hapd = eloop_ctx; in auth_sae_process_commit() local
1680 q = dl_list_first(&hapd->sae_commit_queue, in auth_sae_process_commit()
1687 handle_auth(hapd, (const struct ieee80211_mgmt *) q->msg, q->len, in auth_sae_process_commit()
1691 if (eloop_is_timeout_registered(auth_sae_process_commit, hapd, NULL)) in auth_sae_process_commit()
1693 queue_len = dl_list_len(&hapd->sae_commit_queue); in auth_sae_process_commit()
1695 hapd, NULL); in auth_sae_process_commit()
1699 static void auth_sae_queue(struct hostapd_data *hapd, in auth_sae_queue() argument
1707 queue_len = dl_list_len(&hapd->sae_commit_queue); in auth_sae_queue()
1731 dl_list_for_each(q2, &hapd->sae_commit_queue, in auth_sae_queue()
1747 dl_list_add_tail(&hapd->sae_commit_queue, &q->list); in auth_sae_queue()
1750 if (eloop_is_timeout_registered(auth_sae_process_commit, hapd, NULL)) in auth_sae_queue()
1753 hapd, NULL); in auth_sae_queue()
1757 static int auth_sae_queued_addr(struct hostapd_data *hapd, const u8 *addr) in auth_sae_queued_addr() argument
1762 dl_list_for_each(q, &hapd->sae_commit_queue, in auth_sae_queued_addr()
1811 static void handle_auth_fils_finish(struct hostapd_data *hapd,
1815 void handle_auth_fils(struct hostapd_data *hapd, struct sta_info *sta, in handle_auth_fils() argument
1818 void (*cb)(struct hostapd_data *hapd, in handle_auth_fils() argument
1855 if (group != hapd->conf->fils_dh_group) { in handle_auth_fils()
1858 group, hapd->conf->fils_dh_group); in handle_auth_fils()
1929 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, sta->addr, in handle_auth_fils()
1938 res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm, in handle_auth_fils()
1939 hapd->iface->freq, in handle_auth_fils()
1969 pmksa = wpa_auth_pmksa_get(hapd->wpa_auth, sta->addr, in handle_auth_fils()
1973 pmksa = wpa_auth_pmksa_get_fils_cache_id(hapd->wpa_auth, in handle_auth_fils()
2010 ieee802_1x_alloc_eapol_sm(hapd, sta); in handle_auth_fils()
2015 hapd, sta, elems.wrapped_data, in handle_auth_fils()
2042 data = prepare_auth_resp_fils(hapd, sta, &resp, pmksa, NULL, in handle_auth_fils()
2050 cb(hapd, sta, resp, data, pub); in handle_auth_fils()
2056 prepare_auth_resp_fils(struct hostapd_data *hapd, in prepare_auth_resp_fils() argument
2076 ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &ielen); in prepare_auth_resp_fils()
2125 wpabuf_put_le16(data, hapd->conf->fils_dh_group); in prepare_auth_resp_fils()
2142 res = wpa_auth_write_fte(hapd->wpa_auth, sta->wpa_sm, in prepare_auth_resp_fils()
2213 if (!hapd->conf->disable_pmksa_caching && in prepare_auth_resp_fils()
2215 hapd->wpa_auth, sta->addr, in prepare_auth_resp_fils()
2266 static void handle_auth_fils_finish(struct hostapd_data *hapd, in handle_auth_fils_finish() argument
2275 send_auth_reply(hapd, sta, sta->addr, auth_alg, 2, resp, in handle_auth_fils_finish()
2281 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth_fils_finish()
2287 mlme_authenticate_indication(hapd, sta); in handle_auth_fils_finish()
2292 void ieee802_11_finish_fils_auth(struct hostapd_data *hapd, in ieee802_11_finish_fils_auth() argument
2312 data = prepare_auth_resp_fils(hapd, sta, &resp, NULL, erp_resp, in ieee802_11_finish_fils_auth()
2319 sta->fils_pending_cb(hapd, sta, resp, data, pub); in ieee802_11_finish_fils_auth()
2322 pasn_fils_auth_resp(hapd, sta, resp, erp_resp, in ieee802_11_finish_fils_auth()
2331 static int ieee802_11_allowed_address(struct hostapd_data *hapd, const u8 *addr, in ieee802_11_allowed_address() argument
2337 res = hostapd_allowed_address(hapd, addr, msg, len, info, 0); in ieee802_11_allowed_address()
2360 int ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta, in ieee802_11_set_radius_info() argument
2371 !hostapd_vlan_valid(hapd->conf->vlan, vlan_id)) { in ieee802_11_set_radius_info()
2372 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS, in ieee802_11_set_radius_info()
2379 if (ap_sta_set_vlan(hapd, sta, vlan_id) < 0) in ieee802_11_set_radius_info()
2382 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS, in ieee802_11_set_radius_info()
2386 if (hapd->conf->wpa_psk_radius != PSK_RADIUS_IGNORED) in ieee802_11_set_radius_info()
2403 if (hapd->conf->acct_interim_interval == 0 && acct_interim_interval) in ieee802_11_set_radius_info()
2409 ap_sta_session_timeout(hapd, sta, session_timeout); in ieee802_11_set_radius_info()
2412 ap_sta_no_session_timeout(hapd, sta); in ieee802_11_set_radius_info()
2422 static void pasn_fils_auth_resp(struct hostapd_data *hapd, in pasn_fils_auth_resp() argument
2459 ret = pasn_pmk_to_ptk(pmk, pmk_len, sta->addr, hapd->own_addr, in pasn_fils_auth_resp()
2485 ret = handle_auth_pasn_resp(sta->pasn, hapd->own_addr, sta->addr, NULL, in pasn_fils_auth_resp()
2497 ap_free_sta(hapd, sta); in pasn_fils_auth_resp()
2501 static int pasn_wd_handle_fils(struct hostapd_data *hapd, struct sta_info *sta, in pasn_wd_handle_fils() argument
2601 sta->eapol_sm = ieee802_1x_alloc_eapol_sm(hapd, sta); in pasn_wd_handle_fils()
2606 ieee802_1x_encapsulate_radius(hapd, sta, wpabuf_head(fils_wd), in pasn_wd_handle_fils()
2632 struct hostapd_data *hapd = ctx; in hapd_pasn_send_mlme() local
2634 return hostapd_drv_send_mlme(hapd, data, data_len, 0, NULL, 0, 0); in hapd_pasn_send_mlme()
2638 static void hapd_initialize_pasn(struct hostapd_data *hapd, in hapd_initialize_pasn() argument
2643 pasn_register_callbacks(pasn, hapd, hapd_pasn_send_mlme, NULL); in hapd_initialize_pasn()
2644 pasn_set_bssid(pasn, hapd->own_addr); in hapd_initialize_pasn()
2645 pasn_set_own_addr(pasn, hapd->own_addr); in hapd_initialize_pasn()
2647 pasn_set_wpa_key_mgmt(pasn, hapd->conf->wpa_key_mgmt); in hapd_initialize_pasn()
2648 pasn_set_rsn_pairwise(pasn, hapd->conf->rsn_pairwise); in hapd_initialize_pasn()
2649 pasn->pasn_groups = hapd->conf->pasn_groups; in hapd_initialize_pasn()
2650 pasn->noauth = hapd->conf->pasn_noauth; in hapd_initialize_pasn()
2651 if (hapd->iface->drv_flags2 & WPA_DRIVER_FLAGS2_SEC_LTF_AP) in hapd_initialize_pasn()
2655 pasn->corrupt_mic = hapd->conf->pasn_corrupt_mic; in hapd_initialize_pasn()
2656 if (hapd->conf->force_kdk_derivation) in hapd_initialize_pasn()
2659 pasn->use_anti_clogging = use_anti_clogging(hapd); in hapd_initialize_pasn()
2660 pasn_set_password(pasn, sae_get_password(hapd, sta, NULL, NULL, in hapd_initialize_pasn()
2662 pasn->rsn_ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &pasn->rsn_ie_len); in hapd_initialize_pasn()
2663 pasn_set_rsnxe_ie(pasn, hostapd_wpa_ie(hapd, WLAN_EID_RSNX)); in hapd_initialize_pasn()
2664 pasn->disable_pmksa_caching = hapd->conf->disable_pmksa_caching; in hapd_initialize_pasn()
2666 wpa_auth_get_pmksa_cache(hapd->wpa_auth)); in hapd_initialize_pasn()
2668 pasn->comeback_after = hapd->conf->pasn_comeback_after; in hapd_initialize_pasn()
2669 pasn->comeback_idx = hapd->comeback_idx; in hapd_initialize_pasn()
2670 pasn->comeback_key = hapd->comeback_key; in hapd_initialize_pasn()
2671 pasn->comeback_pending_idx = hapd->comeback_pending_idx; in hapd_initialize_pasn()
2675 static int pasn_set_keys_from_cache(struct hostapd_data *hapd, in pasn_set_keys_from_cache() argument
2681 entry = ptksa_cache_get(hapd->ptksa, sta_addr, cipher); in pasn_set_keys_from_cache()
2698 hostapd_drv_set_secure_ranging_ctx(hapd, own_addr, sta_addr, cipher, in pasn_set_keys_from_cache()
2707 static void hapd_pasn_update_params(struct hostapd_data *hapd, in hapd_pasn_update_params() argument
2751 if (hapd->conf->force_kdk_derivation) in hapd_pasn_update_params()
2759 wpa_ft_fetch_pmk_r1(hapd->wpa_auth, sta->addr, in hapd_pasn_update_params()
2785 if (pasn_wd_handle_fils(hapd, sta, wrapped_data)) in hapd_pasn_update_params()
2796 static void handle_auth_pasn(struct hostapd_data *hapd, struct sta_info *sta, in handle_auth_pasn() argument
2800 if (hapd->conf->wpa != WPA_PROTO_RSN) { in handle_auth_pasn()
2828 hapd_initialize_pasn(hapd, sta); in handle_auth_pasn()
2830 hapd_pasn_update_params(hapd, sta, mgmt, len); in handle_auth_pasn()
2831 if (handle_auth_pasn_1(sta->pasn, hapd->own_addr, in handle_auth_pasn()
2833 ap_free_sta(hapd, sta); in handle_auth_pasn()
2844 ap_free_sta_pasn(hapd, sta); in handle_auth_pasn()
2848 if (handle_auth_pasn_3(sta->pasn, hapd->own_addr, in handle_auth_pasn()
2850 ptksa_cache_add(hapd->ptksa, hapd->own_addr, sta->addr, in handle_auth_pasn()
2855 pasn_set_keys_from_cache(hapd, hapd->own_addr, in handle_auth_pasn()
2860 ap_free_sta(hapd, sta); in handle_auth_pasn()
2870 static void handle_auth(struct hostapd_data *hapd, in handle_auth() argument
2896 if (hapd->iconf->ignore_auth_probability > 0.0 && in handle_auth()
2897 drand48() < hapd->iconf->ignore_auth_probability) { in handle_auth()
2912 sa = hostapd_process_ml_auth(hapd, mgmt, len); in handle_auth()
2950 if (hapd->tkip_countermeasures) { in handle_auth()
2957 if (!(((hapd->conf->auth_algs & WPA_AUTH_ALG_OPEN) && in handle_auth()
2960 (hapd->conf->wpa && wpa_key_mgmt_ft(hapd->conf->wpa_key_mgmt) && in handle_auth()
2964 (hapd->conf->wpa && wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt) && in handle_auth()
2968 (hapd->conf->wpa && wpa_key_mgmt_fils(hapd->conf->wpa_key_mgmt) && in handle_auth()
2970 (hapd->conf->wpa && wpa_key_mgmt_fils(hapd->conf->wpa_key_mgmt) && in handle_auth()
2971 hapd->conf->fils_dh_group && in handle_auth()
2975 (hapd->conf->wpa && in handle_auth()
2976 (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_PASN) && in handle_auth()
2979 ((hapd->conf->auth_algs & WPA_AUTH_ALG_SHARED) && in handle_auth()
2998 if (ether_addr_equal(mgmt->sa, hapd->own_addr)) { in handle_auth()
3007 (ether_addr_equal(sa, hapd->own_addr) || in handle_auth()
3008 ether_addr_equal(sa, hapd->mld->mld_addr))) { in handle_auth()
3017 if (hapd->conf->no_auth_if_seen_on) { in handle_auth()
3020 other = sta_track_seen_on(hapd->iface, sa, in handle_auth()
3021 hapd->conf->no_auth_if_seen_on); in handle_auth()
3029 hapd->conf->iface, MAC2STR(sa), in handle_auth()
3030 hapd->conf->no_auth_if_seen_on); in handle_auth()
3072 res = ieee802_11_allowed_address(hapd, sa, (const u8 *) mgmt, len, in handle_auth()
3075 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in handle_auth()
3087 (auth_transaction == 2 && auth_sae_queued_addr(hapd, sa)))) { in handle_auth()
3095 auth_sae_queue(hapd, mgmt, len, rssi); in handle_auth()
3100 sta = ap_get_sta(hapd, sa); in handle_auth()
3108 hostapd_logger(hapd, sta->addr, in handle_auth()
3126 if (hapd->conf->mesh & MESH_ENABLED) { in handle_auth()
3136 wpabuf_free(hapd->mesh_pending_auth); in handle_auth()
3137 hapd->mesh_pending_auth = wpabuf_alloc_copy(mgmt, len); in handle_auth()
3138 os_get_reltime(&hapd->mesh_pending_auth_time); in handle_auth()
3143 sta = ap_sta_add(hapd, sa); in handle_auth()
3162 u8 link_id = hapd->mld_link_id; in handle_auth()
3176 hapd->own_addr, ETH_ALEN); in handle_auth()
3187 res = ieee802_11_set_radius_info(hapd, sta, res, &rad_info); in handle_auth()
3219 if (FULL_AP_CLIENT_STATE_SUPP(hapd->iface->drv_flags) && in handle_auth()
3221 !(hapd->conf->mesh & MESH_ENABLED) && in handle_auth()
3223 if (ap_sta_re_add(hapd, sta) < 0) { in handle_auth()
3231 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth()
3237 mlme_authenticate_indication(hapd, sta); in handle_auth()
3242 resp = auth_shared_key(hapd, sta, auth_transaction, challenge, in handle_auth()
3248 mlme_authenticate_indication(hapd, sta); in handle_auth()
3263 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, in handle_auth()
3275 handle_auth_ft_finish, hapd); in handle_auth()
3283 hapd->conf->mesh & MESH_ENABLED) { in handle_auth()
3286 wpa_auth_sta_init(hapd->wpa_auth, in handle_auth()
3296 handle_auth_sae(hapd, sta, mgmt, len, auth_transaction, in handle_auth()
3303 handle_auth_fils(hapd, sta, mgmt->u.auth.variable, in handle_auth()
3311 handle_auth_pasn(hapd, sta, mgmt, len, auth_transaction, in handle_auth()
3321 if (ap_sta_is_mld(hapd, sta)) in handle_auth()
3325 reply_res = send_auth_reply(hapd, sta, dst, auth_alg, in handle_auth()
3333 hostapd_drv_sta_remove(hapd, sta->addr); in handle_auth()
3339 static u8 hostapd_max_bssid_indicator(struct hostapd_data *hapd) in hostapd_max_bssid_indicator() argument
3344 if (!hapd->iconf->mbssid || hapd->iface->num_bss <= 1) in hostapd_max_bssid_indicator()
3347 num_bss_nontx = hapd->iface->num_bss - 1; in hostapd_max_bssid_indicator()
3356 static u32 hostapd_get_aid_word(struct hostapd_data *hapd, in hostapd_get_aid_word() argument
3364 if (hapd->conf->mld_ap && sta->mld_info.mld_sta) { in hostapd_get_aid_word()
3373 link_bss = hostapd_mld_get_link_bss(hapd, j); in hostapd_get_aid_word()
3388 return hapd->sta_aid[i]; in hostapd_get_aid_word()
3392 int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta) in hostapd_get_aid() argument
3399 hapd = hostapd_mbssid_get_tx_bss(hapd); in hostapd_get_aid()
3411 u32 aid_word = hostapd_get_aid_word(hapd, sta, i); in hostapd_get_aid()
3424 aid = i * 32 + j + (1 << hostapd_max_bssid_indicator(hapd)); in hostapd_get_aid()
3429 hapd->sta_aid[i] |= BIT(j); in hostapd_get_aid()
3435 static u16 check_ssid(struct hostapd_data *hapd, struct sta_info *sta, in check_ssid() argument
3441 if (ssid_ie_len != hapd->conf->ssid.ssid_len || in check_ssid()
3442 os_memcmp(ssid_ie, hapd->conf->ssid.ssid, ssid_ie_len) != 0) { in check_ssid()
3443 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_ssid()
3454 static u16 check_wmm(struct hostapd_data *hapd, struct sta_info *sta, in check_wmm() argument
3459 if (wmm_ie && hapd->conf->wmm_enabled) { in check_wmm()
3462 if (!hostapd_eid_wmm_valid(hapd, wmm_ie, wmm_ie_len)) { in check_wmm()
3463 hostapd_logger(hapd, sta->addr, in check_wmm()
3478 static u16 check_multi_ap(struct hostapd_data *hapd, struct sta_info *sta, in check_multi_ap() argument
3486 if (!hapd->conf->multi_ap) in check_multi_ap()
3490 if (!(hapd->conf->multi_ap & FRONTHAUL_BSS)) { in check_multi_ap()
3491 hostapd_logger(hapd, sta->addr, in check_multi_ap()
3507 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_multi_ap()
3513 (hapd->conf->multi_ap_client_disallow & in check_multi_ap()
3515 hostapd_logger(hapd, sta->addr, in check_multi_ap()
3523 (hapd->conf->multi_ap_client_disallow & in check_multi_ap()
3525 hostapd_logger(hapd, sta->addr, in check_multi_ap()
3533 if (hapd->conf->multi_ap & FRONTHAUL_BSS) in check_multi_ap()
3536 hostapd_logger(hapd, sta->addr, in check_multi_ap()
3543 if (!(hapd->conf->multi_ap & BACKHAUL_BSS)) in check_multi_ap()
3544 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_multi_ap()
3553 static u16 copy_supp_rates(struct hostapd_data *hapd, struct sta_info *sta, in copy_supp_rates() argument
3557 if (hapd->iface->current_mode && in copy_supp_rates()
3558 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AD) in copy_supp_rates()
3562 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in copy_supp_rates()
3570 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in copy_supp_rates()
3589 static int owe_group_supported(struct hostapd_data *hapd, u16 group) in owe_group_supported() argument
3592 int *groups = hapd->conf->owe_groups; in owe_group_supported()
3609 static u16 owe_process_assoc_req(struct hostapd_data *hapd, in owe_process_assoc_req() argument
3628 if (!owe_group_supported(hapd, group)) { in owe_process_assoc_req()
3758 wpa_auth_pmksa_add2(hapd->wpa_auth, sta->addr, sta->owe_pmk, in owe_process_assoc_req()
3765 u16 owe_validate_request(struct hostapd_data *hapd, const u8 *peer, in owe_validate_request() argument
3804 u16 owe_process_rsn_ie(struct hostapd_data *hapd, in owe_process_rsn_ie() argument
3822 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, sta->addr, in owe_process_rsn_ie()
3831 if (ap_sta_is_mld(hapd, sta)) in owe_process_rsn_ie()
3837 res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm, in owe_process_rsn_ie()
3838 hapd->iface->freq, rsn_ie, rsn_ie_len, in owe_process_rsn_ie()
3843 status = owe_process_assoc_req(hapd, sta, owe_dh, owe_dh_len); in owe_process_rsn_ie()
3880 hostapd_drv_update_dh_ie(hapd, link_addr ? link_addr : sta->addr, in owe_process_rsn_ie()
3891 static bool check_sa_query(struct hostapd_data *hapd, struct sta_info *sta, in check_sa_query() argument
3900 ap_check_sa_query_timeout(hapd, sta); in check_sa_query()
3910 ap_sta_start_sa_query(hapd, sta); in check_sa_query()
3919 static int __check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta, in __check_assoc_ies() argument
3931 resp = check_ssid(hapd, sta, elems->ssid, elems->ssid_len); in __check_assoc_ies()
3934 resp = check_wmm(hapd, sta, elems->wmm, elems->wmm_len); in __check_assoc_ies()
3937 resp = check_ext_capab(hapd, sta, elems->ext_capab, in __check_assoc_ies()
3941 resp = copy_supp_rates(hapd, sta, elems); in __check_assoc_ies()
3945 resp = check_multi_ap(hapd, sta, elems->multi_ap, elems->multi_ap_len); in __check_assoc_ies()
3949 resp = copy_sta_ht_capab(hapd, sta, elems->ht_capabilities); in __check_assoc_ies()
3952 if (hapd->iconf->ieee80211n && hapd->iconf->require_ht && in __check_assoc_ies()
3954 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in __check_assoc_ies()
3961 if (hapd->iconf->ieee80211ac) { in __check_assoc_ies()
3962 resp = copy_sta_vht_capab(hapd, sta, elems->vht_capabilities); in __check_assoc_ies()
3966 resp = set_sta_vht_opmode(hapd, sta, elems->opmode_notif); in __check_assoc_ies()
3971 if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht && in __check_assoc_ies()
3973 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in __check_assoc_ies()
3979 if (hapd->conf->vendor_vht && !elems->vht_capabilities) { in __check_assoc_ies()
3980 resp = copy_sta_vendor_vht(hapd, sta, elems->vendor_vht, in __check_assoc_ies()
3987 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { in __check_assoc_ies()
3988 resp = copy_sta_he_capab(hapd, sta, IEEE80211_MODE_AP, in __check_assoc_ies()
3994 if (hapd->iconf->require_he && !(sta->flags & WLAN_STA_HE)) { in __check_assoc_ies()
3995 hostapd_logger(hapd, sta->addr, in __check_assoc_ies()
4002 if (is_6ghz_op_class(hapd->iconf->op_class)) { in __check_assoc_ies()
4004 hostapd_logger(hapd, sta->addr, in __check_assoc_ies()
4010 resp = copy_sta_he_6ghz_capab(hapd, sta, in __check_assoc_ies()
4018 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in __check_assoc_ies()
4019 resp = copy_sta_eht_capab(hapd, sta, IEEE80211_MODE_AP, in __check_assoc_ies()
4028 resp = hostapd_process_ml_assoc_req(hapd, elems, sta); in __check_assoc_ies()
4048 if ((hapd->conf->wpa & WPA_PROTO_RSN) && elems->rsn_ie) { in __check_assoc_ies()
4051 } else if ((hapd->conf->wpa & WPA_PROTO_WPA) && in __check_assoc_ies()
4062 if (hapd->conf->wps_state && elems->wps_ie && ies && ies_len) { in __check_assoc_ies()
4080 } else if (hapd->conf->wps_state && wpa_ie == NULL) { in __check_assoc_ies()
4086 if (hapd->conf->wpa && wpa_ie == NULL) { in __check_assoc_ies()
4087 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in __check_assoc_ies()
4093 if (hapd->conf->wpa && wpa_ie) { in __check_assoc_ies()
4106 hapd, sta, &assoc_hapd); in __check_assoc_ies()
4108 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, in __check_assoc_ies()
4120 if (ap_sta_is_mld(hapd, sta)) { in __check_assoc_ies()
4131 res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm, in __check_assoc_ies()
4132 hapd->iface->freq, in __check_assoc_ies()
4196 if (hapd->conf->sae_pwe == SAE_PWE_BOTH && in __check_assoc_ies()
4209 if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) && in __check_assoc_ies()
4212 resp = owe_process_assoc_req(hapd, sta, elems->owe_dh, in __check_assoc_ies()
4225 (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP) && in __check_assoc_ies()
4226 hapd->conf->dpp_netaccesskey && sta->wpa_sm && in __check_assoc_ies()
4230 wpabuf_head(hapd->conf->dpp_netaccesskey), in __check_assoc_ies()
4231 wpabuf_len(hapd->conf->dpp_netaccesskey)); in __check_assoc_ies()
4254 hostapd_logger(hapd, sta->addr, in __check_assoc_ies()
4264 hapd->conf->ssid_protection && in __check_assoc_ies()
4269 } else if (hapd->conf->osen) { in __check_assoc_ies()
4272 hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in __check_assoc_ies()
4280 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, in __check_assoc_ies()
4287 if (wpa_validate_osen(hapd->wpa_auth, sta->wpa_sm, in __check_assoc_ies()
4295 p2p_group_notif_assoc(hapd->p2p_group, sta->addr, ies, ies_len); in __check_assoc_ies()
4307 hapd->conf->ieee80211w != NO_MGMT_FRAME_PROTECTION) { in __check_assoc_ies()
4328 if (hapd->iface->fst) in __check_assoc_ies()
4335 mbo_ap_check_sta_assoc(hapd, sta, elems); in __check_assoc_ies()
4337 if (hapd->conf->mbo_enabled && (hapd->conf->wpa & 2) && in __check_assoc_ies()
4339 hapd->conf->ieee80211w != NO_MGMT_FRAME_PROTECTION) { in __check_assoc_ies()
4356 if (hostapd_drv_channel_info(hapd, &ci) != 0) { in __check_assoc_ies()
4379 wpa_msg(hapd->msg_ctx, MSG_INFO, OCV_FAILURE "addr=" in __check_assoc_ies()
4405 hapd->conf->max_acceptable_idle_period) { in __check_assoc_ies()
4409 if (req <= hapd->conf->max_acceptable_idle_period) in __check_assoc_ies()
4411 else if (hapd->conf->max_acceptable_idle_period > in __check_assoc_ies()
4412 hapd->conf->ap_max_inactivity) in __check_assoc_ies()
4414 hapd->conf->max_acceptable_idle_period; in __check_assoc_ies()
4421 static int check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta, in check_assoc_ies() argument
4427 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_assoc_ies()
4433 return __check_assoc_ies(hapd, sta, ies, ies_len, &elems, reassoc, in check_assoc_ies()
4440 static void ieee80211_ml_build_assoc_resp(struct hostapd_data *hapd, in ieee80211_ml_build_assoc_resp() argument
4448 WPA_PUT_LE16(p, hostapd_own_capab_info(hapd)); in ieee80211_ml_build_assoc_resp()
4459 p = hostapd_eid_supp_rates(hapd, p); in ieee80211_ml_build_assoc_resp()
4460 p = hostapd_eid_ext_supp_rates(hapd, p); in ieee80211_ml_build_assoc_resp()
4461 p = hostapd_eid_rm_enabled_capab(hapd, p, buf + buflen - p); in ieee80211_ml_build_assoc_resp()
4462 p = hostapd_eid_ht_capabilities(hapd, p); in ieee80211_ml_build_assoc_resp()
4463 p = hostapd_eid_ht_operation(hapd, p); in ieee80211_ml_build_assoc_resp()
4465 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) { in ieee80211_ml_build_assoc_resp()
4466 p = hostapd_eid_vht_capabilities(hapd, p, 0); in ieee80211_ml_build_assoc_resp()
4467 p = hostapd_eid_vht_operation(hapd, p); in ieee80211_ml_build_assoc_resp()
4470 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { in ieee80211_ml_build_assoc_resp()
4471 p = hostapd_eid_he_capab(hapd, p, IEEE80211_MODE_AP); in ieee80211_ml_build_assoc_resp()
4472 p = hostapd_eid_he_operation(hapd, p); in ieee80211_ml_build_assoc_resp()
4473 p = hostapd_eid_spatial_reuse(hapd, p); in ieee80211_ml_build_assoc_resp()
4474 p = hostapd_eid_he_mu_edca_parameter_set(hapd, p); in ieee80211_ml_build_assoc_resp()
4475 p = hostapd_eid_he_6ghz_band_cap(hapd, p); in ieee80211_ml_build_assoc_resp()
4476 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in ieee80211_ml_build_assoc_resp()
4477 p = hostapd_eid_eht_capab(hapd, p, IEEE80211_MODE_AP); in ieee80211_ml_build_assoc_resp()
4478 p = hostapd_eid_eht_operation(hapd, p); in ieee80211_ml_build_assoc_resp()
4482 p = hostapd_eid_ext_capab(hapd, p, false); in ieee80211_ml_build_assoc_resp()
4483 p = hostapd_eid_mbo(hapd, p, buf + buflen - p); in ieee80211_ml_build_assoc_resp()
4484 p = hostapd_eid_wmm(hapd, p); in ieee80211_ml_build_assoc_resp()
4486 if (hapd->conf->assocresp_elements && in ieee80211_ml_build_assoc_resp()
4488 wpabuf_len(hapd->conf->assocresp_elements)) { in ieee80211_ml_build_assoc_resp()
4489 os_memcpy(p, wpabuf_head(hapd->conf->assocresp_elements), in ieee80211_ml_build_assoc_resp()
4490 wpabuf_len(hapd->conf->assocresp_elements)); in ieee80211_ml_build_assoc_resp()
4491 p += wpabuf_len(hapd->conf->assocresp_elements); in ieee80211_ml_build_assoc_resp()
4501 static int ieee80211_ml_process_link(struct hostapd_data *hapd, in ieee80211_ml_process_link() argument
4514 hapd->mld_link_id, MAC2STR(link->peer_addr)); in ieee80211_ml_process_link()
4522 sta = ap_get_sta(hapd, origin_sta->addr); in ieee80211_ml_process_link()
4530 sta = ap_sta_add(hapd, origin_sta->addr); in ieee80211_ml_process_link()
4542 hapd->mld_link_id, true) == in ieee80211_ml_process_link()
4553 status = __check_assoc_ies(hapd, sta, NULL, 0, &elems, reassoc, true); in ieee80211_ml_process_link()
4580 hapd->sta_aid[(sta->aid - 1) / 32] |= BIT((sta->aid - 1) % 32); in ieee80211_ml_process_link()
4582 if (update_ht_state(hapd, sta) > 0) in ieee80211_ml_process_link()
4583 ieee802_11_update_beacons(hapd->iface); in ieee80211_ml_process_link()
4599 hapd->mld_link_id, sta->aid); in ieee80211_ml_process_link()
4605 if (!offload && add_associated_sta(hapd, sta, reassoc)) in ieee80211_ml_process_link()
4612 ieee80211_ml_build_assoc_resp(hapd, link); in ieee80211_ml_process_link()
4617 ap_free_sta(hapd, sta); in ieee80211_ml_process_link()
4625 bool hostapd_is_mld_ap(struct hostapd_data *hapd) in hostapd_is_mld_ap() argument
4627 if (!hapd->conf->mld_ap) in hostapd_is_mld_ap()
4630 if (!hapd->iface || !hapd->iface->interfaces || in hostapd_is_mld_ap()
4631 hapd->iface->interfaces->count <= 1) in hostapd_is_mld_ap()
4640 int hostapd_process_assoc_ml_info(struct hostapd_data *hapd, in hostapd_process_assoc_ml_info() argument
4649 if (!hostapd_is_mld_ap(hapd)) in hostapd_process_assoc_ml_info()
4660 for_each_mld_link(bss, hapd) { in hostapd_process_assoc_ml_info()
4661 if (bss == hapd) in hostapd_process_assoc_ml_info()
4677 ieee80211_ml_build_assoc_resp(hapd, link); in hostapd_process_assoc_ml_info()
4682 ieee80211_ml_build_assoc_resp(hapd, link); in hostapd_process_assoc_ml_info()
4696 static void send_deauth(struct hostapd_data *hapd, const u8 *addr, in send_deauth() argument
4706 os_memcpy(reply.sa, hapd->own_addr, ETH_ALEN); in send_deauth()
4707 os_memcpy(reply.bssid, hapd->own_addr, ETH_ALEN); in send_deauth()
4712 if (hostapd_drv_send_mlme(hapd, &reply, send_len, 0, NULL, 0, 0) < 0) in send_deauth()
4718 static int add_associated_sta(struct hostapd_data *hapd, in add_associated_sta() argument
4730 if (ap_sta_is_mld(hapd, sta)) { in add_associated_sta()
4731 u8 mld_link_id = hapd->mld_link_id; in add_associated_sta()
4736 if (hapd->mld_link_id != sta->mld_assoc_link_id) in add_associated_sta()
4773 hostapd_drv_sta_remove(hapd, sta->addr); in add_associated_sta()
4784 hostapd_get_ht_capab(hapd, sta->ht_capabilities, &ht_cap); in add_associated_sta()
4787 hostapd_get_vht_capab(hapd, sta->vht_capabilities, &vht_cap); in add_associated_sta()
4791 hostapd_get_he_capab(hapd, sta->he_capab, &he_cap, in add_associated_sta()
4797 hostapd_get_eht_capab(hapd, sta->eht_capab, &eht_cap, in add_associated_sta()
4806 if (hostapd_sta_add(hapd, sta->addr, sta->aid, sta->capability, in add_associated_sta()
4819 hostapd_logger(hapd, sta->addr, in add_associated_sta()
4825 hostapd_drv_sta_remove(hapd, sta->addr); in add_associated_sta()
4838 static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta, in send_assoc_resp() argument
4858 if (sta && (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE)) in send_assoc_resp()
4866 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in send_assoc_resp()
4867 buflen += hostapd_eid_eht_capab_len(hapd, IEEE80211_MODE_AP); in send_assoc_resp()
4869 if (hapd->iconf->punct_bitmap) in send_assoc_resp()
4886 os_memcpy(reply->sa, hapd->own_addr, ETH_ALEN); in send_assoc_resp()
4887 os_memcpy(reply->bssid, hapd->own_addr, ETH_ALEN); in send_assoc_resp()
4892 host_to_le16(hostapd_own_capab_info(hapd)); in send_assoc_resp()
4898 p = hostapd_eid_supp_rates(hapd, reply->u.assoc_resp.variable); in send_assoc_resp()
4900 p = hostapd_eid_ext_supp_rates(hapd, p); in send_assoc_resp()
4903 p = hostapd_eid_rm_enabled_capab(hapd, p, buf + buflen - p); in send_assoc_resp()
4908 int delta = hapd->iconf->rssi_reject_assoc_rssi - rssi; in send_assoc_resp()
4910 p = hostapd_eid_mbo_rssi_assoc_rej(hapd, p, buf + buflen - p, in send_assoc_resp()
4943 (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE)) in send_assoc_resp()
4950 p = hostapd_eid_assoc_comeback_time(hapd, sta, p); in send_assoc_resp()
4952 p = hostapd_eid_ht_capabilities(hapd, p); in send_assoc_resp()
4953 p = hostapd_eid_ht_operation(hapd, p); in send_assoc_resp()
4956 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac && in send_assoc_resp()
4957 !is_6ghz_op_class(hapd->iconf->op_class)) { in send_assoc_resp()
4960 if (sta && hapd->conf->use_sta_nsts && sta->vht_capabilities) { in send_assoc_resp()
4963 nsts = (hapd->iface->conf->vht_capab >> in send_assoc_resp()
4974 p = hostapd_eid_vht_capabilities(hapd, p, nsts); in send_assoc_resp()
4975 p = hostapd_eid_vht_operation(hapd, p); in send_assoc_resp()
4980 if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { in send_assoc_resp()
4981 p = hostapd_eid_he_capab(hapd, p, IEEE80211_MODE_AP); in send_assoc_resp()
4982 p = hostapd_eid_he_operation(hapd, p); in send_assoc_resp()
4983 p = hostapd_eid_cca(hapd, p); in send_assoc_resp()
4984 p = hostapd_eid_spatial_reuse(hapd, p); in send_assoc_resp()
4985 p = hostapd_eid_he_mu_edca_parameter_set(hapd, p); in send_assoc_resp()
4986 p = hostapd_eid_he_6ghz_band_cap(hapd, p); in send_assoc_resp()
4990 p = hostapd_eid_ext_capab(hapd, p, false); in send_assoc_resp()
4991 p = hostapd_eid_bss_max_idle_period(hapd, p, sta->max_idle_period); in send_assoc_resp()
4993 p = hostapd_eid_qos_map_set(hapd, p); in send_assoc_resp()
4996 if (hapd->iface->fst_ies) { in send_assoc_resp()
4997 os_memcpy(p, wpabuf_head(hapd->iface->fst_ies), in send_assoc_resp()
4998 wpabuf_len(hapd->iface->fst_ies)); in send_assoc_resp()
4999 p += wpabuf_len(hapd->iface->fst_ies); in send_assoc_resp()
5004 if (hapd->conf->rsnxe_override_ft && in send_assoc_resp()
5006 (long int) wpabuf_len(hapd->conf->rsnxe_override_ft) && in send_assoc_resp()
5009 os_memcpy(p, wpabuf_head(hapd->conf->rsnxe_override_ft), in send_assoc_resp()
5010 wpabuf_len(hapd->conf->rsnxe_override_ft)); in send_assoc_resp()
5011 p += wpabuf_len(hapd->conf->rsnxe_override_ft); in send_assoc_resp()
5016 p = hostapd_eid_rsnxe(hapd, p, buf + buflen - p); in send_assoc_resp()
5022 if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { in send_assoc_resp()
5023 if (hapd->conf->mld_ap) in send_assoc_resp()
5024 p = hostapd_eid_eht_ml_assoc(hapd, sta, p); in send_assoc_resp()
5025 p = hostapd_eid_eht_capab(hapd, p, IEEE80211_MODE_AP); in send_assoc_resp()
5026 p = hostapd_eid_eht_operation(hapd, p); in send_assoc_resp()
5031 if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) && in send_assoc_resp()
5055 if (DPP_VERSION > 1 && (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP) && in send_assoc_resp()
5065 if (sta && hapd->conf->vendor_vht && (sta->flags & WLAN_STA_VENDOR_VHT)) in send_assoc_resp()
5066 p = hostapd_eid_vendor_vht(hapd, p); in send_assoc_resp()
5070 p = hostapd_eid_wmm(hapd, p); in send_assoc_resp()
5075 ((sta->flags & WLAN_STA_MAYBE_WPS) && hapd->conf->wpa))) { in send_assoc_resp()
5086 p = hostapd_eid_multi_ap(hapd, p, buf + buflen - p); in send_assoc_resp()
5089 if (sta && sta->p2p_ie && hapd->p2p_group) { in send_assoc_resp()
5103 p2p_resp_ie = p2p_group_assoc_resp_ie(hapd->p2p_group, status); in send_assoc_resp()
5114 if (hapd->conf->p2p & P2P_MANAGE) in send_assoc_resp()
5115 p = hostapd_eid_p2p_manage(hapd, p); in send_assoc_resp()
5118 p = hostapd_eid_mbo(hapd, p, buf + buflen - p); in send_assoc_resp()
5120 if (hapd->conf->assocresp_elements && in send_assoc_resp()
5122 wpabuf_len(hapd->conf->assocresp_elements)) { in send_assoc_resp()
5123 os_memcpy(p, wpabuf_head(hapd->conf->assocresp_elements), in send_assoc_resp()
5124 wpabuf_len(hapd->conf->assocresp_elements)); in send_assoc_resp()
5125 p += wpabuf_len(hapd->conf->assocresp_elements); in send_assoc_resp()
5160 if (hostapd_drv_send_mlme(hapd, reply, send_len, 0, NULL, 0, 0) < 0) { in send_assoc_resp()
5173 u8 * owe_assoc_req_process(struct hostapd_data *hapd, struct sta_info *sta, in owe_assoc_req_process() argument
5178 if (hapd->conf->own_ie_override) { in owe_assoc_req_process()
5200 *status = owe_process_assoc_req(hapd, sta, owe_dh, owe_dh_len); in owe_assoc_req_process()
5235 void fils_hlp_finish_assoc(struct hostapd_data *hapd, struct sta_info *sta) in fils_hlp_finish_assoc() argument
5241 eloop_cancel_timeout(fils_hlp_timeout, hapd, sta); in fils_hlp_finish_assoc()
5244 reply_res = send_assoc_resp(hapd, sta, sta->addr, WLAN_STATUS_SUCCESS, in fils_hlp_finish_assoc()
5262 hostapd_drv_sta_remove(hapd, sta->addr); in fils_hlp_finish_assoc()
5268 struct hostapd_data *hapd = eloop_ctx; in fils_hlp_timeout() local
5275 hostapd_notify_assoc_fils_finish(hapd, sta); in fils_hlp_timeout()
5277 fils_hlp_finish_assoc(hapd, sta); in fils_hlp_timeout()
5284 static struct sta_info * handle_mlo_translate(struct hostapd_data *hapd, in handle_mlo_translate() argument
5294 if (!hapd->iconf->ieee80211be || hapd->conf->disable_11be) in handle_mlo_translate()
5308 if (hostapd_process_ml_assoc_req_addr(hapd, elems.basic_mle, in handle_mlo_translate()
5313 sta = ap_get_sta(hapd, mld_addr); in handle_mlo_translate()
5320 return hostapd_ml_get_assoc_sta(hapd, sta, assoc_hapd); in handle_mlo_translate()
5325 static void handle_assoc(struct hostapd_data *hapd, in handle_assoc() argument
5352 if (hapd->iconf->ignore_reassoc_probability > 0.0 && in handle_assoc()
5353 drand48() < hapd->iconf->ignore_reassoc_probability) { in handle_assoc()
5360 if (hapd->iconf->ignore_assoc_probability > 0.0 && in handle_assoc()
5361 drand48() < hapd->iconf->ignore_assoc_probability) { in handle_assoc()
5398 sta = ap_get_sta(hapd, mgmt->sa); in handle_assoc()
5410 sta = handle_mlo_translate(hapd, mgmt, len, reassoc, in handle_assoc()
5415 hapd = assoc_hapd; in handle_assoc()
5436 if (hapd->iface->current_mode && in handle_assoc()
5437 hapd->iface->current_mode->mode == in handle_assoc()
5442 acl_res = ieee802_11_allowed_address(hapd, mgmt->sa, in handle_assoc()
5446 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in handle_assoc()
5458 sta = ap_sta_add(hapd, mgmt->sa); in handle_assoc()
5460 hostapd_logger(hapd, mgmt->sa, in handle_assoc()
5469 hapd, sta, acl_res, &info); in handle_assoc()
5475 hostapd_logger(hapd, sta->addr, in handle_assoc()
5483 hostapd_logger(hapd, mgmt->sa, in handle_assoc()
5489 send_deauth(hapd, mgmt->sa, in handle_assoc()
5500 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_assoc()
5510 if (hapd->tkip_countermeasures) { in handle_assoc()
5515 if (listen_interval > hapd->conf->max_listen_interval) { in handle_assoc()
5516 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in handle_assoc()
5525 if (hapd->conf->mbo_enabled && hapd->mbo_assoc_disallow) { in handle_assoc()
5530 if (hapd->iconf->rssi_reject_assoc_rssi && rssi && in handle_assoc()
5531 rssi < hapd->iconf->rssi_reject_assoc_rssi && in handle_assoc()
5533 sta->auth_rssi < hapd->iconf->rssi_reject_assoc_rssi)) { in handle_assoc()
5539 if (hapd->conf->wpa && check_sa_query(hapd, sta, reassoc)) { in handle_assoc()
5578 resp = check_assoc_ies(hapd, sta, pos, left, reassoc); in handle_assoc()
5583 if (hostapd_get_aid(hapd, sta) < 0) { in handle_assoc()
5584 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in handle_assoc()
5592 if (hapd->iface->current_mode && in handle_assoc()
5593 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in handle_assoc()
5603 hapd->iface->num_sta_non_erp++; in handle_assoc()
5604 if (hapd->iface->num_sta_non_erp == 1) in handle_assoc()
5611 hapd->iface->num_sta_no_short_slot_time++; in handle_assoc()
5612 if (hapd->iface->current_mode && in handle_assoc()
5613 hapd->iface->current_mode->mode == in handle_assoc()
5615 hapd->iface->num_sta_no_short_slot_time == 1) in handle_assoc()
5627 hapd->iface->num_sta_no_short_preamble++; in handle_assoc()
5628 if (hapd->iface->current_mode && in handle_assoc()
5629 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G in handle_assoc()
5630 && hapd->iface->num_sta_no_short_preamble == 1) in handle_assoc()
5634 if (update_ht_state(hapd, sta) > 0) in handle_assoc()
5637 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_assoc()
5660 taxonomy_sta_info_assoc_req(hapd, sta, pos, left); in handle_assoc()
5669 if (fils_process_hlp(hapd, sta, pos, left) > 0) in handle_assoc()
5675 ieee802_11_update_beacons(hapd->iface); in handle_assoc()
5698 hostapd_process_assoc_ml_info(hapd, sta, pos, left, reassoc, in handle_assoc()
5702 add_associated_sta(hapd, sta, reassoc)) in handle_assoc()
5707 eloop_is_timeout_registered(fils_hlp_timeout, hapd, sta) && in handle_assoc()
5720 eloop_cancel_timeout(fils_hlp_timeout, hapd, sta); in handle_assoc()
5735 eloop_cancel_timeout(fils_hlp_timeout, hapd, sta); in handle_assoc()
5736 eloop_register_timeout(0, hapd->conf->fils_hlp_wait_time * 1024, in handle_assoc()
5737 fils_hlp_timeout, hapd, sta); in handle_assoc()
5743 reply_res = send_assoc_resp(hapd, in handle_assoc()
5758 hostapd_drv_sta_remove(hapd, sta->addr); in handle_assoc()
5764 static void hostapd_deauth_sta(struct hostapd_data *hapd, in hostapd_deauth_sta() argument
5768 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in hostapd_deauth_sta()
5772 ap_sta_set_authorized(hapd, sta, 0); in hostapd_deauth_sta()
5776 hostapd_set_sta_flags(hapd, sta); in hostapd_deauth_sta()
5778 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in hostapd_deauth_sta()
5781 hapd, sta, le_to_host16(mgmt->u.deauth.reason_code)); in hostapd_deauth_sta()
5784 ap_free_sta(hapd, sta); in hostapd_deauth_sta()
5788 static void hostapd_disassoc_sta(struct hostapd_data *hapd, in hostapd_disassoc_sta() argument
5792 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in hostapd_disassoc_sta()
5796 ap_sta_set_authorized(hapd, sta, 0); in hostapd_disassoc_sta()
5799 hostapd_set_sta_flags(hapd, sta); in hostapd_disassoc_sta()
5801 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in hostapd_disassoc_sta()
5807 accounting_sta_stop(hapd, sta); in hostapd_disassoc_sta()
5808 ieee802_1x_free_station(hapd, sta); in hostapd_disassoc_sta()
5810 hostapd_drv_br_delete_ip_neigh(hapd, 4, (u8 *) &sta->ipaddr); in hostapd_disassoc_sta()
5811 ap_sta_ip6addr_del(hapd, sta); in hostapd_disassoc_sta()
5812 hostapd_drv_sta_remove(hapd, sta->addr); in hostapd_disassoc_sta()
5818 eloop_cancel_timeout(ap_handle_timer, hapd, sta); in hostapd_disassoc_sta()
5820 hapd, sta); in hostapd_disassoc_sta()
5824 hapd, sta, le_to_host16(mgmt->u.disassoc.reason_code)); in hostapd_disassoc_sta()
5828 if (hapd->iface->current_mode && in hostapd_disassoc_sta()
5829 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AD) { in hostapd_disassoc_sta()
5832 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in hostapd_disassoc_sta()
5834 ap_free_sta(hapd, sta); in hostapd_disassoc_sta()
5839 static bool hostapd_ml_handle_disconnect(struct hostapd_data *hapd, in hostapd_ml_handle_disconnect() argument
5849 if (!hostapd_is_mld_ap(hapd)) in hostapd_ml_handle_disconnect()
5856 assoc_sta = hostapd_ml_get_assoc_sta(hapd, sta, &assoc_hapd); in hostapd_ml_handle_disconnect()
5895 static void handle_disassoc(struct hostapd_data *hapd, in handle_disassoc() argument
5901 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in handle_disassoc()
5907 sta = ap_get_sta(hapd, mgmt->sa); in handle_disassoc()
5909 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR in handle_disassoc()
5915 if (hostapd_ml_handle_disconnect(hapd, sta, mgmt, true)) in handle_disassoc()
5918 hostapd_disassoc_sta(hapd, sta, mgmt); in handle_disassoc()
5922 static void handle_deauth(struct hostapd_data *hapd, in handle_deauth() argument
5928 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in handle_deauth()
5935 ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE); in handle_deauth()
5937 sta = ap_get_sta(hapd, mgmt->sa); in handle_deauth()
5939 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR in handle_deauth()
5945 if (hostapd_ml_handle_disconnect(hapd, sta, mgmt, false)) in handle_deauth()
5948 hostapd_deauth_sta(hapd, sta, mgmt); in handle_deauth()
5952 static void handle_beacon(struct hostapd_data *hapd, in handle_beacon() argument
5969 ap_list_process_beacon(hapd->iface, mgmt, &elems, fi); in handle_beacon()
5980 static int handle_action(struct hostapd_data *hapd, in handle_action() argument
5988 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in handle_action()
6001 sta = ap_get_sta(hapd, mgmt->sa); in handle_action()
6014 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in handle_action()
6029 hostapd_logger(hapd, sta->addr, in handle_action()
6051 hostapd_wmm_action(hapd, mgmt, len); in handle_action()
6054 ieee802_11_sa_query_action(hapd, mgmt, len); in handle_action()
6058 ieee802_11_rx_wnm_action_ap(hapd, mgmt, len); in handle_action()
6063 if (hapd->iface->fst) in handle_action()
6064 fst_rx_action(hapd->iface->fst, mgmt, len); in handle_action()
6075 hostapd_2040_coex_action(hapd, mgmt, len); in handle_action()
6090 hostapd_dpp_rx_action(hapd, mgmt->sa, pos, end - pos, in handle_action()
6103 if (gas_query_ap_rx(hapd->gas, mgmt->sa, in handle_action()
6123 hostapd_nan_usd_rx_sdf(hapd, mgmt->sa, freq, in handle_action()
6128 if (hapd->public_action_cb) { in handle_action()
6129 hapd->public_action_cb(hapd->public_action_cb_ctx, in handle_action()
6132 if (hapd->public_action_cb2) { in handle_action()
6133 hapd->public_action_cb2(hapd->public_action_cb2_ctx, in handle_action()
6136 if (hapd->public_action_cb || hapd->public_action_cb2) in handle_action()
6140 if (hapd->vendor_action_cb) { in handle_action()
6141 if (hapd->vendor_action_cb(hapd->vendor_action_cb_ctx, in handle_action()
6148 hostapd_handle_radio_measurement(hapd, (const u8 *) mgmt, len); in handle_action()
6153 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in handle_action()
6174 os_memcpy(resp->sa, hapd->own_addr, ETH_ALEN); in handle_action()
6175 os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN); in handle_action()
6178 if (hostapd_drv_send_mlme(hapd, resp, len, 0, NULL, 0, 0) < 0) { in handle_action()
6198 static void notify_mgmt_frame(struct hostapd_data *hapd, const u8 *buf, in notify_mgmt_frame() argument
6207 wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, in notify_mgmt_frame()
6227 int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len, in ieee802_11_mgmt() argument
6246 freq = hapd->iface->freq; in ieee802_11_mgmt()
6254 ether_addr_equal(mgmt->sa, hapd->own_addr)) { in ieee802_11_mgmt()
6265 handle_beacon(hapd, mgmt, len, fi); in ieee802_11_mgmt()
6272 !((hapd->conf->p2p & P2P_GROUP_OWNER) && in ieee802_11_mgmt()
6276 !(hapd->conf->mesh & MESH_ENABLED) && in ieee802_11_mgmt()
6279 !(hapd->conf->mld_ap && in ieee802_11_mgmt()
6280 ether_addr_equal(hapd->mld->mld_addr, mgmt->bssid)) && in ieee802_11_mgmt()
6282 !ether_addr_equal(mgmt->bssid, hapd->own_addr)) { in ieee802_11_mgmt()
6288 if (hapd->iface->state != HAPD_IFACE_ENABLED) { in ieee802_11_mgmt()
6295 handle_probe_req(hapd, mgmt, len, ssi_signal); in ieee802_11_mgmt()
6302 !(hapd->conf->mld_ap && in ieee802_11_mgmt()
6303 ether_addr_equal(hapd->mld->mld_addr, mgmt->bssid)) && in ieee802_11_mgmt()
6308 !ether_addr_equal(mgmt->da, hapd->own_addr)) { in ieee802_11_mgmt()
6309 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in ieee802_11_mgmt()
6316 if (hapd->iconf->track_sta_max_num) in ieee802_11_mgmt()
6317 sta_track_add(hapd->iface, mgmt->sa, ssi_signal); in ieee802_11_mgmt()
6319 if (hapd->conf->notify_mgmt_frames) in ieee802_11_mgmt()
6320 notify_mgmt_frame(hapd, buf, len); in ieee802_11_mgmt()
6325 handle_auth(hapd, mgmt, len, ssi_signal, 0); in ieee802_11_mgmt()
6330 handle_assoc(hapd, mgmt, len, 0, ssi_signal); in ieee802_11_mgmt()
6335 handle_assoc(hapd, mgmt, len, 1, ssi_signal); in ieee802_11_mgmt()
6340 handle_disassoc(hapd, mgmt, len); in ieee802_11_mgmt()
6344 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "mgmt::deauth"); in ieee802_11_mgmt()
6345 handle_deauth(hapd, mgmt, len); in ieee802_11_mgmt()
6350 ret = handle_action(hapd, mgmt, len, freq); in ieee802_11_mgmt()
6353 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in ieee802_11_mgmt()
6363 static void handle_auth_cb(struct hostapd_data *hapd, in handle_auth_cb() argument
6371 sta = ap_get_sta(hapd, mgmt->da); in handle_auth_cb()
6393 hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, in handle_auth_cb()
6402 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth_cb()
6406 hostapd_set_sta_flags(hapd, sta); in handle_auth_cb()
6414 success_status = sae_status_success(hapd, status_code); in handle_auth_cb()
6417 hostapd_drv_sta_remove(hapd, sta->addr); in handle_auth_cb()
6423 static void hostapd_set_wds_encryption(struct hostapd_data *hapd, in hostapd_set_wds_encryption() argument
6429 struct hostapd_ssid *ssid = &hapd->conf->ssid; in hostapd_set_wds_encryption()
6431 if (hapd->conf->ieee802_1x || hapd->conf->wpa) in hostapd_set_wds_encryption()
6436 hostapd_drv_set_key(ifname_wds, hapd, WPA_ALG_WEP, NULL, i, in hostapd_set_wds_encryption()
6453 static void ieee80211_ml_link_sta_assoc_cb(struct hostapd_data *hapd, in ieee80211_ml_link_sta_assoc_cb() argument
6461 hostapd_logger(hapd, link->peer_addr, HOSTAPD_MODULE_IEEE80211, in ieee80211_ml_link_sta_assoc_cb()
6468 hostapd_drv_sta_remove(hapd, sta->addr); in ieee80211_ml_link_sta_assoc_cb()
6479 if (!hapd->conf->ieee802_1x && !hapd->conf->wpa) in ieee80211_ml_link_sta_assoc_cb()
6480 updated = ap_sta_set_authorized_flag(hapd, sta, 1); in ieee80211_ml_link_sta_assoc_cb()
6482 hostapd_set_sta_flags(hapd, sta); in ieee80211_ml_link_sta_assoc_cb()
6484 ap_sta_set_authorized_event(hapd, sta, 1); in ieee80211_ml_link_sta_assoc_cb()
6497 static void hostapd_ml_handle_assoc_cb(struct hostapd_data *hapd, in hostapd_ml_handle_assoc_cb() argument
6503 if (!hostapd_is_mld_ap(hapd)) in hostapd_ml_handle_assoc_cb()
6506 for_each_mld_link(tmp_hapd, hapd) { in hostapd_ml_handle_assoc_cb()
6510 if (tmp_hapd == hapd) in hostapd_ml_handle_assoc_cb()
6534 static void handle_assoc_cb(struct hostapd_data *hapd, in handle_assoc_cb() argument
6542 sta = ap_get_sta(hapd, mgmt->da); in handle_assoc_cb()
6550 if (ap_sta_is_mld(hapd, sta) && in handle_assoc_cb()
6551 hapd->mld_link_id != sta->mld_assoc_link_id) { in handle_assoc_cb()
6555 __func__, hapd->mld_link_id, sta->mld_assoc_link_id); in handle_assoc_cb()
6565 hostapd_drv_sta_remove(hapd, sta->addr); in handle_assoc_cb()
6575 hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, in handle_assoc_cb()
6581 hostapd_drv_sta_remove(hapd, sta->addr); in handle_assoc_cb()
6591 accounting_sta_stop(hapd, sta); in handle_assoc_cb()
6593 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_assoc_cb()
6602 if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa && in handle_assoc_cb()
6603 !hapd->conf->osen) || in handle_assoc_cb()
6612 ap_sta_set_authorized(hapd, sta, 1); in handle_assoc_cb()
6616 mlme_reassociate_indication(hapd, sta); in handle_assoc_cb()
6618 mlme_associate_indication(hapd, sta); in handle_assoc_cb()
6628 if (ap_sta_bind_vlan(hapd, sta) < 0) in handle_assoc_cb()
6632 if (ap_sta_bind_vlan(hapd, sta) < 0) in handle_assoc_cb()
6636 hostapd_set_sta_flags(hapd, sta); in handle_assoc_cb()
6649 (hapd->conf->multi_ap & BACKHAUL_BSS) && in handle_assoc_cb()
6650 hapd->conf->wds_sta && in handle_assoc_cb()
6658 ret = hostapd_set_wds_sta(hapd, ifname_wds, sta->addr, in handle_assoc_cb()
6661 hostapd_set_wds_encryption(hapd, sta, ifname_wds); in handle_assoc_cb()
6668 hapd->new_assoc_sta_cb(hapd, sta, !new_assoc); in handle_assoc_cb()
6677 ap_sta_disconnect(hapd, sta, sta->addr, in handle_assoc_cb()
6693 hapd, mgmt->da, in handle_assoc_cb()
6704 hostapd_ml_handle_assoc_cb(hapd, sta, ok); in handle_assoc_cb()
6708 static void handle_deauth_cb(struct hostapd_data *hapd, in handle_deauth_cb() argument
6715 sta = ap_get_sta(hapd, mgmt->da); in handle_deauth_cb()
6728 ap_sta_deauth_cb(hapd, sta); in handle_deauth_cb()
6732 static void handle_disassoc_cb(struct hostapd_data *hapd, in handle_disassoc_cb() argument
6739 sta = ap_get_sta(hapd, mgmt->da); in handle_disassoc_cb()
6752 ap_sta_disassoc_cb(hapd, sta); in handle_disassoc_cb()
6756 static void handle_action_cb(struct hostapd_data *hapd, in handle_action_cb() argument
6778 hostapd_dpp_tx_status(hapd, mgmt->da, pos, end - pos, ok); in handle_action_cb()
6791 gas_query_ap_tx_status(hapd->gas, mgmt->da, pos, end - pos, ok); in handle_action_cb()
6797 sta = ap_get_sta(hapd, mgmt->da); in handle_action_cb()
6812 ap_sta_session_timeout(hapd, sta, 0); in handle_action_cb()
6827 hostapd_rrm_beacon_req_tx_status(hapd, mgmt, len, ok); in handle_action_cb()
6841 void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len, in ieee802_11_mgmt_cb() argument
6848 if (hapd->ext_mgmt_frame_handling) { in ieee802_11_mgmt_cb()
6854 wpa_msg(hapd->msg_ctx, MSG_INFO, in ieee802_11_mgmt_cb()
6866 handle_auth_cb(hapd, mgmt, len, ok); in ieee802_11_mgmt_cb()
6870 handle_assoc_cb(hapd, mgmt, len, 0, ok); in ieee802_11_mgmt_cb()
6874 handle_assoc_cb(hapd, mgmt, len, 1, ok); in ieee802_11_mgmt_cb()
6881 handle_deauth_cb(hapd, mgmt, len, ok); in ieee802_11_mgmt_cb()
6885 handle_disassoc_cb(hapd, mgmt, len, ok); in ieee802_11_mgmt_cb()
6889 handle_action_cb(hapd, mgmt, len, ok); in ieee802_11_mgmt_cb()
6898 int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) in ieee802_11_get_mib() argument
6905 int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, in ieee802_11_get_mib_sta() argument
6913 void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr, in hostapd_tx_status() argument
6917 struct hostapd_iface *iface = hapd->iface; in hostapd_tx_status()
6919 sta = ap_get_sta(hapd, addr); in hostapd_tx_status()
6923 hapd = iface->bss[j]; in hostapd_tx_status()
6924 sta = ap_get_sta(hapd, addr); in hostapd_tx_status()
6939 ieee802_1x_tx_status(hapd, sta, buf, len, ack); in hostapd_tx_status()
6943 void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr) in hostapd_client_poll_ok() argument
6946 struct hostapd_iface *iface = hapd->iface; in hostapd_client_poll_ok()
6948 sta = ap_get_sta(hapd, addr); in hostapd_client_poll_ok()
6952 hapd = iface->bss[j]; in hostapd_client_poll_ok()
6953 sta = ap_get_sta(hapd, addr); in hostapd_client_poll_ok()
6960 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POLL_OK MACSTR, in hostapd_client_poll_ok()
6971 void ieee802_11_rx_from_unknown(struct hostapd_data *hapd, const u8 *src, in ieee802_11_rx_from_unknown() argument
6976 sta = ap_get_sta(hapd, src); in ieee802_11_rx_from_unknown()
6980 if (!hapd->conf->wds_sta) in ieee802_11_rx_from_unknown()
7001 ret = hostapd_set_wds_sta(hapd, ifname_wds, in ieee802_11_rx_from_unknown()
7004 hostapd_set_wds_encryption(hapd, sta, in ieee802_11_rx_from_unknown()
7013 ether_addr_equal(src, hapd->own_addr)) { in ieee802_11_rx_from_unknown()
7029 hapd, src, in ieee802_11_rx_from_unknown()
7033 hapd, src, in ieee802_11_rx_from_unknown()
7070 u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_txpower_envelope() argument
7072 struct hostapd_iface *iface = hapd->iface; in hostapd_eid_txpower_envelope()
7112 if (hapd->iconf->reg_def_cli_eirp_psd != -1) in hostapd_eid_txpower_envelope()
7113 tx_pwr = hapd->iconf->reg_def_cli_eirp_psd; in hostapd_eid_txpower_envelope()
7124 if (hapd->iconf->reg_sub_cli_eirp_psd != -1) in hostapd_eid_txpower_envelope()
7125 tx_pwr = hapd->iconf->reg_sub_cli_eirp_psd; in hostapd_eid_txpower_envelope()
7139 hapd->iconf->reg_def_cli_eirp); in hostapd_eid_txpower_envelope()
7174 dfs = hostapd_is_dfs_required(hapd->iface); in hostapd_eid_txpower_envelope()
7184 if (hapd->iconf->local_pwr_constraint == -1) in hostapd_eid_txpower_envelope()
7187 local_pwr_constraint = hapd->iconf->local_pwr_constraint; in hostapd_eid_txpower_envelope()
7223 u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_wb_chsw_wrapper() argument
7228 if (!hapd->cs_freq_params.channel || in hostapd_eid_wb_chsw_wrapper()
7229 (!hapd->cs_freq_params.vht_enabled && in hostapd_eid_wb_chsw_wrapper()
7230 !hapd->cs_freq_params.he_enabled && in hostapd_eid_wb_chsw_wrapper()
7231 !hapd->cs_freq_params.eht_enabled)) in hostapd_eid_wb_chsw_wrapper()
7236 switch (hapd->cs_freq_params.bandwidth) { in hostapd_eid_wb_chsw_wrapper()
7254 freq1 = hapd->cs_freq_params.center_freq1 ? in hostapd_eid_wb_chsw_wrapper()
7255 hapd->cs_freq_params.center_freq1 : in hostapd_eid_wb_chsw_wrapper()
7256 hapd->cs_freq_params.freq; in hostapd_eid_wb_chsw_wrapper()
7261 if (hapd->cs_freq_params.center_freq2 && in hostapd_eid_wb_chsw_wrapper()
7262 ieee80211_freq_to_chan(hapd->cs_freq_params.center_freq2, in hostapd_eid_wb_chsw_wrapper()
7271 if (hapd->cs_freq_params.bandwidth == 160) { in hostapd_eid_wb_chsw_wrapper()
7281 if (hapd->cs_freq_params.channel < chan1) in hostapd_eid_wb_chsw_wrapper()
7293 static size_t hostapd_eid_nr_db_len(struct hostapd_data *hapd, in hostapd_eid_nr_db_len() argument
7299 dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, in hostapd_eid_nr_db_len()
7304 if (nr->short_ssid == hapd->conf->ssid.short_ssid) in hostapd_eid_nr_db_len()
7364 hostapd_eid_rnr_iface_len(struct hostapd_data *hapd, in hostapd_eid_rnr_iface_len() argument
7380 while (start < hapd->iface->num_bss) { in hostapd_eid_rnr_iface_len()
7392 for (i = start; i < hapd->iface->num_bss; i++) { in hostapd_eid_rnr_iface_len()
7393 struct hostapd_data *bss = hapd->iface->bss[i]; in hostapd_eid_rnr_iface_len()
7464 static enum colocation_mode get_colocation_mode(struct hostapd_data *hapd) in get_colocation_mode() argument
7467 bool is_6ghz = is_6ghz_op_class(hapd->iconf->op_class); in get_colocation_mode()
7469 if (!hapd->iface || !hapd->iface->interfaces) in get_colocation_mode()
7472 if (is_6ghz && hapd->iface->interfaces->count == 1) in get_colocation_mode()
7475 for (i = 0; i < hapd->iface->interfaces->count; i++) { in get_colocation_mode()
7479 iface = hapd->iface->interfaces->iface[i]; in get_colocation_mode()
7480 if (iface == hapd->iface || !iface || !iface->conf) in get_colocation_mode()
7497 static size_t hostapd_eid_rnr_colocation_len(struct hostapd_data *hapd, in hostapd_eid_rnr_colocation_len() argument
7504 if (!hapd->iface || !hapd->iface->interfaces) in hostapd_eid_rnr_colocation_len()
7507 for (i = 0; i < hapd->iface->interfaces->count; i++) { in hostapd_eid_rnr_colocation_len()
7508 iface = hapd->iface->interfaces->iface[i]; in hostapd_eid_rnr_colocation_len()
7510 if (!iface || iface == hapd->iface || in hostapd_eid_rnr_colocation_len()
7515 len += hostapd_eid_rnr_iface_len(iface->bss[0], hapd, in hostapd_eid_rnr_colocation_len()
7523 static size_t hostapd_eid_rnr_mlo_len(struct hostapd_data *hapd, u32 type, in hostapd_eid_rnr_mlo_len() argument
7531 if (!hapd->iface || !hapd->iface->interfaces || !hapd->conf->mld_ap) in hostapd_eid_rnr_mlo_len()
7538 for (i = 0; i < hapd->iface->interfaces->count; i++) { in hostapd_eid_rnr_mlo_len()
7539 iface = hapd->iface->interfaces->iface[i]; in hostapd_eid_rnr_mlo_len()
7541 if (!iface || iface == hapd->iface || in hostapd_eid_rnr_mlo_len()
7542 hapd->iface->freq == iface->freq) in hostapd_eid_rnr_mlo_len()
7545 len += hostapd_eid_rnr_iface_len(iface->bss[0], hapd, in hostapd_eid_rnr_mlo_len()
7554 size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type, in hostapd_eid_rnr_len() argument
7558 enum colocation_mode mode = get_colocation_mode(hapd); in hostapd_eid_rnr_len()
7562 if (hapd->conf->rnr) in hostapd_eid_rnr_len()
7563 total_len += hostapd_eid_nr_db_len(hapd, &current_len); in hostapd_eid_rnr_len()
7568 hostapd_eid_rnr_colocation_len(hapd, in hostapd_eid_rnr_len()
7571 if (hapd->conf->rnr && hapd->iface->num_bss > 1 && in hostapd_eid_rnr_len()
7572 !hapd->iconf->mbssid) in hostapd_eid_rnr_len()
7573 total_len += hostapd_eid_rnr_iface_len(hapd, hapd, in hostapd_eid_rnr_len()
7578 if (hapd->iface->num_bss > 1 && mode == STANDALONE_6GHZ) in hostapd_eid_rnr_len()
7579 total_len += hostapd_eid_rnr_iface_len(hapd, hapd, in hostapd_eid_rnr_len()
7589 hapd->iconf->mbssid != ENHANCED_MBSSID_ENABLED)) in hostapd_eid_rnr_len()
7590 total_len += hostapd_eid_rnr_mlo_len(hapd, type, &current_len); in hostapd_eid_rnr_len()
7596 static u8 * hostapd_eid_nr_db(struct hostapd_data *hapd, u8 *eid, in hostapd_eid_nr_db() argument
7603 dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, in hostapd_eid_nr_db()
7608 if (nr->short_ssid == hapd->conf->ssid.short_ssid) in hostapd_eid_nr_db()
7651 static bool hostapd_eid_rnr_bss(struct hostapd_data *hapd, in hostapd_eid_rnr_bss() argument
7658 struct hostapd_iface *iface = hapd->iface; in hostapd_eid_rnr_bss()
7665 ap_mld = !!hapd->conf->mld_ap; in hostapd_eid_rnr_bss()
7700 if (bss == hostapd_mbssid_get_tx_bss(hapd)) in hostapd_eid_rnr_bss()
7704 if (is_6ghz_op_class(hapd->iconf->op_class) && in hostapd_eid_rnr_bss()
7748 static u8 * hostapd_eid_rnr_iface(struct hostapd_data *hapd, in hostapd_eid_rnr_iface() argument
7754 struct hostapd_iface *iface = hapd->iface; in hostapd_eid_rnr_iface()
7767 hapd->iconf->secondary_channel, in hostapd_eid_rnr_iface()
7768 hostapd_get_oper_chwidth(hapd->iconf), in hostapd_eid_rnr_iface()
7788 if (hostapd_eid_rnr_bss(hapd, reporting_hapd, in hostapd_eid_rnr_iface()
7822 u8 * hostapd_eid_rnr_colocation(struct hostapd_data *hapd, u8 *eid, in hostapd_eid_rnr_colocation() argument
7828 if (!hapd->iface || !hapd->iface->interfaces) in hostapd_eid_rnr_colocation()
7831 for (i = 0; i < hapd->iface->interfaces->count; i++) { in hostapd_eid_rnr_colocation()
7832 iface = hapd->iface->interfaces->iface[i]; in hostapd_eid_rnr_colocation()
7834 if (!iface || iface == hapd->iface || in hostapd_eid_rnr_colocation()
7839 eid = hostapd_eid_rnr_iface(iface->bss[0], hapd, eid, in hostapd_eid_rnr_colocation()
7847 u8 * hostapd_eid_rnr_mlo(struct hostapd_data *hapd, u32 type, in hostapd_eid_rnr_mlo() argument
7854 if (!hapd->iface || !hapd->iface->interfaces || !hapd->conf->mld_ap) in hostapd_eid_rnr_mlo()
7861 for (i = 0; i < hapd->iface->interfaces->count; i++) { in hostapd_eid_rnr_mlo()
7862 iface = hapd->iface->interfaces->iface[i]; in hostapd_eid_rnr_mlo()
7864 if (!iface || iface == hapd->iface || in hostapd_eid_rnr_mlo()
7865 hapd->iface->freq == iface->freq) in hostapd_eid_rnr_mlo()
7868 eid = hostapd_eid_rnr_iface(iface->bss[0], hapd, eid, in hostapd_eid_rnr_mlo()
7877 u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type, in hostapd_eid_rnr() argument
7882 enum colocation_mode mode = get_colocation_mode(hapd); in hostapd_eid_rnr()
7886 if (hapd->conf->rnr) in hostapd_eid_rnr()
7887 eid = hostapd_eid_nr_db(hapd, eid, &current_len); in hostapd_eid_rnr()
7891 eid = hostapd_eid_rnr_colocation(hapd, eid, in hostapd_eid_rnr()
7894 if (hapd->conf->rnr && hapd->iface->num_bss > 1 && in hostapd_eid_rnr()
7895 !hapd->iconf->mbssid) in hostapd_eid_rnr()
7896 eid = hostapd_eid_rnr_iface(hapd, hapd, eid, in hostapd_eid_rnr()
7900 if (hapd->iface->num_bss > 1 && mode == STANDALONE_6GHZ) in hostapd_eid_rnr()
7901 eid = hostapd_eid_rnr_iface(hapd, hapd, eid, in hostapd_eid_rnr()
7912 hapd->iconf->mbssid != ENHANCED_MBSSID_ENABLED)) in hostapd_eid_rnr()
7913 eid = hostapd_eid_rnr_mlo(hapd, type, eid, &current_len); in hostapd_eid_rnr()
7953 static size_t hostapd_eid_mbssid_elem_len(struct hostapd_data *hapd, in hostapd_eid_mbssid_elem_len() argument
7958 struct hostapd_data *tx_bss = hostapd_mbssid_get_tx_bss(hapd); in hostapd_eid_mbssid_elem_len()
7973 for (i = *bss_index; i < hapd->iface->num_bss; i++) { in hostapd_eid_mbssid_elem_len()
7974 struct hostapd_data *bss = hapd->iface->bss[i]; in hostapd_eid_mbssid_elem_len()
8016 else if (hapd->conf->xrates_supported) in hostapd_eid_mbssid_elem_len()
8034 size_t hostapd_eid_mbssid_len(struct hostapd_data *hapd, u32 frame_type, in hostapd_eid_mbssid_len() argument
8042 ap_mld = hapd->conf->mld_ap; in hostapd_eid_mbssid_len()
8045 if (!hapd->iconf->mbssid || hapd->iface->num_bss <= 1 || in hostapd_eid_mbssid_len()
8059 while (bss_index < hapd->iface->num_bss) { in hostapd_eid_mbssid_len()
8062 len += hostapd_eid_mbssid_elem_len(hapd, frame_type, in hostapd_eid_mbssid_len()
8068 if (hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED && rnr_len) { in hostapd_eid_mbssid_len()
8075 hapd, hostapd_mbssid_get_tx_bss(hapd), in hostapd_eid_mbssid_len()
8080 if (hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED && rnr_len) in hostapd_eid_mbssid_len()
8081 *rnr_len += hostapd_eid_rnr_len(hapd, frame_type, false); in hostapd_eid_mbssid_len()
8087 static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end, in hostapd_eid_mbssid_elem() argument
8092 struct hostapd_data *tx_bss = hostapd_mbssid_get_tx_bss(hapd); in hostapd_eid_mbssid_elem()
8100 for (i = *bss_index; i < hapd->iface->num_bss; i++) { in hostapd_eid_mbssid_elem()
8101 struct hostapd_data *bss = hapd->iface->bss[i]; in hostapd_eid_mbssid_elem()
8132 if (hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED && in hostapd_eid_mbssid_elem()
8170 if (hapd->conf->xrates_supported && in hostapd_eid_mbssid_elem()
8202 u8 * hostapd_eid_mbssid(struct hostapd_data *hapd, u8 *eid, u8 *end, in hostapd_eid_mbssid() argument
8213 ap_mld = hapd->conf->mld_ap; in hostapd_eid_mbssid()
8216 if (!hapd->iconf->mbssid || hapd->iface->num_bss <= 1 || in hostapd_eid_mbssid()
8227 add_rnr = hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED && in hostapd_eid_mbssid()
8231 while (bss_index < hapd->iface->num_bss) { in hostapd_eid_mbssid()
8244 eid = hostapd_eid_mbssid_elem(hapd, eid, end, frame_stype, in hostapd_eid_mbssid()
8245 hostapd_max_bssid_indicator(hapd), in hostapd_eid_mbssid()
8258 hapd, hostapd_mbssid_get_tx_bss(hapd), in hostapd_eid_mbssid()
8268 if (hapd->conf->rnr) in hostapd_eid_mbssid()
8269 rnr_eid = hostapd_eid_nr_db(hapd, rnr_eid, &cur_len); in hostapd_eid_mbssid()
8270 if (get_colocation_mode(hapd) == COLOCATED_LOWER_BAND) in hostapd_eid_mbssid()
8271 rnr_eid = hostapd_eid_rnr_colocation(hapd, rnr_eid, in hostapd_eid_mbssid()