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"
35 #include "ap_drv_ops.h"
38 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
39 struct sta_info *sta);
40 static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx);
41 #ifdef CONFIG_IEEE80211W
42 static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx);
43 #endif /* CONFIG_IEEE80211W */
45 int ap_for_each_sta(struct hostapd_data *hapd,
46 int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
52 for (sta = hapd->sta_list; sta; sta = sta->next) {
53 if (cb(hapd, sta, ctx))
61 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta)
65 s = hapd->sta_hash[STA_HASH(sta)];
66 while (s != NULL && os_memcmp(s->addr, sta, 6) != 0)
72 static void ap_sta_list_del(struct hostapd_data *hapd, struct sta_info *sta)
76 if (hapd->sta_list == sta) {
77 hapd->sta_list = sta->next;
82 while (tmp != NULL && tmp->next != sta)
85 wpa_printf(MSG_DEBUG, "Could not remove STA " MACSTR " from "
86 "list.", MAC2STR(sta->addr));
88 tmp->next = sta->next;
92 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta)
94 sta->hnext = hapd->sta_hash[STA_HASH(sta->addr)];
95 hapd->sta_hash[STA_HASH(sta->addr)] = sta;
99 static void ap_sta_hash_del(struct hostapd_data *hapd, struct sta_info *sta)
103 s = hapd->sta_hash[STA_HASH(sta->addr)];
104 if (s == NULL) return;
105 if (os_memcmp(s->addr, sta->addr, 6) == 0) {
106 hapd->sta_hash[STA_HASH(sta->addr)] = s->hnext;
110 while (s->hnext != NULL &&
111 os_memcmp(s->hnext->addr, sta->addr, ETH_ALEN) != 0)
113 if (s->hnext != NULL)
114 s->hnext = s->hnext->hnext;
116 wpa_printf(MSG_DEBUG, "AP: could not remove STA " MACSTR
117 " from hash table", MAC2STR(sta->addr));
121 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
125 accounting_sta_stop(hapd, sta);
127 if (sta->flags & WLAN_STA_WDS)
128 hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
130 if (!(sta->flags & WLAN_STA_PREAUTH))
131 hostapd_drv_sta_remove(hapd, sta->addr);
133 ap_sta_hash_del(hapd, sta);
134 ap_sta_list_del(hapd, sta);
137 hapd->sta_aid[(sta->aid - 1) / 32] &=
138 ~BIT((sta->aid - 1) % 32);
141 if (sta->nonerp_set) {
143 hapd->iface->num_sta_non_erp--;
144 if (hapd->iface->num_sta_non_erp == 0)
148 if (sta->no_short_slot_time_set) {
149 sta->no_short_slot_time_set = 0;
150 hapd->iface->num_sta_no_short_slot_time--;
151 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
152 && hapd->iface->num_sta_no_short_slot_time == 0)
156 if (sta->no_short_preamble_set) {
157 sta->no_short_preamble_set = 0;
158 hapd->iface->num_sta_no_short_preamble--;
159 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
160 && hapd->iface->num_sta_no_short_preamble == 0)
164 if (sta->no_ht_gf_set) {
165 sta->no_ht_gf_set = 0;
166 hapd->iface->num_sta_ht_no_gf--;
169 if (sta->no_ht_set) {
171 hapd->iface->num_sta_no_ht--;
174 if (sta->ht_20mhz_set) {
175 sta->ht_20mhz_set = 0;
176 hapd->iface->num_sta_ht_20mhz--;
180 if (sta->no_p2p_set) {
182 hapd->num_sta_no_p2p--;
183 if (hapd->num_sta_no_p2p == 0)
184 hostapd_p2p_non_p2p_sta_disconnected(hapd);
186 #endif /* CONFIG_P2P */
188 #if defined(NEED_AP_MLME) && defined(CONFIG_IEEE80211N)
189 if (hostapd_ht_operation_update(hapd->iface) > 0)
191 #endif /* NEED_AP_MLME && CONFIG_IEEE80211N */
194 ieee802_11_set_beacons(hapd->iface);
196 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
197 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
199 ieee802_1x_free_station(sta);
200 wpa_auth_sta_deinit(sta->wpa_sm);
201 rsn_preauth_free_station(hapd, sta);
202 #ifndef CONFIG_NO_RADIUS
203 radius_client_flush_auth(hapd->radius, sta->addr);
204 #endif /* CONFIG_NO_RADIUS */
206 os_free(sta->last_assoc_req);
207 os_free(sta->challenge);
209 #ifdef CONFIG_IEEE80211W
210 os_free(sta->sa_query_trans_id);
211 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
212 #endif /* CONFIG_IEEE80211W */
215 p2p_group_notif_disassoc(hapd->p2p_group, sta->addr);
216 #endif /* CONFIG_P2P */
218 wpabuf_free(sta->wps_ie);
219 wpabuf_free(sta->p2p_ie);
221 os_free(sta->ht_capabilities);
227 void hostapd_free_stas(struct hostapd_data *hapd)
229 struct sta_info *sta, *prev;
231 sta = hapd->sta_list;
235 if (sta->flags & WLAN_STA_AUTH) {
236 mlme_deauthenticate_indication(
237 hapd, sta, WLAN_REASON_UNSPECIFIED);
240 wpa_printf(MSG_DEBUG, "Removing station " MACSTR,
241 MAC2STR(prev->addr));
242 ap_free_sta(hapd, prev);
248 * ap_handle_timer - Per STA timer handler
249 * @eloop_ctx: struct hostapd_data *
250 * @timeout_ctx: struct sta_info *
252 * This function is called to check station activity and to remove inactive
255 void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
257 struct hostapd_data *hapd = eloop_ctx;
258 struct sta_info *sta = timeout_ctx;
259 unsigned long next_time = 0;
261 if (sta->timeout_next == STA_REMOVE) {
262 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
263 HOSTAPD_LEVEL_INFO, "deauthenticated due to "
264 "local deauth request");
265 ap_free_sta(hapd, sta);
269 if ((sta->flags & WLAN_STA_ASSOC) &&
270 (sta->timeout_next == STA_NULLFUNC ||
271 sta->timeout_next == STA_DISASSOC)) {
273 wpa_printf(MSG_DEBUG, "Checking STA " MACSTR " inactivity:",
275 inactive_sec = hostapd_drv_get_inact_sec(hapd, sta->addr);
276 if (inactive_sec == -1) {
277 wpa_printf(MSG_DEBUG, "Could not get station info "
278 "from kernel driver for " MACSTR ".",
280 } else if (inactive_sec < hapd->conf->ap_max_inactivity &&
281 sta->flags & WLAN_STA_ASSOC) {
282 /* station activity detected; reset timeout state */
283 wpa_printf(MSG_DEBUG, " Station has been active");
284 sta->timeout_next = STA_NULLFUNC;
285 next_time = hapd->conf->ap_max_inactivity -
290 if ((sta->flags & WLAN_STA_ASSOC) &&
291 sta->timeout_next == STA_DISASSOC &&
292 !(sta->flags & WLAN_STA_PENDING_POLL)) {
293 wpa_printf(MSG_DEBUG, " Station has ACKed data poll");
294 /* data nullfunc frame poll did not produce TX errors; assume
295 * station ACKed it */
296 sta->timeout_next = STA_NULLFUNC;
297 next_time = hapd->conf->ap_max_inactivity;
301 eloop_register_timeout(next_time, 0, ap_handle_timer, hapd,
306 if (sta->timeout_next == STA_NULLFUNC &&
307 (sta->flags & WLAN_STA_ASSOC)) {
308 #ifndef CONFIG_NATIVE_WINDOWS
309 /* send data frame to poll STA and check whether this frame
311 struct ieee80211_hdr hdr;
313 wpa_printf(MSG_DEBUG, " Polling STA with data frame");
314 sta->flags |= WLAN_STA_PENDING_POLL;
316 os_memset(&hdr, 0, sizeof(hdr));
318 os_strcmp(hapd->driver->name, "hostap") == 0) {
320 * WLAN_FC_STYPE_NULLFUNC would be more appropriate,
321 * but it is apparently not retried so TX Exc events
322 * are not received for it.
325 IEEE80211_FC(WLAN_FC_TYPE_DATA,
329 IEEE80211_FC(WLAN_FC_TYPE_DATA,
330 WLAN_FC_STYPE_NULLFUNC);
333 hdr.frame_control |= host_to_le16(WLAN_FC_FROMDS);
334 os_memcpy(hdr.IEEE80211_DA_FROMDS, sta->addr, ETH_ALEN);
335 os_memcpy(hdr.IEEE80211_BSSID_FROMDS, hapd->own_addr,
337 os_memcpy(hdr.IEEE80211_SA_FROMDS, hapd->own_addr, ETH_ALEN);
339 if (hostapd_drv_send_mlme(hapd, &hdr, sizeof(hdr)) < 0)
340 perror("ap_handle_timer: send");
341 #endif /* CONFIG_NATIVE_WINDOWS */
342 } else if (sta->timeout_next != STA_REMOVE) {
343 int deauth = sta->timeout_next == STA_DEAUTH;
345 wpa_printf(MSG_DEBUG, "Sending %s info to STA " MACSTR,
346 deauth ? "deauthentication" : "disassociation",
350 hostapd_drv_sta_deauth(
352 WLAN_REASON_PREV_AUTH_NOT_VALID);
354 hostapd_drv_sta_disassoc(
356 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
360 switch (sta->timeout_next) {
362 sta->timeout_next = STA_DISASSOC;
363 eloop_register_timeout(AP_DISASSOC_DELAY, 0, ap_handle_timer,
367 sta->flags &= ~WLAN_STA_ASSOC;
368 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
369 if (!sta->acct_terminate_cause)
370 sta->acct_terminate_cause =
371 RADIUS_ACCT_TERMINATE_CAUSE_IDLE_TIMEOUT;
372 accounting_sta_stop(hapd, sta);
373 ieee802_1x_free_station(sta);
374 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
375 HOSTAPD_LEVEL_INFO, "disassociated due to "
377 sta->timeout_next = STA_DEAUTH;
378 eloop_register_timeout(AP_DEAUTH_DELAY, 0, ap_handle_timer,
380 mlme_disassociate_indication(
381 hapd, sta, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
385 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
386 HOSTAPD_LEVEL_INFO, "deauthenticated due to "
388 if (!sta->acct_terminate_cause)
389 sta->acct_terminate_cause =
390 RADIUS_ACCT_TERMINATE_CAUSE_IDLE_TIMEOUT;
391 mlme_deauthenticate_indication(
393 WLAN_REASON_PREV_AUTH_NOT_VALID);
394 ap_free_sta(hapd, sta);
400 static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx)
402 struct hostapd_data *hapd = eloop_ctx;
403 struct sta_info *sta = timeout_ctx;
406 if (!(sta->flags & WLAN_STA_AUTH))
409 mlme_deauthenticate_indication(hapd, sta,
410 WLAN_REASON_PREV_AUTH_NOT_VALID);
411 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
412 HOSTAPD_LEVEL_INFO, "deauthenticated due to "
414 sta->acct_terminate_cause =
415 RADIUS_ACCT_TERMINATE_CAUSE_SESSION_TIMEOUT;
416 os_memcpy(addr, sta->addr, ETH_ALEN);
417 ap_free_sta(hapd, sta);
418 hostapd_drv_sta_deauth(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
422 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
425 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
426 HOSTAPD_LEVEL_DEBUG, "setting session timeout to %d "
427 "seconds", session_timeout);
428 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
429 eloop_register_timeout(session_timeout, 0, ap_handle_session_timer,
434 void ap_sta_no_session_timeout(struct hostapd_data *hapd, struct sta_info *sta)
436 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
440 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
442 struct sta_info *sta;
444 sta = ap_get_sta(hapd, addr);
448 wpa_printf(MSG_DEBUG, " New STA");
449 if (hapd->num_sta >= hapd->conf->max_num_sta) {
450 /* FIX: might try to remove some old STAs first? */
451 wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)",
452 hapd->num_sta, hapd->conf->max_num_sta);
456 sta = os_zalloc(sizeof(struct sta_info));
458 wpa_printf(MSG_ERROR, "malloc failed");
461 sta->acct_interim_interval = hapd->conf->acct_interim_interval;
463 /* initialize STA info data */
464 eloop_register_timeout(hapd->conf->ap_max_inactivity, 0,
465 ap_handle_timer, hapd, sta);
466 os_memcpy(sta->addr, addr, ETH_ALEN);
467 sta->next = hapd->sta_list;
468 hapd->sta_list = sta;
470 ap_sta_hash_add(hapd, sta);
471 sta->ssid = &hapd->conf->ssid;
472 ap_sta_remove_in_other_bss(hapd, sta);
478 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta)
480 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
482 wpa_printf(MSG_DEBUG, "Removing STA " MACSTR " from kernel driver",
484 if (hostapd_drv_sta_remove(hapd, sta->addr) &&
485 sta->flags & WLAN_STA_ASSOC) {
486 wpa_printf(MSG_DEBUG, "Could not remove station " MACSTR
487 " from kernel driver.", MAC2STR(sta->addr));
494 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
495 struct sta_info *sta)
497 struct hostapd_iface *iface = hapd->iface;
500 for (i = 0; i < iface->num_bss; i++) {
501 struct hostapd_data *bss = iface->bss[i];
502 struct sta_info *sta2;
503 /* bss should always be set during operation, but it may be
504 * NULL during reconfiguration. Assume the STA is not
505 * associated to another BSS in that case to avoid NULL pointer
507 if (bss == hapd || bss == NULL)
509 sta2 = ap_get_sta(bss, sta->addr);
513 ap_sta_disconnect(bss, sta2, sta2->addr,
514 WLAN_REASON_PREV_AUTH_NOT_VALID);
519 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
522 wpa_printf(MSG_DEBUG, "%s: disassociate STA " MACSTR,
523 hapd->conf->iface, MAC2STR(sta->addr));
524 sta->flags &= ~WLAN_STA_ASSOC;
525 ap_sta_remove(hapd, sta);
526 sta->timeout_next = STA_DEAUTH;
527 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
528 eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DISASSOC, 0,
529 ap_handle_timer, hapd, sta);
530 accounting_sta_stop(hapd, sta);
531 ieee802_1x_free_station(sta);
533 mlme_disassociate_indication(hapd, sta, reason);
537 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
540 wpa_printf(MSG_DEBUG, "%s: deauthenticate STA " MACSTR,
541 hapd->conf->iface, MAC2STR(sta->addr));
542 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
543 ap_sta_remove(hapd, sta);
544 sta->timeout_next = STA_REMOVE;
545 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
546 eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DEAUTH, 0,
547 ap_handle_timer, hapd, sta);
548 accounting_sta_stop(hapd, sta);
549 ieee802_1x_free_station(sta);
551 mlme_deauthenticate_indication(hapd, sta, reason);
555 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
558 #ifndef CONFIG_NO_VLAN
560 struct hostapd_vlan *vlan = NULL;
564 * Do not proceed furthur if the vlan id remains same. We do not want
565 * duplicate dynamic vlan entries.
567 if (sta->vlan_id == old_vlanid)
571 * During 1x reauth, if the vlan id changes, then remove the old id and
572 * proceed furthur to add the new one.
575 vlan_remove_dynamic(hapd, old_vlanid);
577 iface = hapd->conf->iface;
578 if (sta->ssid->vlan[0])
579 iface = sta->ssid->vlan;
581 if (sta->ssid->dynamic_vlan == DYNAMIC_VLAN_DISABLED)
583 else if (sta->vlan_id > 0) {
584 vlan = hapd->conf->vlan;
586 if (vlan->vlan_id == sta->vlan_id ||
587 vlan->vlan_id == VLAN_ID_WILDCARD) {
588 iface = vlan->ifname;
595 if (sta->vlan_id > 0 && vlan == NULL) {
596 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
597 HOSTAPD_LEVEL_DEBUG, "could not find VLAN for "
598 "binding station to (vlan_id=%d)",
601 } else if (sta->vlan_id > 0 && vlan->vlan_id == VLAN_ID_WILDCARD) {
602 vlan = vlan_add_dynamic(hapd, vlan, sta->vlan_id);
604 hostapd_logger(hapd, sta->addr,
605 HOSTAPD_MODULE_IEEE80211,
606 HOSTAPD_LEVEL_DEBUG, "could not add "
607 "dynamic VLAN interface for vlan_id=%d",
612 iface = vlan->ifname;
613 if (vlan_setup_encryption_dyn(hapd, sta->ssid, iface) != 0) {
614 hostapd_logger(hapd, sta->addr,
615 HOSTAPD_MODULE_IEEE80211,
616 HOSTAPD_LEVEL_DEBUG, "could not "
617 "configure encryption for dynamic VLAN "
618 "interface for vlan_id=%d",
622 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
623 HOSTAPD_LEVEL_DEBUG, "added new dynamic VLAN "
624 "interface '%s'", iface);
625 } else if (vlan && vlan->vlan_id == sta->vlan_id) {
626 if (sta->vlan_id > 0) {
627 vlan->dynamic_vlan++;
628 hostapd_logger(hapd, sta->addr,
629 HOSTAPD_MODULE_IEEE80211,
630 HOSTAPD_LEVEL_DEBUG, "updated existing "
631 "dynamic VLAN interface '%s'", iface);
635 * Update encryption configuration for statically generated
636 * VLAN interface. This is only used for static WEP
637 * configuration for the case where hostapd did not yet know
638 * which keys are to be used when the interface was added.
640 if (vlan_setup_encryption_dyn(hapd, sta->ssid, iface) != 0) {
641 hostapd_logger(hapd, sta->addr,
642 HOSTAPD_MODULE_IEEE80211,
643 HOSTAPD_LEVEL_DEBUG, "could not "
644 "configure encryption for VLAN "
645 "interface for vlan_id=%d",
650 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
651 HOSTAPD_LEVEL_DEBUG, "binding station to interface "
654 if (wpa_auth_sta_set_vlan(sta->wpa_sm, sta->vlan_id) < 0)
655 wpa_printf(MSG_INFO, "Failed to update VLAN-ID for WPA");
657 ret = hostapd_drv_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
659 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
660 HOSTAPD_LEVEL_DEBUG, "could not bind the STA "
661 "entry to vlan_id=%d", sta->vlan_id);
664 #else /* CONFIG_NO_VLAN */
666 #endif /* CONFIG_NO_VLAN */
670 #ifdef CONFIG_IEEE80211W
672 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta)
675 struct os_time now, passed;
677 os_time_sub(&now, &sta->sa_query_start, &passed);
678 tu = (passed.sec * 1000000 + passed.usec) / 1024;
679 if (hapd->conf->assoc_sa_query_max_timeout < tu) {
680 hostapd_logger(hapd, sta->addr,
681 HOSTAPD_MODULE_IEEE80211,
683 "association SA Query timed out");
684 sta->sa_query_timed_out = 1;
685 os_free(sta->sa_query_trans_id);
686 sta->sa_query_trans_id = NULL;
687 sta->sa_query_count = 0;
688 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
696 static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx)
698 struct hostapd_data *hapd = eloop_ctx;
699 struct sta_info *sta = timeout_ctx;
700 unsigned int timeout, sec, usec;
703 if (sta->sa_query_count > 0 &&
704 ap_check_sa_query_timeout(hapd, sta))
707 nbuf = os_realloc(sta->sa_query_trans_id,
708 (sta->sa_query_count + 1) * WLAN_SA_QUERY_TR_ID_LEN);
711 if (sta->sa_query_count == 0) {
712 /* Starting a new SA Query procedure */
713 os_get_time(&sta->sa_query_start);
715 trans_id = nbuf + sta->sa_query_count * WLAN_SA_QUERY_TR_ID_LEN;
716 sta->sa_query_trans_id = nbuf;
717 sta->sa_query_count++;
719 os_get_random(trans_id, WLAN_SA_QUERY_TR_ID_LEN);
721 timeout = hapd->conf->assoc_sa_query_retry_timeout;
722 sec = ((timeout / 1000) * 1024) / 1000;
723 usec = (timeout % 1000) * 1024;
724 eloop_register_timeout(sec, usec, ap_sa_query_timer, hapd, sta);
726 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
728 "association SA Query attempt %d", sta->sa_query_count);
731 ieee802_11_send_sa_query_req(hapd, sta->addr, trans_id);
732 #endif /* NEED_AP_MLME */
736 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
738 ap_sa_query_timer(hapd, sta);
742 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
744 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
745 os_free(sta->sa_query_trans_id);
746 sta->sa_query_trans_id = NULL;
747 sta->sa_query_count = 0;
750 #endif /* CONFIG_IEEE80211W */
753 void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
754 const u8 *addr, u16 reason)
757 if (sta == NULL && addr)
758 sta = ap_get_sta(hapd, addr);
761 hostapd_drv_sta_deauth(hapd, addr, reason);
765 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_AUTHORIZED);
766 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
767 eloop_register_timeout(0, 0, ap_handle_timer, hapd, sta);
768 sta->timeout_next = STA_REMOVE;