Lines Matching refs:hapd
59 prepare_auth_resp_fils(struct hostapd_data *hapd,
66 static void handle_auth(struct hostapd_data *hapd,
71 u8 * hostapd_eid_multi_ap(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_multi_ap() argument
75 if (!hapd->conf->multi_ap) in hostapd_eid_multi_ap()
77 if (hapd->conf->multi_ap & BACKHAUL_BSS) in hostapd_eid_multi_ap()
79 if (hapd->conf->multi_ap & FRONTHAUL_BSS) in hostapd_eid_multi_ap()
86 u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_supp_rates() argument
91 if (hapd->iface->current_rates == NULL) in hostapd_eid_supp_rates()
95 num = hapd->iface->num_rates; in hostapd_eid_supp_rates()
96 if (hapd->iconf->ieee80211n && hapd->iconf->require_ht) in hostapd_eid_supp_rates()
98 if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht) in hostapd_eid_supp_rates()
107 for (i = 0, count = 0; i < hapd->iface->num_rates && count < num; in hostapd_eid_supp_rates()
110 *pos = hapd->iface->current_rates[i].rate / 5; in hostapd_eid_supp_rates()
111 if (hapd->iface->current_rates[i].flags & HOSTAPD_RATE_BASIC) in hostapd_eid_supp_rates()
116 if (hapd->iconf->ieee80211n && hapd->iconf->require_ht && count < 8) { in hostapd_eid_supp_rates()
121 if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht && count < 8) { in hostapd_eid_supp_rates()
130 u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_ext_supp_rates() argument
135 if (hapd->iface->current_rates == NULL) in hostapd_eid_ext_supp_rates()
138 num = hapd->iface->num_rates; in hostapd_eid_ext_supp_rates()
139 if (hapd->iconf->ieee80211n && hapd->iconf->require_ht) in hostapd_eid_ext_supp_rates()
141 if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht) in hostapd_eid_ext_supp_rates()
149 for (i = 0, count = 0; i < hapd->iface->num_rates && count < num + 8; in hostapd_eid_ext_supp_rates()
154 *pos = hapd->iface->current_rates[i].rate / 5; in hostapd_eid_ext_supp_rates()
155 if (hapd->iface->current_rates[i].flags & HOSTAPD_RATE_BASIC) in hostapd_eid_ext_supp_rates()
160 if (hapd->iconf->ieee80211n && hapd->iconf->require_ht) { in hostapd_eid_ext_supp_rates()
166 if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht) { in hostapd_eid_ext_supp_rates()
176 u16 hostapd_own_capab_info(struct hostapd_data *hapd) in hostapd_own_capab_info() argument
184 dfs = hostapd_is_dfs_required(hapd->iface); in hostapd_own_capab_info()
191 if (hapd->iface->num_sta_no_short_preamble == 0 && in hostapd_own_capab_info()
192 hapd->iconf->preamble == SHORT_PREAMBLE) in hostapd_own_capab_info()
195 privacy = hapd->conf->ssid.wep.keys_set; in hostapd_own_capab_info()
197 if (hapd->conf->ieee802_1x && in hostapd_own_capab_info()
198 (hapd->conf->default_wep_key_len || in hostapd_own_capab_info()
199 hapd->conf->individual_wep_key_len)) in hostapd_own_capab_info()
202 if (hapd->conf->wpa) in hostapd_own_capab_info()
206 if (hapd->conf->osen) in hostapd_own_capab_info()
213 if (hapd->iface->current_mode && in hostapd_own_capab_info()
214 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G && in hostapd_own_capab_info()
215 hapd->iface->num_sta_no_short_slot_time == 0) in hostapd_own_capab_info()
224 if (hapd->iface->current_mode && in hostapd_own_capab_info()
225 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && in hostapd_own_capab_info()
226 (hapd->iconf->spectrum_mgmt_required || dfs)) in hostapd_own_capab_info()
230 if (hapd->conf->radio_measurements[i]) { in hostapd_own_capab_info()
241 static u16 auth_shared_key(struct hostapd_data *hapd, struct sta_info *sta, in auth_shared_key() argument
245 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in auth_shared_key()
278 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in auth_shared_key()
285 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in auth_shared_key()
298 static int send_auth_reply(struct hostapd_data *hapd, in send_auth_reply() argument
317 os_memcpy(reply->sa, hapd->own_addr, ETH_ALEN); in send_auth_reply()
331 if (hostapd_drv_send_mlme(hapd, reply, rlen, 0) < 0) in send_auth_reply()
347 struct hostapd_data *hapd = ctx; in handle_auth_ft_finish() local
351 reply_res = send_auth_reply(hapd, dst, bssid, WLAN_AUTH_FT, in handle_auth_ft_finish()
355 sta = ap_get_sta(hapd, dst); in handle_auth_ft_finish()
361 hostapd_drv_sta_remove(hapd, sta->addr); in handle_auth_ft_finish()
369 hostapd_logger(hapd, dst, HOSTAPD_MODULE_IEEE80211, in handle_auth_ft_finish()
372 mlme_authenticate_indication(hapd, sta); in handle_auth_ft_finish()
389 static struct wpabuf * auth_build_sae_commit(struct hostapd_data *hapd, in auth_build_sae_commit() argument
400 for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) { in auth_build_sae_commit()
413 password = hapd->conf->ssid.wpa_passphrase; in auth_build_sae_commit()
420 sae_prepare_commit(hapd->own_addr, sta->addr, in auth_build_sae_commit()
447 static struct wpabuf * auth_build_sae_confirm(struct hostapd_data *hapd, in auth_build_sae_confirm() argument
462 static int auth_sae_send_commit(struct hostapd_data *hapd, in auth_sae_send_commit() argument
469 data = auth_build_sae_commit(hapd, sta, update); in auth_sae_send_commit()
475 reply_res = send_auth_reply(hapd, sta->addr, bssid, WLAN_AUTH_SAE, 1, in auth_sae_send_commit()
485 static int auth_sae_send_confirm(struct hostapd_data *hapd, in auth_sae_send_confirm() argument
492 data = auth_build_sae_confirm(hapd, sta); in auth_sae_send_confirm()
496 reply_res = send_auth_reply(hapd, sta->addr, bssid, WLAN_AUTH_SAE, 2, in auth_sae_send_confirm()
506 static int use_sae_anti_clogging(struct hostapd_data *hapd) in use_sae_anti_clogging() argument
511 if (hapd->conf->sae_anti_clogging_threshold == 0) in use_sae_anti_clogging()
514 for (sta = hapd->sta_list; sta; sta = sta->next) { in use_sae_anti_clogging()
521 if (open >= hapd->conf->sae_anti_clogging_threshold) in use_sae_anti_clogging()
528 if (open + dl_list_len(&hapd->sae_commit_queue) >= in use_sae_anti_clogging()
529 hapd->conf->sae_anti_clogging_threshold) in use_sae_anti_clogging()
536 static u8 sae_token_hash(struct hostapd_data *hapd, const u8 *addr) in sae_token_hash() argument
540 hmac_sha256(hapd->sae_token_key, sizeof(hapd->sae_token_key), in sae_token_hash()
546 static int check_sae_token(struct hostapd_data *hapd, const u8 *addr, in check_sae_token() argument
557 idx = sae_token_hash(hapd, addr); in check_sae_token()
558 token_idx = hapd->sae_pending_token_idx[idx]; in check_sae_token()
570 if (hmac_sha256_vector(hapd->sae_token_key, sizeof(hapd->sae_token_key), in check_sae_token()
575 hapd->sae_pending_token_idx[idx] = 0; /* invalidate used token */ in check_sae_token()
581 static struct wpabuf * auth_build_token_req(struct hostapd_data *hapd, in auth_build_token_req() argument
594 if (!os_reltime_initialized(&hapd->last_sae_token_key_update) || in auth_build_token_req()
595 os_reltime_expired(&now, &hapd->last_sae_token_key_update, 60) || in auth_build_token_req()
596 hapd->sae_token_idx == 0xffff) { in auth_build_token_req()
597 if (random_get_bytes(hapd->sae_token_key, in auth_build_token_req()
598 sizeof(hapd->sae_token_key)) < 0) in auth_build_token_req()
601 hapd->sae_token_key, sizeof(hapd->sae_token_key)); in auth_build_token_req()
602 hapd->last_sae_token_key_update = now; in auth_build_token_req()
603 hapd->sae_token_idx = 0; in auth_build_token_req()
604 os_memset(hapd->sae_pending_token_idx, 0, in auth_build_token_req()
605 sizeof(hapd->sae_pending_token_idx)); in auth_build_token_req()
614 p_idx = sae_token_hash(hapd, addr); in auth_build_token_req()
615 token_idx = hapd->sae_pending_token_idx[p_idx]; in auth_build_token_req()
617 hapd->sae_token_idx++; in auth_build_token_req()
618 token_idx = hapd->sae_token_idx; in auth_build_token_req()
619 hapd->sae_pending_token_idx[p_idx] = token_idx; in auth_build_token_req()
627 if (hmac_sha256_vector(hapd->sae_token_key, sizeof(hapd->sae_token_key), in auth_build_token_req()
638 static int sae_check_big_sync(struct hostapd_data *hapd, struct sta_info *sta) in sae_check_big_sync() argument
640 if (sta->sae->sync > hapd->conf->sae_sync) { in sae_check_big_sync()
651 struct hostapd_data *hapd = eloop_ctx; in auth_sae_retransmit_timer() local
655 if (sae_check_big_sync(hapd, sta)) in auth_sae_retransmit_timer()
665 ret = auth_sae_send_commit(hapd, sta, hapd->own_addr, 0); in auth_sae_retransmit_timer()
667 hapd->dot11RSNASAERetransPeriod * 1000, in auth_sae_retransmit_timer()
668 auth_sae_retransmit_timer, hapd, sta); in auth_sae_retransmit_timer()
671 ret = auth_sae_send_confirm(hapd, sta, hapd->own_addr); in auth_sae_retransmit_timer()
673 hapd->dot11RSNASAERetransPeriod * 1000, in auth_sae_retransmit_timer()
674 auth_sae_retransmit_timer, hapd, sta); in auth_sae_retransmit_timer()
686 void sae_clear_retransmit_timer(struct hostapd_data *hapd, struct sta_info *sta) in sae_clear_retransmit_timer() argument
688 eloop_cancel_timeout(auth_sae_retransmit_timer, hapd, sta); in sae_clear_retransmit_timer()
692 static void sae_set_retransmit_timer(struct hostapd_data *hapd, in sae_set_retransmit_timer() argument
695 if (!(hapd->conf->mesh & MESH_ENABLED)) in sae_set_retransmit_timer()
698 eloop_cancel_timeout(auth_sae_retransmit_timer, hapd, sta); in sae_set_retransmit_timer()
699 eloop_register_timeout(0, hapd->dot11RSNASAERetransPeriod * 1000, in sae_set_retransmit_timer()
700 auth_sae_retransmit_timer, hapd, sta); in sae_set_retransmit_timer()
704 static void sae_sme_send_external_auth_status(struct hostapd_data *hapd, in sae_sme_send_external_auth_status() argument
715 hostapd_drv_send_external_auth_status(hapd, ¶ms); in sae_sme_send_external_auth_status()
719 void sae_accept_sta(struct hostapd_data *hapd, struct sta_info *sta) in sae_accept_sta() argument
732 if (!hostapd_vlan_valid(hapd->conf->vlan, &vlan_desc)) { in sae_accept_sta()
739 if (ap_sta_set_vlan(hapd, sta, &vlan_desc) < 0 || in sae_accept_sta()
740 ap_sta_bind_vlan(hapd, sta) < 0) { in sae_accept_sta()
752 mlme_authenticate_indication(hapd, sta); in sae_accept_sta()
755 wpa_auth_pmksa_add_sae(hapd->wpa_auth, sta->addr, in sae_accept_sta()
757 sae_sme_send_external_auth_status(hapd, sta, WLAN_STATUS_SUCCESS); in sae_accept_sta()
761 static int sae_sm_step(struct hostapd_data *hapd, struct sta_info *sta, in sae_sm_step() argument
778 ret = auth_sae_send_commit(hapd, sta, bssid, in sae_sm_step()
795 if (hapd->conf->mesh & MESH_ENABLED) { in sae_sm_step()
801 ret = auth_sae_send_confirm(hapd, sta, bssid); in sae_sm_step()
817 sae_set_retransmit_timer(hapd, sta); in sae_sm_step()
819 hostapd_logger(hapd, sta->addr, in sae_sm_step()
826 sae_clear_retransmit_timer(hapd, sta); in sae_sm_step()
831 ret = auth_sae_send_confirm(hapd, sta, bssid); in sae_sm_step()
836 sae_set_retransmit_timer(hapd, sta); in sae_sm_step()
837 } else if (hapd->conf->mesh & MESH_ENABLED) { in sae_sm_step()
842 if (sae_check_big_sync(hapd, sta)) in sae_sm_step()
846 ret = auth_sae_send_commit(hapd, sta, bssid, 0); in sae_sm_step()
850 sae_set_retransmit_timer(hapd, sta); in sae_sm_step()
857 ret = auth_sae_send_confirm(hapd, sta, bssid); in sae_sm_step()
868 return sae_sm_step(hapd, sta, bssid, auth_transaction, in sae_sm_step()
873 sae_clear_retransmit_timer(hapd, sta); in sae_sm_step()
875 if (sae_check_big_sync(hapd, sta)) in sae_sm_step()
879 ret = auth_sae_send_commit(hapd, sta, bssid, 1); in sae_sm_step()
886 ret = auth_sae_send_confirm(hapd, sta, bssid); in sae_sm_step()
890 sae_set_retransmit_timer(hapd, sta); in sae_sm_step()
893 sae_accept_sta(hapd, sta); in sae_sm_step()
898 (hapd->conf->mesh & MESH_ENABLED)) { in sae_sm_step()
902 wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); in sae_sm_step()
903 ap_free_sta(hapd, sta); in sae_sm_step()
907 ret = auth_sae_send_commit(hapd, sta, bssid, 1); in sae_sm_step()
915 sae_set_retransmit_timer(hapd, sta); in sae_sm_step()
917 if (sae_check_big_sync(hapd, sta)) in sae_sm_step()
921 ret = auth_sae_send_confirm(hapd, sta, bssid); in sae_sm_step()
936 static void sae_pick_next_group(struct hostapd_data *hapd, struct sta_info *sta) in sae_pick_next_group() argument
939 int i, *groups = hapd->conf->sae_groups; in sae_pick_next_group()
977 static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta, in handle_auth_sae() argument
983 int *groups = hapd->conf->sae_groups; in handle_auth_sae()
992 if (hapd->conf->sae_reflection_attack && auth_transaction == 1) { in handle_auth_sae()
996 send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE, in handle_auth_sae()
1002 if (hapd->conf->sae_commit_override && auth_transaction == 1) { in handle_auth_sae()
1004 send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE, in handle_auth_sae()
1006 wpabuf_head(hapd->conf->sae_commit_override), in handle_auth_sae()
1007 wpabuf_len(hapd->conf->sae_commit_override), in handle_auth_sae()
1030 wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); in handle_auth_sae()
1039 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth_sae()
1044 if ((hapd->conf->mesh & MESH_ENABLED) && in handle_auth_sae()
1081 resp = auth_sae_send_commit(hapd, sta, mgmt->bssid, 0); in handle_auth_sae()
1090 sae_set_retransmit_timer(hapd, sta); in handle_auth_sae()
1094 if ((hapd->conf->mesh & MESH_ENABLED) && in handle_auth_sae()
1100 sae_pick_next_group(hapd, sta); in handle_auth_sae()
1107 if (!(hapd->conf->mesh & MESH_ENABLED) && in handle_auth_sae()
1146 wpa_msg(hapd->msg_ctx, MSG_INFO, in handle_auth_sae()
1149 sae_clear_retransmit_timer(hapd, sta); in handle_auth_sae()
1155 if (token && check_sae_token(hapd, sta->addr, token, token_len) in handle_auth_sae()
1167 if (!token && use_sae_anti_clogging(hapd) && !allow_reuse) { in handle_auth_sae()
1171 data = auth_build_token_req(hapd, sta->sae->group, in handle_auth_sae()
1174 if (hapd->conf->mesh & MESH_ENABLED) in handle_auth_sae()
1180 resp = sae_sm_step(hapd, sta, mgmt->bssid, auth_transaction, in handle_auth_sae()
1183 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth_sae()
1190 !(hapd->conf->mesh & MESH_ENABLED)) { in handle_auth_sae()
1222 resp = sae_sm_step(hapd, sta, mgmt->bssid, auth_transaction, 0, in handle_auth_sae()
1225 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth_sae()
1245 sae_sme_send_external_auth_status(hapd, sta, resp); in handle_auth_sae()
1246 send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE, in handle_auth_sae()
1256 hostapd_drv_sta_remove(hapd, sta->addr); in handle_auth_sae()
1273 int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta) in auth_sae_init_committed() argument
1283 ret = auth_sae_send_commit(hapd, sta, hapd->own_addr, 0); in auth_sae_init_committed()
1289 sae_set_retransmit_timer(hapd, sta); in auth_sae_init_committed()
1297 struct hostapd_data *hapd = eloop_ctx; in auth_sae_process_commit() local
1301 q = dl_list_first(&hapd->sae_commit_queue, in auth_sae_process_commit()
1308 handle_auth(hapd, (const struct ieee80211_mgmt *) q->msg, q->len, in auth_sae_process_commit()
1312 if (eloop_is_timeout_registered(auth_sae_process_commit, hapd, NULL)) in auth_sae_process_commit()
1314 queue_len = dl_list_len(&hapd->sae_commit_queue); in auth_sae_process_commit()
1316 hapd, NULL); in auth_sae_process_commit()
1320 static void auth_sae_queue(struct hostapd_data *hapd, in auth_sae_queue() argument
1328 queue_len = dl_list_len(&hapd->sae_commit_queue); in auth_sae_queue()
1352 dl_list_for_each(q2, &hapd->sae_commit_queue, in auth_sae_queue()
1368 dl_list_add_tail(&hapd->sae_commit_queue, &q->list); in auth_sae_queue()
1371 if (eloop_is_timeout_registered(auth_sae_process_commit, hapd, NULL)) in auth_sae_queue()
1374 hapd, NULL); in auth_sae_queue()
1378 static int auth_sae_queued_addr(struct hostapd_data *hapd, const u8 *addr) in auth_sae_queued_addr() argument
1383 dl_list_for_each(q, &hapd->sae_commit_queue, in auth_sae_queued_addr()
1424 static void handle_auth_fils_finish(struct hostapd_data *hapd,
1428 void handle_auth_fils(struct hostapd_data *hapd, struct sta_info *sta, in handle_auth_fils() argument
1431 void (*cb)(struct hostapd_data *hapd, in handle_auth_fils() argument
1468 if (group != hapd->conf->fils_dh_group) { in handle_auth_fils()
1471 group, hapd->conf->fils_dh_group); in handle_auth_fils()
1542 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, sta->addr, in handle_auth_fils()
1551 res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm, in handle_auth_fils()
1552 hapd->iface->freq, in handle_auth_fils()
1580 pmksa = wpa_auth_pmksa_get(hapd->wpa_auth, sta->addr, in handle_auth_fils()
1584 pmksa = wpa_auth_pmksa_get_fils_cache_id(hapd->wpa_auth, in handle_auth_fils()
1621 ieee802_1x_alloc_eapol_sm(hapd, sta); in handle_auth_fils()
1626 hapd, sta, elems.fils_wrapped_data, in handle_auth_fils()
1653 data = prepare_auth_resp_fils(hapd, sta, &resp, pmksa, NULL, in handle_auth_fils()
1661 cb(hapd, sta, resp, data, pub); in handle_auth_fils()
1667 prepare_auth_resp_fils(struct hostapd_data *hapd, in prepare_auth_resp_fils() argument
1687 ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &ielen); in prepare_auth_resp_fils()
1736 wpabuf_put_le16(data, hapd->conf->fils_dh_group); in prepare_auth_resp_fils()
1755 res = wpa_auth_write_fte(hapd->wpa_auth, use_sha384, in prepare_auth_resp_fils()
1824 if (!hapd->conf->disable_pmksa_caching && in prepare_auth_resp_fils()
1826 hapd->wpa_auth, sta->addr, in prepare_auth_resp_fils()
1876 static void handle_auth_fils_finish(struct hostapd_data *hapd, in handle_auth_fils_finish() argument
1885 send_auth_reply(hapd, sta->addr, hapd->own_addr, auth_alg, 2, resp, in handle_auth_fils_finish()
1891 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth_fils_finish()
1897 mlme_authenticate_indication(hapd, sta); in handle_auth_fils_finish()
1902 void ieee802_11_finish_fils_auth(struct hostapd_data *hapd, in ieee802_11_finish_fils_auth() argument
1916 data = prepare_auth_resp_fils(hapd, sta, &resp, NULL, erp_resp, in ieee802_11_finish_fils_auth()
1923 sta->fils_pending_cb(hapd, sta, resp, data, pub); in ieee802_11_finish_fils_auth()
1930 ieee802_11_allowed_address(struct hostapd_data *hapd, const u8 *addr, in ieee802_11_allowed_address() argument
1940 res = hostapd_allowed_address(hapd, addr, msg, len, in ieee802_11_allowed_address()
1969 ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta, in ieee802_11_set_radius_info() argument
1977 !hostapd_vlan_valid(hapd->conf->vlan, vlan_id)) { in ieee802_11_set_radius_info()
1978 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS, in ieee802_11_set_radius_info()
1985 if (ap_sta_set_vlan(hapd, sta, vlan_id) < 0) in ieee802_11_set_radius_info()
1988 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS, in ieee802_11_set_radius_info()
1992 if (hapd->conf->wpa_psk_radius != PSK_RADIUS_IGNORED) { in ieee802_11_set_radius_info()
2007 if (hapd->conf->acct_interim_interval == 0 && acct_interim_interval) in ieee802_11_set_radius_info()
2013 ap_sta_session_timeout(hapd, sta, session_timeout); in ieee802_11_set_radius_info()
2016 ap_sta_no_session_timeout(hapd, sta); in ieee802_11_set_radius_info()
2023 static void handle_auth(struct hostapd_data *hapd, in handle_auth() argument
2049 if (hapd->iconf->ignore_auth_probability > 0.0 && in handle_auth()
2050 drand48() < hapd->iconf->ignore_auth_probability) { in handle_auth()
2089 if (hapd->tkip_countermeasures) { in handle_auth()
2096 if (!(((hapd->conf->auth_algs & WPA_AUTH_ALG_OPEN) && in handle_auth()
2099 (hapd->conf->wpa && wpa_key_mgmt_ft(hapd->conf->wpa_key_mgmt) && in handle_auth()
2103 (hapd->conf->wpa && wpa_key_mgmt_sae(hapd->conf->wpa_key_mgmt) && in handle_auth()
2107 (hapd->conf->wpa && wpa_key_mgmt_fils(hapd->conf->wpa_key_mgmt) && in handle_auth()
2109 (hapd->conf->wpa && wpa_key_mgmt_fils(hapd->conf->wpa_key_mgmt) && in handle_auth()
2110 hapd->conf->fils_dh_group && in handle_auth()
2113 ((hapd->conf->auth_algs & WPA_AUTH_ALG_SHARED) && in handle_auth()
2129 if (os_memcmp(mgmt->sa, hapd->own_addr, ETH_ALEN) == 0) { in handle_auth()
2136 if (hapd->conf->no_auth_if_seen_on) { in handle_auth()
2139 other = sta_track_seen_on(hapd->iface, mgmt->sa, in handle_auth()
2140 hapd->conf->no_auth_if_seen_on); in handle_auth()
2148 hapd->conf->iface, MAC2STR(mgmt->sa), in handle_auth()
2149 hapd->conf->no_auth_if_seen_on); in handle_auth()
2192 hapd, mgmt->sa, (const u8 *) mgmt, len, &session_timeout, in handle_auth()
2196 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in handle_auth()
2208 (auth_transaction == 2 && auth_sae_queued_addr(hapd, mgmt->sa)))) { in handle_auth()
2216 auth_sae_queue(hapd, mgmt, len, rssi); in handle_auth()
2221 sta = ap_get_sta(hapd, mgmt->sa); in handle_auth()
2229 hostapd_logger(hapd, sta->addr, in handle_auth()
2237 if ((hapd->conf->mesh & MESH_ENABLED) && in handle_auth()
2247 if (hapd->conf->mesh & MESH_ENABLED) { in handle_auth()
2257 wpabuf_free(hapd->mesh_pending_auth); in handle_auth()
2258 hapd->mesh_pending_auth = wpabuf_alloc_copy(mgmt, len); in handle_auth()
2259 os_get_reltime(&hapd->mesh_pending_auth_time); in handle_auth()
2264 sta = ap_sta_add(hapd, mgmt->sa); in handle_auth()
2278 hapd, sta, res, session_timeout, acct_interim_interval, in handle_auth()
2308 if (FULL_AP_CLIENT_STATE_SUPP(hapd->iface->drv_flags) && in handle_auth()
2310 !(hapd->conf->mesh & MESH_ENABLED) && in handle_auth()
2319 ap_sta_set_authorized(hapd, sta, 0); in handle_auth()
2320 hostapd_drv_sta_remove(hapd, sta->addr); in handle_auth()
2324 if (hostapd_sta_add(hapd, sta->addr, 0, 0, NULL, 0, 0, in handle_auth()
2326 hostapd_logger(hapd, sta->addr, in handle_auth()
2339 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth()
2345 mlme_authenticate_indication(hapd, sta); in handle_auth()
2349 resp = auth_shared_key(hapd, sta, auth_transaction, challenge, in handle_auth()
2355 mlme_authenticate_indication(hapd, sta); in handle_auth()
2369 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, in handle_auth()
2381 handle_auth_ft_finish, hapd); in handle_auth()
2389 hapd->conf->mesh & MESH_ENABLED) { in handle_auth()
2392 wpa_auth_sta_init(hapd->wpa_auth, in handle_auth()
2402 handle_auth_sae(hapd, sta, mgmt, len, auth_transaction, in handle_auth()
2409 handle_auth_fils(hapd, sta, mgmt->u.auth.variable, in handle_auth()
2422 reply_res = send_auth_reply(hapd, mgmt->sa, mgmt->bssid, auth_alg, in handle_auth()
2428 hostapd_drv_sta_remove(hapd, sta->addr); in handle_auth()
2434 int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta) in hostapd_get_aid() argument
2448 if (hapd->sta_aid[i] == (u32) -1) in hostapd_get_aid()
2451 if (!(hapd->sta_aid[i] & BIT(j))) in hostapd_get_aid()
2464 hapd->sta_aid[i] |= BIT(j); in hostapd_get_aid()
2470 static u16 check_ssid(struct hostapd_data *hapd, struct sta_info *sta, in check_ssid() argument
2476 if (ssid_ie_len != hapd->conf->ssid.ssid_len || in check_ssid()
2477 os_memcmp(ssid_ie, hapd->conf->ssid.ssid, ssid_ie_len) != 0) { in check_ssid()
2478 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_ssid()
2489 static u16 check_wmm(struct hostapd_data *hapd, struct sta_info *sta, in check_wmm() argument
2494 if (wmm_ie && hapd->conf->wmm_enabled) { in check_wmm()
2497 if (!hostapd_eid_wmm_valid(hapd, wmm_ie, wmm_ie_len)) { in check_wmm()
2498 hostapd_logger(hapd, sta->addr, in check_wmm()
2513 static u16 check_multi_ap(struct hostapd_data *hapd, struct sta_info *sta, in check_multi_ap() argument
2520 if (!hapd->conf->multi_ap) in check_multi_ap()
2532 hostapd_logger(hapd, sta->addr, in check_multi_ap()
2541 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_multi_ap()
2547 if (hapd->conf->multi_ap & FRONTHAUL_BSS) in check_multi_ap()
2550 hostapd_logger(hapd, sta->addr, in check_multi_ap()
2557 if (!(hapd->conf->multi_ap & BACKHAUL_BSS)) in check_multi_ap()
2558 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_multi_ap()
2567 static u16 copy_supp_rates(struct hostapd_data *hapd, struct sta_info *sta, in copy_supp_rates() argument
2571 if (hapd->iface->current_mode && in copy_supp_rates()
2572 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AD) in copy_supp_rates()
2576 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in copy_supp_rates()
2584 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in copy_supp_rates()
2601 static u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta, in check_ext_capab() argument
2629 static int owe_group_supported(struct hostapd_data *hapd, u16 group) in owe_group_supported() argument
2632 int *groups = hapd->conf->owe_groups; in owe_group_supported()
2649 static u16 owe_process_assoc_req(struct hostapd_data *hapd, in owe_process_assoc_req() argument
2668 if (!owe_group_supported(hapd, group)) { in owe_process_assoc_req()
2785 wpa_auth_pmksa_add2(hapd->wpa_auth, sta->addr, sta->owe_pmk, in owe_process_assoc_req()
2794 static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta, in check_assoc_ies() argument
2804 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_assoc_ies()
2810 resp = check_ssid(hapd, sta, elems.ssid, elems.ssid_len); in check_assoc_ies()
2813 resp = check_wmm(hapd, sta, elems.wmm, elems.wmm_len); in check_assoc_ies()
2816 resp = check_ext_capab(hapd, sta, elems.ext_capab, elems.ext_capab_len); in check_assoc_ies()
2819 resp = copy_supp_rates(hapd, sta, &elems); in check_assoc_ies()
2823 resp = check_multi_ap(hapd, sta, elems.multi_ap, elems.multi_ap_len); in check_assoc_ies()
2828 resp = copy_sta_ht_capab(hapd, sta, elems.ht_capabilities); in check_assoc_ies()
2831 if (hapd->iconf->ieee80211n && hapd->iconf->require_ht && in check_assoc_ies()
2833 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_assoc_ies()
2841 if (hapd->iconf->ieee80211ac) { in check_assoc_ies()
2842 resp = copy_sta_vht_capab(hapd, sta, elems.vht_capabilities); in check_assoc_ies()
2846 resp = copy_sta_vht_oper(hapd, sta, elems.vht_operation); in check_assoc_ies()
2850 resp = set_sta_vht_opmode(hapd, sta, elems.vht_opmode_notif); in check_assoc_ies()
2855 if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht && in check_assoc_ies()
2857 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_assoc_ies()
2863 if (hapd->conf->vendor_vht && !elems.vht_capabilities) { in check_assoc_ies()
2864 resp = copy_sta_vendor_vht(hapd, sta, elems.vendor_vht, in check_assoc_ies()
2884 if ((hapd->conf->wpa & WPA_PROTO_RSN) && elems.rsn_ie) { in check_assoc_ies()
2887 } else if ((hapd->conf->wpa & WPA_PROTO_WPA) && in check_assoc_ies()
2898 if (hapd->conf->wps_state && elems.wps_ie) { in check_assoc_ies()
2916 } else if (hapd->conf->wps_state && wpa_ie == NULL) { in check_assoc_ies()
2922 if (hapd->conf->wpa && wpa_ie == NULL) { in check_assoc_ies()
2923 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_assoc_ies()
2929 if (hapd->conf->wpa && wpa_ie) { in check_assoc_ies()
2934 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, in check_assoc_ies()
2943 res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm, in check_assoc_ies()
2944 hapd->iface->freq, in check_assoc_ies()
2956 ap_check_sa_query_timeout(hapd, sta); in check_assoc_ies()
2969 ap_sta_start_sa_query(hapd, sta); in check_assoc_ies()
3026 if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) && in check_assoc_ies()
3029 resp = owe_process_assoc_req(hapd, sta, elems.owe_dh, in check_assoc_ies()
3040 if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP) && in check_assoc_ies()
3041 hapd->conf->dpp_netaccesskey && sta->wpa_sm && in check_assoc_ies()
3045 wpabuf_head(hapd->conf->dpp_netaccesskey), in check_assoc_ies()
3046 wpabuf_len(hapd->conf->dpp_netaccesskey)); in check_assoc_ies()
3070 hostapd_logger(hapd, sta->addr, in check_assoc_ies()
3079 } else if (hapd->conf->osen) { in check_assoc_ies()
3082 hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in check_assoc_ies()
3090 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, in check_assoc_ies()
3097 if (wpa_validate_osen(hapd->wpa_auth, sta->wpa_sm, in check_assoc_ies()
3105 p2p_group_notif_assoc(hapd->p2p_group, sta->addr, ies, ies_len); in check_assoc_ies()
3137 if (hapd->iface->fst) in check_assoc_ies()
3144 mbo_ap_check_sta_assoc(hapd, sta, &elems); in check_assoc_ies()
3146 if (hapd->conf->mbo_enabled && (hapd->conf->wpa & 2) && in check_assoc_ies()
3148 hapd->conf->ieee80211w != NO_MGMT_FRAME_PROTECTION) { in check_assoc_ies()
3164 if (hostapd_drv_channel_info(hapd, &ci) != 0) { in check_assoc_ies()
3205 static void send_deauth(struct hostapd_data *hapd, const u8 *addr, in send_deauth() argument
3215 os_memcpy(reply.sa, hapd->own_addr, ETH_ALEN); in send_deauth()
3216 os_memcpy(reply.bssid, hapd->own_addr, ETH_ALEN); in send_deauth()
3221 if (hostapd_drv_send_mlme(hapd, &reply, send_len, 0) < 0) in send_deauth()
3227 static int add_associated_sta(struct hostapd_data *hapd, in add_associated_sta() argument
3266 hostapd_drv_sta_remove(hapd, sta->addr); in add_associated_sta()
3278 hostapd_get_ht_capab(hapd, sta->ht_capabilities, &ht_cap); in add_associated_sta()
3282 hostapd_get_vht_capab(hapd, sta->vht_capabilities, &vht_cap); in add_associated_sta()
3290 if (hostapd_sta_add(hapd, sta->addr, sta->aid, sta->capability, in add_associated_sta()
3298 hostapd_logger(hapd, sta->addr, in add_associated_sta()
3304 hostapd_drv_sta_remove(hapd, sta->addr); in add_associated_sta()
3317 static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta, in send_assoc_resp() argument
3334 if (sta && (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE)) in send_assoc_resp()
3352 os_memcpy(reply->sa, hapd->own_addr, ETH_ALEN); in send_assoc_resp()
3353 os_memcpy(reply->bssid, hapd->own_addr, ETH_ALEN); in send_assoc_resp()
3358 host_to_le16(hostapd_own_capab_info(hapd)); in send_assoc_resp()
3364 p = hostapd_eid_supp_rates(hapd, reply->u.assoc_resp.variable); in send_assoc_resp()
3366 p = hostapd_eid_ext_supp_rates(hapd, p); in send_assoc_resp()
3371 int delta = hapd->iconf->rssi_reject_assoc_rssi - rssi; in send_assoc_resp()
3373 p = hostapd_eid_mbo_rssi_assoc_rej(hapd, p, buf + buflen - p, in send_assoc_resp()
3396 (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE)) in send_assoc_resp()
3404 p = hostapd_eid_assoc_comeback_time(hapd, sta, p); in send_assoc_resp()
3408 p = hostapd_eid_ht_capabilities(hapd, p); in send_assoc_resp()
3409 p = hostapd_eid_ht_operation(hapd, p); in send_assoc_resp()
3413 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) { in send_assoc_resp()
3416 if (sta && hapd->conf->use_sta_nsts && sta->vht_capabilities) { in send_assoc_resp()
3419 nsts = (hapd->iface->conf->vht_capab >> in send_assoc_resp()
3430 p = hostapd_eid_vht_capabilities(hapd, p, nsts); in send_assoc_resp()
3431 p = hostapd_eid_vht_operation(hapd, p); in send_assoc_resp()
3435 p = hostapd_eid_ext_capab(hapd, p); in send_assoc_resp()
3436 p = hostapd_eid_bss_max_idle_period(hapd, p); in send_assoc_resp()
3438 p = hostapd_eid_qos_map_set(hapd, p); in send_assoc_resp()
3441 if (hapd->iface->fst_ies) { in send_assoc_resp()
3442 os_memcpy(p, wpabuf_head(hapd->iface->fst_ies), in send_assoc_resp()
3443 wpabuf_len(hapd->iface->fst_ies)); in send_assoc_resp()
3444 p += wpabuf_len(hapd->iface->fst_ies); in send_assoc_resp()
3449 if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) && in send_assoc_resp()
3472 if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP) && in send_assoc_resp()
3482 if (sta && hapd->conf->vendor_vht && (sta->flags & WLAN_STA_VENDOR_VHT)) in send_assoc_resp()
3483 p = hostapd_eid_vendor_vht(hapd, p); in send_assoc_resp()
3487 p = hostapd_eid_wmm(hapd, p); in send_assoc_resp()
3492 ((sta->flags & WLAN_STA_MAYBE_WPS) && hapd->conf->wpa))) { in send_assoc_resp()
3503 p = hostapd_eid_multi_ap(hapd, p); in send_assoc_resp()
3506 if (sta && sta->p2p_ie && hapd->p2p_group) { in send_assoc_resp()
3520 p2p_resp_ie = p2p_group_assoc_resp_ie(hapd->p2p_group, status); in send_assoc_resp()
3531 if (hapd->conf->p2p & P2P_MANAGE) in send_assoc_resp()
3532 p = hostapd_eid_p2p_manage(hapd, p); in send_assoc_resp()
3535 p = hostapd_eid_mbo(hapd, p, buf + buflen - p); in send_assoc_resp()
3537 if (hapd->conf->assocresp_elements && in send_assoc_resp()
3539 wpabuf_len(hapd->conf->assocresp_elements)) { in send_assoc_resp()
3540 os_memcpy(p, wpabuf_head(hapd->conf->assocresp_elements), in send_assoc_resp()
3541 wpabuf_len(hapd->conf->assocresp_elements)); in send_assoc_resp()
3542 p += wpabuf_len(hapd->conf->assocresp_elements); in send_assoc_resp()
3577 if (hostapd_drv_send_mlme(hapd, reply, send_len, 0) < 0) { in send_assoc_resp()
3590 u8 * owe_assoc_req_process(struct hostapd_data *hapd, struct sta_info *sta, in owe_assoc_req_process() argument
3595 if (hapd->conf->own_ie_override) { in owe_assoc_req_process()
3611 *reason = owe_process_assoc_req(hapd, sta, owe_dh, owe_dh_len); in owe_assoc_req_process()
3646 void fils_hlp_finish_assoc(struct hostapd_data *hapd, struct sta_info *sta) in fils_hlp_finish_assoc() argument
3652 eloop_cancel_timeout(fils_hlp_timeout, hapd, sta); in fils_hlp_finish_assoc()
3655 reply_res = send_assoc_resp(hapd, sta, sta->addr, WLAN_STATUS_SUCCESS, in fils_hlp_finish_assoc()
3672 hostapd_drv_sta_remove(hapd, sta->addr); in fils_hlp_finish_assoc()
3678 struct hostapd_data *hapd = eloop_ctx; in fils_hlp_timeout() local
3685 hostapd_notify_assoc_fils_finish(hapd, sta); in fils_hlp_timeout()
3687 fils_hlp_finish_assoc(hapd, sta); in fils_hlp_timeout()
3693 static void handle_assoc(struct hostapd_data *hapd, in handle_assoc() argument
3719 if (hapd->iconf->ignore_reassoc_probability > 0.0 && in handle_assoc()
3720 drand48() < hapd->iconf->ignore_reassoc_probability) { in handle_assoc()
3727 if (hapd->iconf->ignore_assoc_probability > 0.0 && in handle_assoc()
3728 drand48() < hapd->iconf->ignore_assoc_probability) { in handle_assoc()
3765 sta = ap_get_sta(hapd, mgmt->sa); in handle_assoc()
3781 if (hapd->iface->current_mode && in handle_assoc()
3782 hapd->iface->current_mode->mode == in handle_assoc()
3789 hapd, mgmt->sa, (const u8 *) mgmt, len, in handle_assoc()
3793 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in handle_assoc()
3805 sta = ap_sta_add(hapd, mgmt->sa); in handle_assoc()
3807 hostapd_logger(hapd, mgmt->sa, in handle_assoc()
3816 hapd, sta, acl_res, session_timeout, in handle_assoc()
3824 hostapd_logger(hapd, sta->addr, in handle_assoc()
3832 hostapd_logger(hapd, mgmt->sa, in handle_assoc()
3838 send_deauth(hapd, mgmt->sa, in handle_assoc()
3849 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_assoc()
3859 if (hapd->tkip_countermeasures) { in handle_assoc()
3864 if (listen_interval > hapd->conf->max_listen_interval) { in handle_assoc()
3865 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in handle_assoc()
3874 if (hapd->conf->mbo_enabled && hapd->mbo_assoc_disallow) { in handle_assoc()
3879 if (hapd->iconf->rssi_reject_assoc_rssi && rssi && in handle_assoc()
3880 rssi < hapd->iconf->rssi_reject_assoc_rssi && in handle_assoc()
3882 sta->auth_rssi < hapd->iconf->rssi_reject_assoc_rssi)) { in handle_assoc()
3922 resp = check_assoc_ies(hapd, sta, pos, left, reassoc); in handle_assoc()
3926 if (hostapd_get_aid(hapd, sta) < 0) { in handle_assoc()
3927 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in handle_assoc()
3935 if (hapd->iface->current_mode && in handle_assoc()
3936 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in handle_assoc()
3946 hapd->iface->num_sta_non_erp++; in handle_assoc()
3947 if (hapd->iface->num_sta_non_erp == 1) in handle_assoc()
3948 ieee802_11_set_beacons(hapd->iface); in handle_assoc()
3954 hapd->iface->num_sta_no_short_slot_time++; in handle_assoc()
3955 if (hapd->iface->current_mode && in handle_assoc()
3956 hapd->iface->current_mode->mode == in handle_assoc()
3958 hapd->iface->num_sta_no_short_slot_time == 1) in handle_assoc()
3959 ieee802_11_set_beacons(hapd->iface); in handle_assoc()
3970 hapd->iface->num_sta_no_short_preamble++; in handle_assoc()
3971 if (hapd->iface->current_mode && in handle_assoc()
3972 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G in handle_assoc()
3973 && hapd->iface->num_sta_no_short_preamble == 1) in handle_assoc()
3974 ieee802_11_set_beacons(hapd->iface); in handle_assoc()
3978 update_ht_state(hapd, sta); in handle_assoc()
3981 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_assoc()
4006 taxonomy_sta_info_assoc_req(hapd, sta, pos, left); in handle_assoc()
4015 if (fils_process_hlp(hapd, sta, pos, left) > 0) in handle_assoc()
4044 add_associated_sta(hapd, sta, reassoc)) in handle_assoc()
4049 eloop_is_timeout_registered(fils_hlp_timeout, hapd, sta) && in handle_assoc()
4062 eloop_cancel_timeout(fils_hlp_timeout, hapd, sta); in handle_assoc()
4077 eloop_cancel_timeout(fils_hlp_timeout, hapd, sta); in handle_assoc()
4078 eloop_register_timeout(0, hapd->conf->fils_hlp_wait_time * 1024, in handle_assoc()
4079 fils_hlp_timeout, hapd, sta); in handle_assoc()
4084 reply_res = send_assoc_resp(hapd, sta, mgmt->sa, resp, reassoc, pos, in handle_assoc()
4095 hostapd_drv_sta_remove(hapd, sta->addr); in handle_assoc()
4101 static void handle_disassoc(struct hostapd_data *hapd, in handle_disassoc() argument
4116 sta = ap_get_sta(hapd, mgmt->sa); in handle_disassoc()
4123 ap_sta_set_authorized(hapd, sta, 0); in handle_disassoc()
4127 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_disassoc()
4133 accounting_sta_stop(hapd, sta); in handle_disassoc()
4134 ieee802_1x_free_station(hapd, sta); in handle_disassoc()
4136 hostapd_drv_br_delete_ip_neigh(hapd, 4, (u8 *) &sta->ipaddr); in handle_disassoc()
4137 ap_sta_ip6addr_del(hapd, sta); in handle_disassoc()
4138 hostapd_drv_sta_remove(hapd, sta->addr); in handle_disassoc()
4144 eloop_cancel_timeout(ap_handle_timer, hapd, sta); in handle_disassoc()
4146 hapd, sta); in handle_disassoc()
4150 hapd, sta, le_to_host16(mgmt->u.disassoc.reason_code)); in handle_disassoc()
4154 if (hapd->iface->current_mode && in handle_disassoc()
4155 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AD) { in handle_disassoc()
4158 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_disassoc()
4160 ap_free_sta(hapd, sta); in handle_disassoc()
4165 static void handle_deauth(struct hostapd_data *hapd, in handle_deauth() argument
4171 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "handle_deauth - too short " in handle_deauth()
4176 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "deauthentication: STA=" MACSTR in handle_deauth()
4180 sta = ap_get_sta(hapd, mgmt->sa); in handle_deauth()
4182 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying " in handle_deauth()
4188 ap_sta_set_authorized(hapd, sta, 0); in handle_deauth()
4193 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_deauth()
4196 hapd, sta, le_to_host16(mgmt->u.deauth.reason_code)); in handle_deauth()
4199 ap_free_sta(hapd, sta); in handle_deauth()
4203 static void handle_beacon(struct hostapd_data *hapd, in handle_beacon() argument
4220 ap_list_process_beacon(hapd->iface, mgmt, &elems, fi); in handle_beacon()
4233 static int handle_action(struct hostapd_data *hapd, in handle_action() argument
4241 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in handle_action()
4254 sta = ap_get_sta(hapd, mgmt->sa); in handle_action()
4268 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in handle_action()
4284 hostapd_logger(hapd, sta->addr, in handle_action()
4306 hostapd_wmm_action(hapd, mgmt, len); in handle_action()
4310 ieee802_11_sa_query_action(hapd, mgmt, len); in handle_action()
4315 ieee802_11_rx_wnm_action_ap(hapd, mgmt, len); in handle_action()
4320 if (hapd->iface->fst) in handle_action()
4321 fst_rx_action(hapd->iface->fst, mgmt, len); in handle_action()
4333 hostapd_2040_coex_action(hapd, mgmt, len); in handle_action()
4349 hostapd_dpp_rx_action(hapd, mgmt->sa, pos, end - pos, in handle_action()
4362 gas_query_ap_rx(hapd->gas, mgmt->sa, in handle_action()
4364 pos, end - pos, hapd->iface->freq); in handle_action()
4368 if (hapd->public_action_cb) { in handle_action()
4369 hapd->public_action_cb(hapd->public_action_cb_ctx, in handle_action()
4371 hapd->iface->freq); in handle_action()
4373 if (hapd->public_action_cb2) { in handle_action()
4374 hapd->public_action_cb2(hapd->public_action_cb2_ctx, in handle_action()
4376 hapd->iface->freq); in handle_action()
4378 if (hapd->public_action_cb || hapd->public_action_cb2) in handle_action()
4382 if (hapd->vendor_action_cb) { in handle_action()
4383 if (hapd->vendor_action_cb(hapd->vendor_action_cb_ctx, in handle_action()
4385 hapd->iface->freq) == 0) in handle_action()
4390 hostapd_handle_radio_measurement(hapd, (const u8 *) mgmt, len); in handle_action()
4394 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in handle_action()
4415 os_memcpy(resp->sa, hapd->own_addr, ETH_ALEN); in handle_action()
4416 os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN); in handle_action()
4419 if (hostapd_drv_send_mlme(hapd, resp, len, 0) < 0) { in handle_action()
4443 int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len, in ieee802_11_mgmt() argument
4458 freq = hapd->iface->freq; in ieee802_11_mgmt()
4465 handle_beacon(hapd, mgmt, len, fi); in ieee802_11_mgmt()
4472 !((hapd->conf->p2p & P2P_GROUP_OWNER) && in ieee802_11_mgmt()
4476 !(hapd->conf->mesh & MESH_ENABLED) && in ieee802_11_mgmt()
4478 os_memcmp(mgmt->bssid, hapd->own_addr, ETH_ALEN) != 0) { in ieee802_11_mgmt()
4486 handle_probe_req(hapd, mgmt, len, ssi_signal); in ieee802_11_mgmt()
4492 os_memcmp(mgmt->da, hapd->own_addr, ETH_ALEN) != 0) { in ieee802_11_mgmt()
4493 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in ieee802_11_mgmt()
4500 if (hapd->iconf->track_sta_max_num) in ieee802_11_mgmt()
4501 sta_track_add(hapd->iface, mgmt->sa, ssi_signal); in ieee802_11_mgmt()
4506 handle_auth(hapd, mgmt, len, ssi_signal, 0); in ieee802_11_mgmt()
4511 handle_assoc(hapd, mgmt, len, 0, ssi_signal); in ieee802_11_mgmt()
4516 handle_assoc(hapd, mgmt, len, 1, ssi_signal); in ieee802_11_mgmt()
4521 handle_disassoc(hapd, mgmt, len); in ieee802_11_mgmt()
4525 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "mgmt::deauth"); in ieee802_11_mgmt()
4526 handle_deauth(hapd, mgmt, len); in ieee802_11_mgmt()
4531 ret = handle_action(hapd, mgmt, len, freq); in ieee802_11_mgmt()
4534 hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, in ieee802_11_mgmt()
4544 static void handle_auth_cb(struct hostapd_data *hapd, in handle_auth_cb() argument
4563 sta = ap_get_sta(hapd, mgmt->da); in handle_auth_cb()
4576 hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, in handle_auth_cb()
4585 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_auth_cb()
4589 hostapd_set_sta_flags(hapd, sta); in handle_auth_cb()
4595 hostapd_drv_sta_remove(hapd, sta->addr); in handle_auth_cb()
4601 static void hostapd_set_wds_encryption(struct hostapd_data *hapd, in hostapd_set_wds_encryption() argument
4606 struct hostapd_ssid *ssid = &hapd->conf->ssid; in hostapd_set_wds_encryption()
4608 if (hapd->conf->ieee802_1x || hapd->conf->wpa) in hostapd_set_wds_encryption()
4613 hostapd_drv_set_key(ifname_wds, hapd, WPA_ALG_WEP, NULL, i, in hostapd_set_wds_encryption()
4625 static void handle_assoc_cb(struct hostapd_data *hapd, in handle_assoc_cb() argument
4633 sta = ap_get_sta(hapd, mgmt->da); in handle_assoc_cb()
4645 hostapd_drv_sta_remove(hapd, sta->addr); in handle_assoc_cb()
4655 hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, in handle_assoc_cb()
4661 hostapd_drv_sta_remove(hapd, sta->addr); in handle_assoc_cb()
4671 accounting_sta_stop(hapd, sta); in handle_assoc_cb()
4673 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in handle_assoc_cb()
4682 if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa && in handle_assoc_cb()
4683 !hapd->conf->osen) || in handle_assoc_cb()
4692 ap_sta_set_authorized(hapd, sta, 1); in handle_assoc_cb()
4696 mlme_reassociate_indication(hapd, sta); in handle_assoc_cb()
4698 mlme_associate_indication(hapd, sta); in handle_assoc_cb()
4710 if (ap_sta_bind_vlan(hapd, sta) < 0) in handle_assoc_cb()
4714 if (ap_sta_bind_vlan(hapd, sta) < 0) in handle_assoc_cb()
4718 hostapd_set_sta_flags(hapd, sta); in handle_assoc_cb()
4735 ret = hostapd_set_wds_sta(hapd, ifname_wds, sta->addr, in handle_assoc_cb()
4738 hostapd_set_wds_encryption(hapd, sta, ifname_wds); in handle_assoc_cb()
4745 hapd->new_assoc_sta_cb(hapd, sta, !new_assoc); in handle_assoc_cb()
4754 ap_sta_disconnect(hapd, sta, sta->addr, in handle_assoc_cb()
4770 hapd, mgmt->da, in handle_assoc_cb()
4781 static void handle_deauth_cb(struct hostapd_data *hapd, in handle_deauth_cb() argument
4788 sta = ap_get_sta(hapd, mgmt->da); in handle_deauth_cb()
4801 ap_sta_deauth_cb(hapd, sta); in handle_deauth_cb()
4805 static void handle_disassoc_cb(struct hostapd_data *hapd, in handle_disassoc_cb() argument
4812 sta = ap_get_sta(hapd, mgmt->da); in handle_disassoc_cb()
4825 ap_sta_disassoc_cb(hapd, sta); in handle_disassoc_cb()
4829 static void handle_action_cb(struct hostapd_data *hapd, in handle_action_cb() argument
4851 hostapd_dpp_tx_status(hapd, mgmt->da, pos, end - pos, ok); in handle_action_cb()
4864 gas_query_ap_tx_status(hapd->gas, mgmt->da, pos, end - pos, ok); in handle_action_cb()
4868 sta = ap_get_sta(hapd, mgmt->da); in handle_action_cb()
4884 hostapd_rrm_beacon_req_tx_status(hapd, mgmt, len, ok); in handle_action_cb()
4897 void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len, in ieee802_11_mgmt_cb() argument
4904 if (hapd->ext_mgmt_frame_handling) { in ieee802_11_mgmt_cb()
4910 wpa_msg(hapd->msg_ctx, MSG_INFO, in ieee802_11_mgmt_cb()
4922 handle_auth_cb(hapd, mgmt, len, ok); in ieee802_11_mgmt_cb()
4926 handle_assoc_cb(hapd, mgmt, len, 0, ok); in ieee802_11_mgmt_cb()
4930 handle_assoc_cb(hapd, mgmt, len, 1, ok); in ieee802_11_mgmt_cb()
4937 handle_deauth_cb(hapd, mgmt, len, ok); in ieee802_11_mgmt_cb()
4941 handle_disassoc_cb(hapd, mgmt, len, ok); in ieee802_11_mgmt_cb()
4945 handle_action_cb(hapd, mgmt, len, ok); in ieee802_11_mgmt_cb()
4954 int ieee802_11_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) in ieee802_11_get_mib() argument
4961 int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, in ieee802_11_get_mib_sta() argument
4969 void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr, in hostapd_tx_status() argument
4973 struct hostapd_iface *iface = hapd->iface; in hostapd_tx_status()
4975 sta = ap_get_sta(hapd, addr); in hostapd_tx_status()
4979 hapd = iface->bss[j]; in hostapd_tx_status()
4980 sta = ap_get_sta(hapd, addr); in hostapd_tx_status()
4995 ieee802_1x_tx_status(hapd, sta, buf, len, ack); in hostapd_tx_status()
4999 void hostapd_eapol_tx_status(struct hostapd_data *hapd, const u8 *dst, in hostapd_eapol_tx_status() argument
5003 struct hostapd_iface *iface = hapd->iface; in hostapd_eapol_tx_status()
5005 sta = ap_get_sta(hapd, dst); in hostapd_eapol_tx_status()
5009 hapd = iface->bss[j]; in hostapd_eapol_tx_status()
5010 sta = ap_get_sta(hapd, dst); in hostapd_eapol_tx_status()
5022 ieee802_1x_eapol_tx_status(hapd, sta, data, len, ack); in hostapd_eapol_tx_status()
5026 void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr) in hostapd_client_poll_ok() argument
5029 struct hostapd_iface *iface = hapd->iface; in hostapd_client_poll_ok()
5031 sta = ap_get_sta(hapd, addr); in hostapd_client_poll_ok()
5035 hapd = iface->bss[j]; in hostapd_client_poll_ok()
5036 sta = ap_get_sta(hapd, addr); in hostapd_client_poll_ok()
5043 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POLL_OK MACSTR, in hostapd_client_poll_ok()
5054 void ieee802_11_rx_from_unknown(struct hostapd_data *hapd, const u8 *src, in ieee802_11_rx_from_unknown() argument
5059 sta = ap_get_sta(hapd, src); in ieee802_11_rx_from_unknown()
5063 if (!hapd->conf->wds_sta) in ieee802_11_rx_from_unknown()
5084 ret = hostapd_set_wds_sta(hapd, ifname_wds, in ieee802_11_rx_from_unknown()
5087 hostapd_set_wds_encryption(hapd, sta, in ieee802_11_rx_from_unknown()
5110 hapd, src, in ieee802_11_rx_from_unknown()
5114 hapd, src, in ieee802_11_rx_from_unknown()