2 * hostapd / Station table
3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #include "utils/includes.h"
17 #include "utils/common.h"
18 #include "utils/eloop.h"
19 #include "common/ieee802_11_defs.h"
20 #include "radius/radius.h"
21 #include "radius/radius_client.h"
22 #include "drivers/driver.h"
25 #include "accounting.h"
26 #include "ieee802_1x.h"
27 #include "ieee802_11.h"
29 #include "preauth_auth.h"
30 #include "ap_config.h"
33 #include "vlan_init.h"
34 #include "p2p_hostapd.h"
37 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
38 struct sta_info *sta);
39 static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx);
40 #ifdef CONFIG_IEEE80211W
41 static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx);
42 #endif /* CONFIG_IEEE80211W */
44 int ap_for_each_sta(struct hostapd_data *hapd,
45 int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
51 for (sta = hapd->sta_list; sta; sta = sta->next) {
52 if (cb(hapd, sta, ctx))
60 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta)
64 s = hapd->sta_hash[STA_HASH(sta)];
65 while (s != NULL && os_memcmp(s->addr, sta, 6) != 0)
71 static void ap_sta_list_del(struct hostapd_data *hapd, struct sta_info *sta)
75 if (hapd->sta_list == sta) {
76 hapd->sta_list = sta->next;
81 while (tmp != NULL && tmp->next != sta)
84 wpa_printf(MSG_DEBUG, "Could not remove STA " MACSTR " from "
85 "list.", MAC2STR(sta->addr));
87 tmp->next = sta->next;
91 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta)
93 sta->hnext = hapd->sta_hash[STA_HASH(sta->addr)];
94 hapd->sta_hash[STA_HASH(sta->addr)] = sta;
98 static void ap_sta_hash_del(struct hostapd_data *hapd, struct sta_info *sta)
102 s = hapd->sta_hash[STA_HASH(sta->addr)];
103 if (s == NULL) return;
104 if (os_memcmp(s->addr, sta->addr, 6) == 0) {
105 hapd->sta_hash[STA_HASH(sta->addr)] = s->hnext;
109 while (s->hnext != NULL &&
110 os_memcmp(s->hnext->addr, sta->addr, ETH_ALEN) != 0)
112 if (s->hnext != NULL)
113 s->hnext = s->hnext->hnext;
115 wpa_printf(MSG_DEBUG, "AP: could not remove STA " MACSTR
116 " from hash table", MAC2STR(sta->addr));
120 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
124 accounting_sta_stop(hapd, sta);
126 if (sta->flags & WLAN_STA_WDS)
127 hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
129 if (!(sta->flags & WLAN_STA_PREAUTH))
130 hapd->drv.sta_remove(hapd, sta->addr);
132 ap_sta_hash_del(hapd, sta);
133 ap_sta_list_del(hapd, sta);
136 hapd->sta_aid[(sta->aid - 1) / 32] &=
137 ~BIT((sta->aid - 1) % 32);
140 if (sta->nonerp_set) {
142 hapd->iface->num_sta_non_erp--;
143 if (hapd->iface->num_sta_non_erp == 0)
147 if (sta->no_short_slot_time_set) {
148 sta->no_short_slot_time_set = 0;
149 hapd->iface->num_sta_no_short_slot_time--;
150 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
151 && hapd->iface->num_sta_no_short_slot_time == 0)
155 if (sta->no_short_preamble_set) {
156 sta->no_short_preamble_set = 0;
157 hapd->iface->num_sta_no_short_preamble--;
158 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
159 && hapd->iface->num_sta_no_short_preamble == 0)
163 if (sta->no_ht_gf_set) {
164 sta->no_ht_gf_set = 0;
165 hapd->iface->num_sta_ht_no_gf--;
168 if (sta->no_ht_set) {
170 hapd->iface->num_sta_no_ht--;
173 if (sta->ht_20mhz_set) {
174 sta->ht_20mhz_set = 0;
175 hapd->iface->num_sta_ht_20mhz--;
179 if (sta->no_p2p_set) {
181 hapd->num_sta_no_p2p--;
182 if (hapd->num_sta_no_p2p == 0)
183 hostapd_p2p_non_p2p_sta_disconnected(hapd);
185 #endif /* CONFIG_P2P */
187 #if defined(NEED_AP_MLME) && defined(CONFIG_IEEE80211N)
188 if (hostapd_ht_operation_update(hapd->iface) > 0)
190 #endif /* NEED_AP_MLME && CONFIG_IEEE80211N */
193 ieee802_11_set_beacons(hapd->iface);
195 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
196 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
198 ieee802_1x_free_station(sta);
199 wpa_auth_sta_deinit(sta->wpa_sm);
200 rsn_preauth_free_station(hapd, sta);
201 #ifndef CONFIG_NO_RADIUS
202 radius_client_flush_auth(hapd->radius, sta->addr);
203 #endif /* CONFIG_NO_RADIUS */
205 os_free(sta->last_assoc_req);
206 os_free(sta->challenge);
208 #ifdef CONFIG_IEEE80211W
209 os_free(sta->sa_query_trans_id);
210 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
211 #endif /* CONFIG_IEEE80211W */
214 p2p_group_notif_disassoc(hapd->p2p_group, sta->addr);
215 #endif /* CONFIG_P2P */
217 wpabuf_free(sta->wps_ie);
218 wpabuf_free(sta->p2p_ie);
220 os_free(sta->ht_capabilities);
226 void hostapd_free_stas(struct hostapd_data *hapd)
228 struct sta_info *sta, *prev;
230 sta = hapd->sta_list;
234 if (sta->flags & WLAN_STA_AUTH) {
235 mlme_deauthenticate_indication(
236 hapd, sta, WLAN_REASON_UNSPECIFIED);
239 wpa_printf(MSG_DEBUG, "Removing station " MACSTR,
240 MAC2STR(prev->addr));
241 ap_free_sta(hapd, prev);
247 * ap_handle_timer - Per STA timer handler
248 * @eloop_ctx: struct hostapd_data *
249 * @timeout_ctx: struct sta_info *
251 * This function is called to check station activity and to remove inactive
254 void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
256 struct hostapd_data *hapd = eloop_ctx;
257 struct sta_info *sta = timeout_ctx;
258 unsigned long next_time = 0;
260 if (sta->timeout_next == STA_REMOVE) {
261 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
262 HOSTAPD_LEVEL_INFO, "deauthenticated due to "
263 "local deauth request");
264 ap_free_sta(hapd, sta);
268 if ((sta->flags & WLAN_STA_ASSOC) &&
269 (sta->timeout_next == STA_NULLFUNC ||
270 sta->timeout_next == STA_DISASSOC)) {
272 wpa_printf(MSG_DEBUG, "Checking STA " MACSTR " inactivity:",
274 inactive_sec = hapd->drv.get_inact_sec(hapd, sta->addr);
275 if (inactive_sec == -1) {
276 wpa_printf(MSG_DEBUG, "Could not get station info "
277 "from kernel driver for " MACSTR ".",
279 } else if (inactive_sec < hapd->conf->ap_max_inactivity &&
280 sta->flags & WLAN_STA_ASSOC) {
281 /* station activity detected; reset timeout state */
282 wpa_printf(MSG_DEBUG, " Station has been active");
283 sta->timeout_next = STA_NULLFUNC;
284 next_time = hapd->conf->ap_max_inactivity -
289 if ((sta->flags & WLAN_STA_ASSOC) &&
290 sta->timeout_next == STA_DISASSOC &&
291 !(sta->flags & WLAN_STA_PENDING_POLL)) {
292 wpa_printf(MSG_DEBUG, " Station has ACKed data poll");
293 /* data nullfunc frame poll did not produce TX errors; assume
294 * station ACKed it */
295 sta->timeout_next = STA_NULLFUNC;
296 next_time = hapd->conf->ap_max_inactivity;
300 eloop_register_timeout(next_time, 0, ap_handle_timer, hapd,
305 if (sta->timeout_next == STA_NULLFUNC &&
306 (sta->flags & WLAN_STA_ASSOC)) {
307 #ifndef CONFIG_NATIVE_WINDOWS
308 /* send data frame to poll STA and check whether this frame
310 struct ieee80211_hdr hdr;
312 wpa_printf(MSG_DEBUG, " Polling STA with data frame");
313 sta->flags |= WLAN_STA_PENDING_POLL;
315 os_memset(&hdr, 0, sizeof(hdr));
317 os_strcmp(hapd->driver->name, "hostap") == 0) {
319 * WLAN_FC_STYPE_NULLFUNC would be more appropriate,
320 * but it is apparently not retried so TX Exc events
321 * are not received for it.
324 IEEE80211_FC(WLAN_FC_TYPE_DATA,
328 IEEE80211_FC(WLAN_FC_TYPE_DATA,
329 WLAN_FC_STYPE_NULLFUNC);
332 hdr.frame_control |= host_to_le16(WLAN_FC_FROMDS);
333 os_memcpy(hdr.IEEE80211_DA_FROMDS, sta->addr, ETH_ALEN);
334 os_memcpy(hdr.IEEE80211_BSSID_FROMDS, hapd->own_addr,
336 os_memcpy(hdr.IEEE80211_SA_FROMDS, hapd->own_addr, ETH_ALEN);
338 if (hapd->drv.send_mgmt_frame(hapd, &hdr, sizeof(hdr)) < 0)
339 perror("ap_handle_timer: send");
340 #endif /* CONFIG_NATIVE_WINDOWS */
341 } else if (sta->timeout_next != STA_REMOVE) {
342 int deauth = sta->timeout_next == STA_DEAUTH;
344 wpa_printf(MSG_DEBUG, "Sending %s info to STA " MACSTR,
345 deauth ? "deauthentication" : "disassociation",
349 hapd->drv.sta_deauth(hapd, sta->addr,
350 WLAN_REASON_PREV_AUTH_NOT_VALID);
352 hapd->drv.sta_disassoc(
354 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
358 switch (sta->timeout_next) {
360 sta->timeout_next = STA_DISASSOC;
361 eloop_register_timeout(AP_DISASSOC_DELAY, 0, ap_handle_timer,
365 sta->flags &= ~WLAN_STA_ASSOC;
366 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
367 if (!sta->acct_terminate_cause)
368 sta->acct_terminate_cause =
369 RADIUS_ACCT_TERMINATE_CAUSE_IDLE_TIMEOUT;
370 accounting_sta_stop(hapd, sta);
371 ieee802_1x_free_station(sta);
372 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
373 HOSTAPD_LEVEL_INFO, "disassociated due to "
375 sta->timeout_next = STA_DEAUTH;
376 eloop_register_timeout(AP_DEAUTH_DELAY, 0, ap_handle_timer,
378 mlme_disassociate_indication(
379 hapd, sta, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
383 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
384 HOSTAPD_LEVEL_INFO, "deauthenticated due to "
386 if (!sta->acct_terminate_cause)
387 sta->acct_terminate_cause =
388 RADIUS_ACCT_TERMINATE_CAUSE_IDLE_TIMEOUT;
389 mlme_deauthenticate_indication(
391 WLAN_REASON_PREV_AUTH_NOT_VALID);
392 ap_free_sta(hapd, sta);
398 static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx)
400 struct hostapd_data *hapd = eloop_ctx;
401 struct sta_info *sta = timeout_ctx;
404 if (!(sta->flags & WLAN_STA_AUTH))
407 mlme_deauthenticate_indication(hapd, sta,
408 WLAN_REASON_PREV_AUTH_NOT_VALID);
409 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
410 HOSTAPD_LEVEL_INFO, "deauthenticated due to "
412 sta->acct_terminate_cause =
413 RADIUS_ACCT_TERMINATE_CAUSE_SESSION_TIMEOUT;
414 os_memcpy(addr, sta->addr, ETH_ALEN);
415 ap_free_sta(hapd, sta);
416 hapd->drv.sta_deauth(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
420 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
423 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
424 HOSTAPD_LEVEL_DEBUG, "setting session timeout to %d "
425 "seconds", session_timeout);
426 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
427 eloop_register_timeout(session_timeout, 0, ap_handle_session_timer,
432 void ap_sta_no_session_timeout(struct hostapd_data *hapd, struct sta_info *sta)
434 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
438 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
440 struct sta_info *sta;
442 sta = ap_get_sta(hapd, addr);
446 wpa_printf(MSG_DEBUG, " New STA");
447 if (hapd->num_sta >= hapd->conf->max_num_sta) {
448 /* FIX: might try to remove some old STAs first? */
449 wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)",
450 hapd->num_sta, hapd->conf->max_num_sta);
454 sta = os_zalloc(sizeof(struct sta_info));
456 wpa_printf(MSG_ERROR, "malloc failed");
459 sta->acct_interim_interval = hapd->conf->acct_interim_interval;
461 /* initialize STA info data */
462 eloop_register_timeout(hapd->conf->ap_max_inactivity, 0,
463 ap_handle_timer, hapd, sta);
464 os_memcpy(sta->addr, addr, ETH_ALEN);
465 sta->next = hapd->sta_list;
466 hapd->sta_list = sta;
468 ap_sta_hash_add(hapd, sta);
469 sta->ssid = &hapd->conf->ssid;
470 ap_sta_remove_in_other_bss(hapd, sta);
476 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta)
478 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
480 wpa_printf(MSG_DEBUG, "Removing STA " MACSTR " from kernel driver",
482 if (hapd->drv.sta_remove(hapd, sta->addr) &&
483 sta->flags & WLAN_STA_ASSOC) {
484 wpa_printf(MSG_DEBUG, "Could not remove station " MACSTR
485 " from kernel driver.", MAC2STR(sta->addr));
492 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
493 struct sta_info *sta)
495 struct hostapd_iface *iface = hapd->iface;
498 for (i = 0; i < iface->num_bss; i++) {
499 struct hostapd_data *bss = iface->bss[i];
500 struct sta_info *sta2;
501 /* bss should always be set during operation, but it may be
502 * NULL during reconfiguration. Assume the STA is not
503 * associated to another BSS in that case to avoid NULL pointer
505 if (bss == hapd || bss == NULL)
507 sta2 = ap_get_sta(bss, sta->addr);
511 ap_sta_disconnect(bss, sta2, sta2->addr,
512 WLAN_REASON_PREV_AUTH_NOT_VALID);
517 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
520 wpa_printf(MSG_DEBUG, "%s: disassociate STA " MACSTR,
521 hapd->conf->iface, MAC2STR(sta->addr));
522 sta->flags &= ~WLAN_STA_ASSOC;
523 ap_sta_remove(hapd, sta);
524 sta->timeout_next = STA_DEAUTH;
525 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
526 eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DISASSOC, 0,
527 ap_handle_timer, hapd, sta);
528 accounting_sta_stop(hapd, sta);
529 ieee802_1x_free_station(sta);
531 mlme_disassociate_indication(hapd, sta, reason);
535 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
538 wpa_printf(MSG_DEBUG, "%s: deauthenticate STA " MACSTR,
539 hapd->conf->iface, MAC2STR(sta->addr));
540 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
541 ap_sta_remove(hapd, sta);
542 sta->timeout_next = STA_REMOVE;
543 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
544 eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DEAUTH, 0,
545 ap_handle_timer, hapd, sta);
546 accounting_sta_stop(hapd, sta);
547 ieee802_1x_free_station(sta);
549 mlme_deauthenticate_indication(hapd, sta, reason);
553 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
556 #ifndef CONFIG_NO_VLAN
558 struct hostapd_vlan *vlan = NULL;
562 * Do not proceed furthur if the vlan id remains same. We do not want
563 * duplicate dynamic vlan entries.
565 if (sta->vlan_id == old_vlanid)
569 * During 1x reauth, if the vlan id changes, then remove the old id and
570 * proceed furthur to add the new one.
573 vlan_remove_dynamic(hapd, old_vlanid);
575 iface = hapd->conf->iface;
576 if (sta->ssid->vlan[0])
577 iface = sta->ssid->vlan;
579 if (sta->ssid->dynamic_vlan == DYNAMIC_VLAN_DISABLED)
581 else if (sta->vlan_id > 0) {
582 vlan = hapd->conf->vlan;
584 if (vlan->vlan_id == sta->vlan_id ||
585 vlan->vlan_id == VLAN_ID_WILDCARD) {
586 iface = vlan->ifname;
593 if (sta->vlan_id > 0 && vlan == NULL) {
594 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
595 HOSTAPD_LEVEL_DEBUG, "could not find VLAN for "
596 "binding station to (vlan_id=%d)",
599 } else if (sta->vlan_id > 0 && vlan->vlan_id == VLAN_ID_WILDCARD) {
600 vlan = vlan_add_dynamic(hapd, vlan, sta->vlan_id);
602 hostapd_logger(hapd, sta->addr,
603 HOSTAPD_MODULE_IEEE80211,
604 HOSTAPD_LEVEL_DEBUG, "could not add "
605 "dynamic VLAN interface for vlan_id=%d",
610 iface = vlan->ifname;
611 if (vlan_setup_encryption_dyn(hapd, sta->ssid, iface) != 0) {
612 hostapd_logger(hapd, sta->addr,
613 HOSTAPD_MODULE_IEEE80211,
614 HOSTAPD_LEVEL_DEBUG, "could not "
615 "configure encryption for dynamic VLAN "
616 "interface for vlan_id=%d",
620 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
621 HOSTAPD_LEVEL_DEBUG, "added new dynamic VLAN "
622 "interface '%s'", iface);
623 } else if (vlan && vlan->vlan_id == sta->vlan_id) {
624 if (sta->vlan_id > 0) {
625 vlan->dynamic_vlan++;
626 hostapd_logger(hapd, sta->addr,
627 HOSTAPD_MODULE_IEEE80211,
628 HOSTAPD_LEVEL_DEBUG, "updated existing "
629 "dynamic VLAN interface '%s'", iface);
633 * Update encryption configuration for statically generated
634 * VLAN interface. This is only used for static WEP
635 * configuration for the case where hostapd did not yet know
636 * which keys are to be used when the interface was added.
638 if (vlan_setup_encryption_dyn(hapd, sta->ssid, iface) != 0) {
639 hostapd_logger(hapd, sta->addr,
640 HOSTAPD_MODULE_IEEE80211,
641 HOSTAPD_LEVEL_DEBUG, "could not "
642 "configure encryption for VLAN "
643 "interface for vlan_id=%d",
648 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
649 HOSTAPD_LEVEL_DEBUG, "binding station to interface "
652 if (wpa_auth_sta_set_vlan(sta->wpa_sm, sta->vlan_id) < 0)
653 wpa_printf(MSG_INFO, "Failed to update VLAN-ID for WPA");
655 ret = hapd->drv.set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
657 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
658 HOSTAPD_LEVEL_DEBUG, "could not bind the STA "
659 "entry to vlan_id=%d", sta->vlan_id);
662 #else /* CONFIG_NO_VLAN */
664 #endif /* CONFIG_NO_VLAN */
668 #ifdef CONFIG_IEEE80211W
670 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta)
673 struct os_time now, passed;
675 os_time_sub(&now, &sta->sa_query_start, &passed);
676 tu = (passed.sec * 1000000 + passed.usec) / 1024;
677 if (hapd->conf->assoc_sa_query_max_timeout < tu) {
678 hostapd_logger(hapd, sta->addr,
679 HOSTAPD_MODULE_IEEE80211,
681 "association SA Query timed out");
682 sta->sa_query_timed_out = 1;
683 os_free(sta->sa_query_trans_id);
684 sta->sa_query_trans_id = NULL;
685 sta->sa_query_count = 0;
686 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
694 static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx)
696 struct hostapd_data *hapd = eloop_ctx;
697 struct sta_info *sta = timeout_ctx;
698 unsigned int timeout, sec, usec;
701 if (sta->sa_query_count > 0 &&
702 ap_check_sa_query_timeout(hapd, sta))
705 nbuf = os_realloc(sta->sa_query_trans_id,
706 (sta->sa_query_count + 1) * WLAN_SA_QUERY_TR_ID_LEN);
709 if (sta->sa_query_count == 0) {
710 /* Starting a new SA Query procedure */
711 os_get_time(&sta->sa_query_start);
713 trans_id = nbuf + sta->sa_query_count * WLAN_SA_QUERY_TR_ID_LEN;
714 sta->sa_query_trans_id = nbuf;
715 sta->sa_query_count++;
717 os_get_random(trans_id, WLAN_SA_QUERY_TR_ID_LEN);
719 timeout = hapd->conf->assoc_sa_query_retry_timeout;
720 sec = ((timeout / 1000) * 1024) / 1000;
721 usec = (timeout % 1000) * 1024;
722 eloop_register_timeout(sec, usec, ap_sa_query_timer, hapd, sta);
724 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
726 "association SA Query attempt %d", sta->sa_query_count);
729 ieee802_11_send_sa_query_req(hapd, sta->addr, trans_id);
730 #endif /* NEED_AP_MLME */
734 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
736 ap_sa_query_timer(hapd, sta);
740 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
742 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
743 os_free(sta->sa_query_trans_id);
744 sta->sa_query_trans_id = NULL;
745 sta->sa_query_count = 0;
748 #endif /* CONFIG_IEEE80211W */
751 void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
752 const u8 *addr, u16 reason)
755 if (sta == NULL && addr)
756 sta = ap_get_sta(hapd, addr);
759 hapd->drv.sta_deauth(hapd, addr, reason);
763 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_AUTHORIZED);
764 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
765 eloop_register_timeout(0, 0, ap_handle_timer, hapd, sta);
766 sta->timeout_next = STA_REMOVE;