Lines Matching refs:sta
44 struct sta_info *sta);
50 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta);
54 int (*cb)(struct hostapd_data *hapd, struct sta_info *sta, in ap_for_each_sta() argument
58 struct sta_info *sta; in ap_for_each_sta() local
60 for (sta = hapd->sta_list; sta; sta = sta->next) { in ap_for_each_sta()
61 if (cb(hapd, sta, ctx)) in ap_for_each_sta()
69 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta) in ap_get_sta() argument
73 s = hapd->sta_hash[STA_HASH(sta)]; in ap_get_sta()
74 while (s != NULL && os_memcmp(s->addr, sta, 6) != 0) in ap_get_sta()
83 struct sta_info *sta; in ap_get_sta_p2p() local
85 for (sta = hapd->sta_list; sta; sta = sta->next) { in ap_get_sta_p2p()
88 if (sta->p2p_ie == NULL) in ap_get_sta_p2p()
91 p2p_dev_addr = p2p_get_go_dev_addr(sta->p2p_ie); in ap_get_sta_p2p()
96 return sta; in ap_get_sta_p2p()
104 static void ap_sta_list_del(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_list_del() argument
108 if (hapd->sta_list == sta) { in ap_sta_list_del()
109 hapd->sta_list = sta->next; in ap_sta_list_del()
114 while (tmp != NULL && tmp->next != sta) in ap_sta_list_del()
118 "list.", MAC2STR(sta->addr)); in ap_sta_list_del()
120 tmp->next = sta->next; in ap_sta_list_del()
124 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_hash_add() argument
126 sta->hnext = hapd->sta_hash[STA_HASH(sta->addr)]; in ap_sta_hash_add()
127 hapd->sta_hash[STA_HASH(sta->addr)] = sta; in ap_sta_hash_add()
131 static void ap_sta_hash_del(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_hash_del() argument
135 s = hapd->sta_hash[STA_HASH(sta->addr)]; in ap_sta_hash_del()
137 if (os_memcmp(s->addr, sta->addr, 6) == 0) { in ap_sta_hash_del()
138 hapd->sta_hash[STA_HASH(sta->addr)] = s->hnext; in ap_sta_hash_del()
143 os_memcmp(s->hnext->addr, sta->addr, ETH_ALEN) != 0) in ap_sta_hash_del()
149 " from hash table", MAC2STR(sta->addr)); in ap_sta_hash_del()
153 void ap_sta_ip6addr_del(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_ip6addr_del() argument
155 sta_ip6addr_del(hapd, sta); in ap_sta_ip6addr_del()
159 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta) in ap_free_sta() argument
163 accounting_sta_stop(hapd, sta); in ap_free_sta()
166 ap_sta_set_authorized(hapd, sta, 0); in ap_free_sta()
167 hostapd_set_sta_flags(hapd, sta); in ap_free_sta()
169 if (sta->flags & (WLAN_STA_WDS | WLAN_STA_MULTI_AP)) in ap_free_sta()
170 hostapd_set_wds_sta(hapd, NULL, sta->addr, sta->aid, 0); in ap_free_sta()
172 if (sta->ipaddr) in ap_free_sta()
173 hostapd_drv_br_delete_ip_neigh(hapd, 4, (u8 *) &sta->ipaddr); in ap_free_sta()
174 ap_sta_ip6addr_del(hapd, sta); in ap_free_sta()
177 !(sta->flags & WLAN_STA_PREAUTH)) { in ap_free_sta()
178 hostapd_drv_sta_remove(hapd, sta->addr); in ap_free_sta()
179 sta->added_unassoc = 0; in ap_free_sta()
182 ap_sta_hash_del(hapd, sta); in ap_free_sta()
183 ap_sta_list_del(hapd, sta); in ap_free_sta()
185 if (sta->aid > 0) in ap_free_sta()
186 hapd->sta_aid[(sta->aid - 1) / 32] &= in ap_free_sta()
187 ~BIT((sta->aid - 1) % 32); in ap_free_sta()
190 if (sta->nonerp_set) { in ap_free_sta()
191 sta->nonerp_set = 0; in ap_free_sta()
197 if (sta->no_short_slot_time_set) { in ap_free_sta()
198 sta->no_short_slot_time_set = 0; in ap_free_sta()
206 if (sta->no_short_preamble_set) { in ap_free_sta()
207 sta->no_short_preamble_set = 0; in ap_free_sta()
215 if (sta->no_ht_gf_set) { in ap_free_sta()
216 sta->no_ht_gf_set = 0; in ap_free_sta()
220 if (sta->no_ht_set) { in ap_free_sta()
221 sta->no_ht_set = 0; in ap_free_sta()
225 if (sta->ht_20mhz_set) { in ap_free_sta()
226 sta->ht_20mhz_set = 0; in ap_free_sta()
231 wpabuf_free(sta->probe_ie_taxonomy); in ap_free_sta()
232 sta->probe_ie_taxonomy = NULL; in ap_free_sta()
233 wpabuf_free(sta->assoc_ie_taxonomy); in ap_free_sta()
234 sta->assoc_ie_taxonomy = NULL; in ap_free_sta()
237 ht40_intolerant_remove(hapd->iface, sta); in ap_free_sta()
240 if (sta->no_p2p_set) { in ap_free_sta()
241 sta->no_p2p_set = 0; in ap_free_sta()
255 hapd->mesh_sta_free_cb(hapd, sta); in ap_free_sta()
262 __func__, MAC2STR(sta->addr)); in ap_free_sta()
263 eloop_cancel_timeout(ap_handle_timer, hapd, sta); in ap_free_sta()
264 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta); in ap_free_sta()
265 eloop_cancel_timeout(ap_handle_session_warning_timer, hapd, sta); in ap_free_sta()
266 ap_sta_clear_disconnect_timeouts(hapd, sta); in ap_free_sta()
267 sae_clear_retransmit_timer(hapd, sta); in ap_free_sta()
269 ieee802_1x_free_station(hapd, sta); in ap_free_sta()
270 wpa_auth_sta_deinit(sta->wpa_sm); in ap_free_sta()
271 rsn_preauth_free_station(hapd, sta); in ap_free_sta()
274 radius_client_flush_auth(hapd->radius, sta->addr); in ap_free_sta()
283 if (sta->vlan_id) in ap_free_sta()
284 vlan_remove_dynamic(hapd, sta->vlan_id); in ap_free_sta()
285 if (sta->vlan_id_bound) { in ap_free_sta()
291 !(sta->flags & WLAN_STA_PREAUTH)) { in ap_free_sta()
292 hostapd_drv_sta_remove(hapd, sta->addr); in ap_free_sta()
293 sta->added_unassoc = 0; in ap_free_sta()
295 vlan_remove_dynamic(hapd, sta->vlan_id_bound); in ap_free_sta()
299 os_free(sta->challenge); in ap_free_sta()
301 os_free(sta->sa_query_trans_id); in ap_free_sta()
302 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta); in ap_free_sta()
305 p2p_group_notif_disassoc(hapd->p2p_group, sta->addr); in ap_free_sta()
309 if (sta->gas_dialog) { in ap_free_sta()
312 gas_serv_dialog_clear(&sta->gas_dialog[i]); in ap_free_sta()
313 os_free(sta->gas_dialog); in ap_free_sta()
317 wpabuf_free(sta->wps_ie); in ap_free_sta()
318 wpabuf_free(sta->p2p_ie); in ap_free_sta()
319 wpabuf_free(sta->hs20_ie); in ap_free_sta()
320 wpabuf_free(sta->roaming_consortium); in ap_free_sta()
322 wpabuf_free(sta->mb_ies); in ap_free_sta()
325 os_free(sta->ht_capabilities); in ap_free_sta()
326 os_free(sta->vht_capabilities); in ap_free_sta()
327 os_free(sta->vht_operation); in ap_free_sta()
328 os_free(sta->he_capab); in ap_free_sta()
329 os_free(sta->he_6ghz_capab); in ap_free_sta()
330 hostapd_free_psk_list(sta->psk); in ap_free_sta()
331 os_free(sta->identity); in ap_free_sta()
332 os_free(sta->radius_cui); in ap_free_sta()
333 os_free(sta->remediation_url); in ap_free_sta()
334 os_free(sta->t_c_url); in ap_free_sta()
335 wpabuf_free(sta->hs20_deauth_req); in ap_free_sta()
336 os_free(sta->hs20_session_info_url); in ap_free_sta()
339 sae_clear_data(sta->sae); in ap_free_sta()
340 os_free(sta->sae); in ap_free_sta()
343 mbo_ap_sta_free(sta); in ap_free_sta()
344 os_free(sta->supp_op_classes); in ap_free_sta()
347 os_free(sta->fils_pending_assoc_req); in ap_free_sta()
348 wpabuf_free(sta->fils_hlp_resp); in ap_free_sta()
349 wpabuf_free(sta->hlp_dhcp_discover); in ap_free_sta()
350 eloop_cancel_timeout(fils_hlp_timeout, hapd, sta); in ap_free_sta()
352 crypto_ecdh_deinit(sta->fils_ecdh); in ap_free_sta()
353 wpabuf_clear_free(sta->fils_dh_ss); in ap_free_sta()
354 wpabuf_free(sta->fils_g_sta); in ap_free_sta()
359 bin_clear_free(sta->owe_pmk, sta->owe_pmk_len); in ap_free_sta()
360 crypto_ecdh_deinit(sta->owe_ecdh); in ap_free_sta()
364 dpp_pfs_free(sta->dpp_pfs); in ap_free_sta()
365 sta->dpp_pfs = NULL; in ap_free_sta()
368 os_free(sta->ext_capability); in ap_free_sta()
371 eloop_cancel_timeout(ap_sta_reset_steer_flag_timer, hapd, sta); in ap_free_sta()
374 os_free(sta->ifname_wds); in ap_free_sta()
377 os_free(sta->sae_postponed_commit); in ap_free_sta()
380 os_free(sta); in ap_free_sta()
386 struct sta_info *sta, *prev; in hostapd_free_stas() local
388 sta = hapd->sta_list; in hostapd_free_stas()
390 while (sta) { in hostapd_free_stas()
391 prev = sta; in hostapd_free_stas()
392 if (sta->flags & WLAN_STA_AUTH) { in hostapd_free_stas()
394 hapd, sta, WLAN_REASON_UNSPECIFIED); in hostapd_free_stas()
396 sta = sta->next; in hostapd_free_stas()
415 struct sta_info *sta = timeout_ctx; in ap_handle_timer() local
420 hapd->conf->iface, __func__, MAC2STR(sta->addr), sta->flags, in ap_handle_timer()
421 sta->timeout_next); in ap_handle_timer()
422 if (sta->timeout_next == STA_REMOVE) { in ap_handle_timer()
423 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_handle_timer()
426 ap_free_sta(hapd, sta); in ap_handle_timer()
430 if ((sta->flags & WLAN_STA_ASSOC) && in ap_handle_timer()
431 (sta->timeout_next == STA_NULLFUNC || in ap_handle_timer()
432 sta->timeout_next == STA_DISASSOC)) { in ap_handle_timer()
440 inactive_sec = hostapd_drv_get_inact_sec(hapd, sta->addr); in ap_handle_timer()
445 MACSTR, MAC2STR(sta->addr)); in ap_handle_timer()
455 MAC2STR(sta->addr)); in ap_handle_timer()
458 sta->timeout_next = STA_DISASSOC; in ap_handle_timer()
464 MAC2STR(sta->addr), inactive_sec); in ap_handle_timer()
465 sta->timeout_next = STA_NULLFUNC; in ap_handle_timer()
472 MAC2STR(sta->addr), inactive_sec, in ap_handle_timer()
476 sta->timeout_next = STA_DISASSOC; in ap_handle_timer()
480 if ((sta->flags & WLAN_STA_ASSOC) && in ap_handle_timer()
481 sta->timeout_next == STA_DISASSOC && in ap_handle_timer()
482 !(sta->flags & WLAN_STA_PENDING_POLL) && in ap_handle_timer()
485 " has ACKed data poll", MAC2STR(sta->addr)); in ap_handle_timer()
488 sta->timeout_next = STA_NULLFUNC; in ap_handle_timer()
496 __func__, MAC2STR(sta->addr), next_time); in ap_handle_timer()
498 sta); in ap_handle_timer()
502 if (sta->timeout_next == STA_NULLFUNC && in ap_handle_timer()
503 (sta->flags & WLAN_STA_ASSOC)) { in ap_handle_timer()
505 sta->flags |= WLAN_STA_PENDING_POLL; in ap_handle_timer()
506 hostapd_drv_poll_client(hapd, hapd->own_addr, sta->addr, in ap_handle_timer()
507 sta->flags & WLAN_STA_WMM); in ap_handle_timer()
508 } else if (sta->timeout_next != STA_REMOVE) { in ap_handle_timer()
509 int deauth = sta->timeout_next == STA_DEAUTH; in ap_handle_timer()
511 if (!deauth && !(sta->flags & WLAN_STA_ASSOC)) { in ap_handle_timer()
514 sta->timeout_next = STA_DEAUTH; in ap_handle_timer()
521 MAC2STR(sta->addr)); in ap_handle_timer()
525 hapd, sta->addr, in ap_handle_timer()
528 reason = (sta->timeout_next == STA_DISASSOC) ? in ap_handle_timer()
532 hostapd_drv_sta_disassoc(hapd, sta->addr, reason); in ap_handle_timer()
536 switch (sta->timeout_next) { in ap_handle_timer()
538 sta->timeout_next = STA_DISASSOC; in ap_handle_timer()
541 __func__, MAC2STR(sta->addr), AP_DISASSOC_DELAY); in ap_handle_timer()
543 hapd, sta); in ap_handle_timer()
547 ap_sta_set_authorized(hapd, sta, 0); in ap_handle_timer()
548 sta->flags &= ~WLAN_STA_ASSOC; in ap_handle_timer()
549 hostapd_set_sta_flags(hapd, sta); in ap_handle_timer()
550 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0); in ap_handle_timer()
551 if (!sta->acct_terminate_cause) in ap_handle_timer()
552 sta->acct_terminate_cause = in ap_handle_timer()
554 accounting_sta_stop(hapd, sta); in ap_handle_timer()
555 ieee802_1x_free_station(hapd, sta); in ap_handle_timer()
556 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_handle_timer()
559 reason = (sta->timeout_next == STA_DISASSOC) ? in ap_handle_timer()
562 sta->timeout_next = STA_DEAUTH; in ap_handle_timer()
565 __func__, MAC2STR(sta->addr), AP_DEAUTH_DELAY); in ap_handle_timer()
567 hapd, sta); in ap_handle_timer()
568 mlme_disassociate_indication(hapd, sta, reason); in ap_handle_timer()
572 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_handle_timer()
575 if (!sta->acct_terminate_cause) in ap_handle_timer()
576 sta->acct_terminate_cause = in ap_handle_timer()
579 hapd, sta, in ap_handle_timer()
581 ap_free_sta(hapd, sta); in ap_handle_timer()
590 struct sta_info *sta = timeout_ctx; in ap_handle_session_timer() local
593 hapd->conf->iface, MAC2STR(sta->addr)); in ap_handle_session_timer()
594 if (!(sta->flags & (WLAN_STA_AUTH | WLAN_STA_ASSOC | in ap_handle_session_timer()
596 if (sta->flags & WLAN_STA_GAS) { in ap_handle_session_timer()
598 "entry " MACSTR, MAC2STR(sta->addr)); in ap_handle_session_timer()
599 ap_free_sta(hapd, sta); in ap_handle_session_timer()
604 hostapd_drv_sta_deauth(hapd, sta->addr, in ap_handle_session_timer()
606 mlme_deauthenticate_indication(hapd, sta, in ap_handle_session_timer()
608 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_handle_session_timer()
611 sta->acct_terminate_cause = in ap_handle_session_timer()
613 ap_free_sta(hapd, sta); in ap_handle_session_timer()
617 void ap_sta_replenish_timeout(struct hostapd_data *hapd, struct sta_info *sta, in ap_sta_replenish_timeout() argument
621 ap_handle_session_timer, hapd, sta) == 1) { in ap_sta_replenish_timeout()
622 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_sta_replenish_timeout()
629 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta, in ap_sta_session_timeout() argument
632 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_sta_session_timeout()
635 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta); in ap_sta_session_timeout()
637 hapd, sta); in ap_sta_session_timeout()
641 void ap_sta_no_session_timeout(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_no_session_timeout() argument
643 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta); in ap_sta_no_session_timeout()
651 struct sta_info *sta = timeout_ctx; in ap_handle_session_warning_timer() local
654 MACSTR, hapd->conf->iface, MAC2STR(sta->addr)); in ap_handle_session_warning_timer()
655 if (sta->hs20_session_info_url == NULL) in ap_handle_session_warning_timer()
658 wnm_send_ess_disassoc_imminent(hapd, sta, sta->hs20_session_info_url, in ap_handle_session_warning_timer()
659 sta->hs20_disassoc_timer); in ap_handle_session_warning_timer()
665 struct sta_info *sta, int warning_time) in ap_sta_session_warning_timeout() argument
667 eloop_cancel_timeout(ap_handle_session_warning_timer, hapd, sta); in ap_sta_session_warning_timeout()
669 hapd, sta); in ap_sta_session_warning_timeout()
675 struct sta_info *sta; in ap_sta_add() local
678 sta = ap_get_sta(hapd, addr); in ap_sta_add()
679 if (sta) in ap_sta_add()
680 return sta; in ap_sta_add()
690 sta = os_zalloc(sizeof(struct sta_info)); in ap_sta_add()
691 if (sta == NULL) { in ap_sta_add()
695 sta->acct_interim_interval = hapd->conf->acct_interim_interval; in ap_sta_add()
696 if (accounting_sta_get_id(hapd, sta) < 0) { in ap_sta_add()
697 os_free(sta); in ap_sta_add()
706 sta->supported_rates[i] = hapd->iface->basic_rates[i] / 5; in ap_sta_add()
708 sta->supported_rates_len = i; in ap_sta_add()
716 ap_handle_timer, hapd, sta); in ap_sta_add()
720 os_memcpy(sta->addr, addr, ETH_ALEN); in ap_sta_add()
721 sta->next = hapd->sta_list; in ap_sta_add()
722 hapd->sta_list = sta; in ap_sta_add()
724 ap_sta_hash_add(hapd, sta); in ap_sta_add()
725 ap_sta_remove_in_other_bss(hapd, sta); in ap_sta_add()
726 sta->last_seq_ctrl = WLAN_INVALID_MGMT_SEQ; in ap_sta_add()
727 dl_list_init(&sta->ip6addr); in ap_sta_add()
731 &sta->probe_ie_taxonomy); in ap_sta_add()
734 return sta; in ap_sta_add()
738 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_remove() argument
740 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0); in ap_sta_remove()
742 if (sta->ipaddr) in ap_sta_remove()
743 hostapd_drv_br_delete_ip_neigh(hapd, 4, (u8 *) &sta->ipaddr); in ap_sta_remove()
744 ap_sta_ip6addr_del(hapd, sta); in ap_sta_remove()
747 hapd->conf->iface, MAC2STR(sta->addr)); in ap_sta_remove()
748 if (hostapd_drv_sta_remove(hapd, sta->addr) && in ap_sta_remove()
749 sta->flags & WLAN_STA_ASSOC) { in ap_sta_remove()
752 hapd->conf->iface, MAC2STR(sta->addr)); in ap_sta_remove()
755 sta->added_unassoc = 0; in ap_sta_remove()
761 struct sta_info *sta) in ap_sta_remove_in_other_bss() argument
775 sta2 = ap_get_sta(bss, sta->addr); in ap_sta_remove_in_other_bss()
792 struct sta_info *sta = timeout_ctx; in ap_sta_disassoc_cb_timeout() local
795 hapd->conf->iface, MAC2STR(sta->addr)); in ap_sta_disassoc_cb_timeout()
796 ap_sta_remove(hapd, sta); in ap_sta_disassoc_cb_timeout()
797 mlme_disassociate_indication(hapd, sta, sta->disassoc_reason); in ap_sta_disassoc_cb_timeout()
801 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta, in ap_sta_disassociate() argument
805 hapd->conf->iface, MAC2STR(sta->addr)); in ap_sta_disassociate()
806 sta->last_seq_ctrl = WLAN_INVALID_MGMT_SEQ; in ap_sta_disassociate()
810 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC | in ap_sta_disassociate()
812 sta->timeout_next = STA_REMOVE; in ap_sta_disassociate()
814 sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_ASSOC_REQ_OK); in ap_sta_disassociate()
815 sta->timeout_next = STA_DEAUTH; in ap_sta_disassociate()
817 ap_sta_set_authorized(hapd, sta, 0); in ap_sta_disassociate()
818 hostapd_set_sta_flags(hapd, sta); in ap_sta_disassociate()
822 __func__, MAC2STR(sta->addr), in ap_sta_disassociate()
824 eloop_cancel_timeout(ap_handle_timer, hapd, sta); in ap_sta_disassociate()
826 ap_handle_timer, hapd, sta); in ap_sta_disassociate()
827 accounting_sta_stop(hapd, sta); in ap_sta_disassociate()
828 ieee802_1x_free_station(hapd, sta); in ap_sta_disassociate()
829 wpa_auth_sta_deinit(sta->wpa_sm); in ap_sta_disassociate()
830 sta->wpa_sm = NULL; in ap_sta_disassociate()
832 sta->disassoc_reason = reason; in ap_sta_disassociate()
833 sta->flags |= WLAN_STA_PENDING_DISASSOC_CB; in ap_sta_disassociate()
834 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta); in ap_sta_disassociate()
837 ap_sta_disassoc_cb_timeout, hapd, sta); in ap_sta_disassociate()
844 struct sta_info *sta = timeout_ctx; in ap_sta_deauth_cb_timeout() local
847 hapd->conf->iface, MAC2STR(sta->addr)); in ap_sta_deauth_cb_timeout()
848 ap_sta_remove(hapd, sta); in ap_sta_deauth_cb_timeout()
849 mlme_deauthenticate_indication(hapd, sta, sta->deauth_reason); in ap_sta_deauth_cb_timeout()
853 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta, in ap_sta_deauthenticate() argument
860 ap_sta_disassociate(hapd, sta, reason); in ap_sta_deauthenticate()
865 hapd->conf->iface, MAC2STR(sta->addr)); in ap_sta_deauthenticate()
866 sta->last_seq_ctrl = WLAN_INVALID_MGMT_SEQ; in ap_sta_deauthenticate()
867 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_ASSOC_REQ_OK); in ap_sta_deauthenticate()
868 ap_sta_set_authorized(hapd, sta, 0); in ap_sta_deauthenticate()
869 hostapd_set_sta_flags(hapd, sta); in ap_sta_deauthenticate()
870 sta->timeout_next = STA_REMOVE; in ap_sta_deauthenticate()
874 __func__, MAC2STR(sta->addr), in ap_sta_deauthenticate()
876 eloop_cancel_timeout(ap_handle_timer, hapd, sta); in ap_sta_deauthenticate()
878 ap_handle_timer, hapd, sta); in ap_sta_deauthenticate()
879 accounting_sta_stop(hapd, sta); in ap_sta_deauthenticate()
880 ieee802_1x_free_station(hapd, sta); in ap_sta_deauthenticate()
882 sta->deauth_reason = reason; in ap_sta_deauthenticate()
883 sta->flags |= WLAN_STA_PENDING_DEAUTH_CB; in ap_sta_deauthenticate()
884 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta); in ap_sta_deauthenticate()
887 ap_sta_deauth_cb_timeout, hapd, sta); in ap_sta_deauthenticate()
893 struct sta_info *sta, void *ctx) in ap_sta_wps_cancel() argument
895 if (sta && (sta->flags & WLAN_STA_WPS)) { in ap_sta_wps_cancel()
896 ap_sta_deauthenticate(hapd, sta, in ap_sta_wps_cancel()
899 __func__, MAC2STR(sta->addr)); in ap_sta_wps_cancel()
924 int ap_sta_set_vlan(struct hostapd_data *hapd, struct sta_info *sta, in ap_sta_set_vlan() argument
931 if (hapd->conf->ssid.per_sta_vif && !sta->vlan_id) { in ap_sta_set_vlan()
934 !hapd->conf->ssid.per_sta_vif && sta->vlan_id) { in ap_sta_set_vlan()
936 } else if (!vlan_compare(vlan_desc, sta->vlan_desc)) { in ap_sta_set_vlan()
951 hostapd_logger(hapd, sta->addr, in ap_sta_set_vlan()
976 hostapd_logger(hapd, sta->addr, in ap_sta_set_vlan()
991 hostapd_logger(hapd, sta->addr, in ap_sta_set_vlan()
1003 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_sta_set_vlan()
1009 hostapd_logger(hapd, sta->addr, in ap_sta_set_vlan()
1016 old_vlan_id = sta->vlan_id; in ap_sta_set_vlan()
1017 sta->vlan_id = vlan_id; in ap_sta_set_vlan()
1018 sta->vlan_desc = vlan ? &vlan->vlan_desc : NULL; in ap_sta_set_vlan()
1027 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_bind_vlan() argument
1033 int old_vlanid = sta->vlan_id_bound; in ap_sta_bind_vlan()
1035 if ((sta->flags & WLAN_STA_WDS) && sta->vlan_id == 0) { in ap_sta_bind_vlan()
1038 MACSTR, MAC2STR(sta->addr)); in ap_sta_bind_vlan()
1046 if (sta->vlan_id > 0) { in ap_sta_bind_vlan()
1048 if (vlan->vlan_id == sta->vlan_id) in ap_sta_bind_vlan()
1060 if (sta->vlan_id == old_vlanid) in ap_sta_bind_vlan()
1063 if (sta->vlan_id > 0 && !vlan && in ap_sta_bind_vlan()
1065 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_sta_bind_vlan()
1068 sta->vlan_id); in ap_sta_bind_vlan()
1073 hostapd_logger(hapd, sta->addr, in ap_sta_bind_vlan()
1081 sta->vlan_id_bound = sta->vlan_id; in ap_sta_bind_vlan()
1084 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_sta_bind_vlan()
1088 if (wpa_auth_sta_set_vlan(sta->wpa_sm, sta->vlan_id) < 0) in ap_sta_bind_vlan()
1091 ret = hostapd_drv_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id); in ap_sta_bind_vlan()
1093 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_sta_bind_vlan()
1095 "entry to vlan_id=%d", sta->vlan_id); in ap_sta_bind_vlan()
1099 if (old_vlanid > 0 && old_vlanid != sta->vlan_id) in ap_sta_bind_vlan()
1110 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta) in ap_check_sa_query_timeout() argument
1115 os_reltime_sub(&now, &sta->sa_query_start, &passed); in ap_check_sa_query_timeout()
1118 hostapd_logger(hapd, sta->addr, in ap_check_sa_query_timeout()
1122 sta->sa_query_timed_out = 1; in ap_check_sa_query_timeout()
1123 os_free(sta->sa_query_trans_id); in ap_check_sa_query_timeout()
1124 sta->sa_query_trans_id = NULL; in ap_check_sa_query_timeout()
1125 sta->sa_query_count = 0; in ap_check_sa_query_timeout()
1126 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta); in ap_check_sa_query_timeout()
1137 struct sta_info *sta = timeout_ctx; in ap_sa_query_timer() local
1143 hapd->conf->iface, MAC2STR(sta->addr), sta->sa_query_count); in ap_sa_query_timer()
1145 if (sta->sa_query_count > 0 && in ap_sa_query_timer()
1146 ap_check_sa_query_timeout(hapd, sta)) in ap_sa_query_timer()
1148 if (sta->sa_query_count >= 1000) in ap_sa_query_timer()
1151 nbuf = os_realloc_array(sta->sa_query_trans_id, in ap_sa_query_timer()
1152 sta->sa_query_count + 1, in ap_sa_query_timer()
1156 if (sta->sa_query_count == 0) { in ap_sa_query_timer()
1158 os_get_reltime(&sta->sa_query_start); in ap_sa_query_timer()
1160 trans_id = nbuf + sta->sa_query_count * WLAN_SA_QUERY_TR_ID_LEN; in ap_sa_query_timer()
1161 sta->sa_query_trans_id = nbuf; in ap_sa_query_timer()
1162 sta->sa_query_count++; in ap_sa_query_timer()
1177 eloop_register_timeout(sec, usec, ap_sa_query_timer, hapd, sta); in ap_sa_query_timer()
1179 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, in ap_sa_query_timer()
1181 "association SA Query attempt %d", sta->sa_query_count); in ap_sa_query_timer()
1183 ieee802_11_send_sa_query_req(hapd, sta->addr, trans_id); in ap_sa_query_timer()
1187 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_start_sa_query() argument
1189 ap_sa_query_timer(hapd, sta); in ap_sta_start_sa_query()
1193 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_stop_sa_query() argument
1195 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta); in ap_sta_stop_sa_query()
1196 os_free(sta->sa_query_trans_id); in ap_sta_stop_sa_query()
1197 sta->sa_query_trans_id = NULL; in ap_sta_stop_sa_query()
1198 sta->sa_query_count = 0; in ap_sta_stop_sa_query()
1203 struct sta_info *sta) in ap_sta_wpa_get_keyid() argument
1212 pmk = wpa_auth_get_pmk(sta->wpa_sm, &pmk_len); in ap_sta_wpa_get_keyid()
1228 void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta, in ap_sta_set_authorized() argument
1238 if (!!authorized == !!(sta->flags & WLAN_STA_AUTHORIZED)) in ap_sta_set_authorized()
1242 sta->flags |= WLAN_STA_AUTHORIZED; in ap_sta_set_authorized()
1244 sta->flags &= ~WLAN_STA_AUTHORIZED; in ap_sta_set_authorized()
1248 if (sta->p2p_ie != NULL && in ap_sta_set_authorized()
1249 p2p_parse_dev_addr_in_p2p_ie(sta->p2p_ie, addr) == 0) in ap_sta_set_authorized()
1252 dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr); in ap_sta_set_authorized()
1256 MAC2STR(sta->addr), MAC2STR(dev_addr)); in ap_sta_set_authorized()
1259 os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr)); in ap_sta_set_authorized()
1263 sta->addr, authorized, dev_addr); in ap_sta_set_authorized()
1273 if (wpa_auth_get_ip_addr(sta->wpa_sm, ip_addr_buf) == 0) { in ap_sta_set_authorized()
1281 keyid = ap_sta_wpa_get_keyid(hapd, sta); in ap_sta_set_authorized()
1307 fst_notify_peer_connected(hapd->iface->fst, sta->addr); in ap_sta_set_authorized()
1310 sta->addr); in ap_sta_set_authorized()
1316 void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta, in ap_sta_disconnect() argument
1319 if (sta) in ap_sta_disconnect()
1321 hapd->conf->iface, __func__, MAC2STR(sta->addr), in ap_sta_disconnect()
1328 if (sta == NULL && addr) in ap_sta_disconnect()
1329 sta = ap_get_sta(hapd, addr); in ap_sta_disconnect()
1334 if (sta == NULL) in ap_sta_disconnect()
1336 ap_sta_set_authorized(hapd, sta, 0); in ap_sta_disconnect()
1337 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC); in ap_sta_disconnect()
1338 hostapd_set_sta_flags(hapd, sta); in ap_sta_disconnect()
1339 wpa_auth_sm_event(sta->wpa_sm, WPA_DEAUTH); in ap_sta_disconnect()
1340 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0); in ap_sta_disconnect()
1344 hapd->conf->iface, __func__, MAC2STR(sta->addr), in ap_sta_disconnect()
1346 eloop_cancel_timeout(ap_handle_timer, hapd, sta); in ap_sta_disconnect()
1348 ap_handle_timer, hapd, sta); in ap_sta_disconnect()
1349 sta->timeout_next = STA_REMOVE; in ap_sta_disconnect()
1355 sta->disassoc_reason = reason; in ap_sta_disconnect()
1356 sta->flags |= WLAN_STA_PENDING_DISASSOC_CB; in ap_sta_disconnect()
1357 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta); in ap_sta_disconnect()
1361 hapd, sta); in ap_sta_disconnect()
1365 sta->deauth_reason = reason; in ap_sta_disconnect()
1366 sta->flags |= WLAN_STA_PENDING_DEAUTH_CB; in ap_sta_disconnect()
1367 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta); in ap_sta_disconnect()
1370 ap_sta_deauth_cb_timeout, hapd, sta); in ap_sta_disconnect()
1374 void ap_sta_deauth_cb(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_deauth_cb() argument
1376 if (!(sta->flags & WLAN_STA_PENDING_DEAUTH_CB)) { in ap_sta_deauth_cb()
1380 sta->flags &= ~WLAN_STA_PENDING_DEAUTH_CB; in ap_sta_deauth_cb()
1381 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta); in ap_sta_deauth_cb()
1382 ap_sta_deauth_cb_timeout(hapd, sta); in ap_sta_deauth_cb()
1386 void ap_sta_disassoc_cb(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_disassoc_cb() argument
1388 if (!(sta->flags & WLAN_STA_PENDING_DISASSOC_CB)) { in ap_sta_disassoc_cb()
1392 sta->flags &= ~WLAN_STA_PENDING_DISASSOC_CB; in ap_sta_disassoc_cb()
1393 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta); in ap_sta_disassoc_cb()
1394 ap_sta_disassoc_cb_timeout(hapd, sta); in ap_sta_disassoc_cb()
1399 struct sta_info *sta) in ap_sta_clear_disconnect_timeouts() argument
1401 if (eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta) > 0) in ap_sta_clear_disconnect_timeouts()
1405 hapd->conf->iface, MAC2STR(sta->addr)); in ap_sta_clear_disconnect_timeouts()
1406 if (eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta) > 0) in ap_sta_clear_disconnect_timeouts()
1410 hapd->conf->iface, MAC2STR(sta->addr)); in ap_sta_clear_disconnect_timeouts()
1411 if (eloop_cancel_timeout(ap_sta_delayed_1x_auth_fail_cb, hapd, sta) > 0) in ap_sta_clear_disconnect_timeouts()
1416 hapd->conf->iface, MAC2STR(sta->addr)); in ap_sta_clear_disconnect_timeouts()
1417 if (sta->flags & WLAN_STA_WPS) in ap_sta_clear_disconnect_timeouts()
1463 struct sta_info *sta = timeout_ctx; in ap_sta_delayed_1x_auth_fail_cb() local
1468 " after EAP-Failure", MAC2STR(sta->addr)); in ap_sta_delayed_1x_auth_fail_cb()
1470 reason = sta->disconnect_reason_code; in ap_sta_delayed_1x_auth_fail_cb()
1473 ap_sta_disconnect(hapd, sta, sta->addr, reason); in ap_sta_delayed_1x_auth_fail_cb()
1474 if (sta->flags & WLAN_STA_WPS) in ap_sta_delayed_1x_auth_fail_cb()
1480 struct sta_info *sta) in ap_sta_delayed_1x_auth_fail_disconnect() argument
1484 " after EAP-Failure in 10 ms", MAC2STR(sta->addr)); in ap_sta_delayed_1x_auth_fail_disconnect()
1491 eloop_cancel_timeout(ap_sta_delayed_1x_auth_fail_cb, hapd, sta); in ap_sta_delayed_1x_auth_fail_disconnect()
1493 hapd, sta); in ap_sta_delayed_1x_auth_fail_disconnect()
1498 struct sta_info *sta) in ap_sta_pending_delayed_1x_auth_fail_disconnect() argument
1501 hapd, sta); in ap_sta_pending_delayed_1x_auth_fail_disconnect()
1505 int ap_sta_re_add(struct hostapd_data *hapd, struct sta_info *sta) in ap_sta_re_add() argument
1514 ap_sta_set_authorized(hapd, sta, 0); in ap_sta_re_add()
1515 hostapd_drv_sta_remove(hapd, sta->addr); in ap_sta_re_add()
1516 sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_AUTH | WLAN_STA_AUTHORIZED); in ap_sta_re_add()
1518 if (hostapd_sta_add(hapd, sta->addr, 0, 0, in ap_sta_re_add()
1519 sta->supported_rates, in ap_sta_re_add()
1520 sta->supported_rates_len, in ap_sta_re_add()
1522 sta->flags, 0, 0, 0, 0)) { in ap_sta_re_add()
1523 hostapd_logger(hapd, sta->addr, in ap_sta_re_add()
1530 sta->added_unassoc = 1; in ap_sta_re_add()