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.
18 #include "radius/radius.h"
19 #include "radius/radius_client.h"
20 #include "drivers/driver.h"
24 #include "accounting.h"
25 #include "ieee802_1x.h"
26 #include "ieee802_11.h"
32 #include "vlan_init.h"
34 static int ap_sta_in_other_bss(struct hostapd_data *hapd,
35 struct sta_info *sta, u32 flags);
36 static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx);
37 #ifdef CONFIG_IEEE80211W
38 static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx);
39 #endif /* CONFIG_IEEE80211W */
41 int ap_for_each_sta(struct hostapd_data *hapd,
42 int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
48 for (sta = hapd->sta_list; sta; sta = sta->next) {
49 if (cb(hapd, sta, ctx))
57 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta)
61 s = hapd->sta_hash[STA_HASH(sta)];
62 while (s != NULL && os_memcmp(s->addr, sta, 6) != 0)
68 static void ap_sta_list_del(struct hostapd_data *hapd, struct sta_info *sta)
72 if (hapd->sta_list == sta) {
73 hapd->sta_list = sta->next;
78 while (tmp != NULL && tmp->next != sta)
81 wpa_printf(MSG_DEBUG, "Could not remove STA " MACSTR " from "
82 "list.", MAC2STR(sta->addr));
84 tmp->next = sta->next;
88 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta)
90 sta->hnext = hapd->sta_hash[STA_HASH(sta->addr)];
91 hapd->sta_hash[STA_HASH(sta->addr)] = sta;
95 static void ap_sta_hash_del(struct hostapd_data *hapd, struct sta_info *sta)
99 s = hapd->sta_hash[STA_HASH(sta->addr)];
100 if (s == NULL) return;
101 if (os_memcmp(s->addr, sta->addr, 6) == 0) {
102 hapd->sta_hash[STA_HASH(sta->addr)] = s->hnext;
106 while (s->hnext != NULL &&
107 os_memcmp(s->hnext->addr, sta->addr, ETH_ALEN) != 0)
109 if (s->hnext != NULL)
110 s->hnext = s->hnext->hnext;
112 wpa_printf(MSG_DEBUG, "AP: could not remove STA " MACSTR
113 " from hash table", MAC2STR(sta->addr));
117 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
121 accounting_sta_stop(hapd, sta);
123 hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
124 if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) &&
125 !(sta->flags & WLAN_STA_PREAUTH))
126 hapd->drv.sta_remove(hapd, sta->addr);
128 ap_sta_hash_del(hapd, sta);
129 ap_sta_list_del(hapd, sta);
132 hapd->sta_aid[(sta->aid - 1) / 32] &=
133 ~BIT((sta->aid - 1) % 32);
136 if (sta->nonerp_set) {
138 hapd->iface->num_sta_non_erp--;
139 if (hapd->iface->num_sta_non_erp == 0)
143 if (sta->no_short_slot_time_set) {
144 sta->no_short_slot_time_set = 0;
145 hapd->iface->num_sta_no_short_slot_time--;
146 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
147 && hapd->iface->num_sta_no_short_slot_time == 0)
151 if (sta->no_short_preamble_set) {
152 sta->no_short_preamble_set = 0;
153 hapd->iface->num_sta_no_short_preamble--;
154 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
155 && hapd->iface->num_sta_no_short_preamble == 0)
159 if (sta->no_ht_gf_set) {
160 sta->no_ht_gf_set = 0;
161 hapd->iface->num_sta_ht_no_gf--;
164 if (sta->no_ht_set) {
166 hapd->iface->num_sta_no_ht--;
169 if (sta->ht_20mhz_set) {
170 sta->ht_20mhz_set = 0;
171 hapd->iface->num_sta_ht_20mhz--;
174 #if defined(NEED_AP_MLME) && defined(CONFIG_IEEE80211N)
175 if (hostapd_ht_operation_update(hapd->iface) > 0)
177 #endif /* NEED_AP_MLME && CONFIG_IEEE80211N */
180 ieee802_11_set_beacons(hapd->iface);
182 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
183 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
185 ieee802_1x_free_station(sta);
186 wpa_auth_sta_deinit(sta->wpa_sm);
187 rsn_preauth_free_station(hapd, sta);
188 #ifndef CONFIG_NO_RADIUS
189 radius_client_flush_auth(hapd->radius, sta->addr);
190 #endif /* CONFIG_NO_RADIUS */
192 os_free(sta->last_assoc_req);
193 os_free(sta->challenge);
195 #ifdef CONFIG_IEEE80211W
196 os_free(sta->sa_query_trans_id);
197 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
198 #endif /* CONFIG_IEEE80211W */
200 wpabuf_free(sta->wps_ie);
202 os_free(sta->ht_capabilities);
208 void hostapd_free_stas(struct hostapd_data *hapd)
210 struct sta_info *sta, *prev;
212 sta = hapd->sta_list;
216 if (sta->flags & WLAN_STA_AUTH) {
217 mlme_deauthenticate_indication(
218 hapd, sta, WLAN_REASON_UNSPECIFIED);
221 wpa_printf(MSG_DEBUG, "Removing station " MACSTR,
222 MAC2STR(prev->addr));
223 ap_free_sta(hapd, prev);
229 * ap_handle_timer - Per STA timer handler
230 * @eloop_ctx: struct hostapd_data *
231 * @timeout_ctx: struct sta_info *
233 * This function is called to check station activity and to remove inactive
236 void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
238 struct hostapd_data *hapd = eloop_ctx;
239 struct sta_info *sta = timeout_ctx;
240 unsigned long next_time = 0;
242 if (sta->timeout_next == STA_REMOVE) {
243 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
244 HOSTAPD_LEVEL_INFO, "deauthenticated due to "
245 "local deauth request");
246 ap_free_sta(hapd, sta);
250 if ((sta->flags & WLAN_STA_ASSOC) &&
251 (sta->timeout_next == STA_NULLFUNC ||
252 sta->timeout_next == STA_DISASSOC)) {
254 wpa_printf(MSG_DEBUG, "Checking STA " MACSTR " inactivity:",
256 inactive_sec = hapd->drv.get_inact_sec(hapd, sta->addr);
257 if (inactive_sec == -1) {
258 wpa_printf(MSG_DEBUG, "Could not get station info "
259 "from kernel driver for " MACSTR ".",
261 } else if (inactive_sec < hapd->conf->ap_max_inactivity &&
262 sta->flags & WLAN_STA_ASSOC) {
263 /* station activity detected; reset timeout state */
264 wpa_printf(MSG_DEBUG, " Station has been active");
265 sta->timeout_next = STA_NULLFUNC;
266 next_time = hapd->conf->ap_max_inactivity -
271 if ((sta->flags & WLAN_STA_ASSOC) &&
272 sta->timeout_next == STA_DISASSOC &&
273 !(sta->flags & WLAN_STA_PENDING_POLL)) {
274 wpa_printf(MSG_DEBUG, " Station has ACKed data poll");
275 /* data nullfunc frame poll did not produce TX errors; assume
276 * station ACKed it */
277 sta->timeout_next = STA_NULLFUNC;
278 next_time = hapd->conf->ap_max_inactivity;
282 eloop_register_timeout(next_time, 0, ap_handle_timer, hapd,
287 if (sta->timeout_next == STA_NULLFUNC &&
288 (sta->flags & WLAN_STA_ASSOC)) {
289 /* send data frame to poll STA and check whether this frame
291 struct ieee80211_hdr hdr;
293 wpa_printf(MSG_DEBUG, " Polling STA with data frame");
294 sta->flags |= WLAN_STA_PENDING_POLL;
296 #ifndef CONFIG_NATIVE_WINDOWS
297 os_memset(&hdr, 0, sizeof(hdr));
299 os_strcmp(hapd->driver->name, "hostap") == 0) {
301 * WLAN_FC_STYPE_NULLFUNC would be more appropriate,
302 * but it is apparently not retried so TX Exc events
303 * are not received for it.
306 IEEE80211_FC(WLAN_FC_TYPE_DATA,
310 IEEE80211_FC(WLAN_FC_TYPE_DATA,
311 WLAN_FC_STYPE_NULLFUNC);
314 hdr.frame_control |= host_to_le16(WLAN_FC_FROMDS);
315 os_memcpy(hdr.IEEE80211_DA_FROMDS, sta->addr, ETH_ALEN);
316 os_memcpy(hdr.IEEE80211_BSSID_FROMDS, hapd->own_addr,
318 os_memcpy(hdr.IEEE80211_SA_FROMDS, hapd->own_addr, ETH_ALEN);
320 if (hapd->drv.send_mgmt_frame(hapd, &hdr, sizeof(hdr)) < 0)
321 perror("ap_handle_timer: send");
322 #endif /* CONFIG_NATIVE_WINDOWS */
323 } else if (sta->timeout_next != STA_REMOVE) {
324 int deauth = sta->timeout_next == STA_DEAUTH;
326 wpa_printf(MSG_DEBUG, "Sending %s info to STA " MACSTR,
327 deauth ? "deauthentication" : "disassociation",
331 hapd->drv.sta_deauth(hapd, sta->addr,
332 WLAN_REASON_PREV_AUTH_NOT_VALID);
334 hapd->drv.sta_disassoc(
336 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
340 switch (sta->timeout_next) {
342 sta->timeout_next = STA_DISASSOC;
343 eloop_register_timeout(AP_DISASSOC_DELAY, 0, ap_handle_timer,
347 sta->flags &= ~WLAN_STA_ASSOC;
348 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
349 if (!sta->acct_terminate_cause)
350 sta->acct_terminate_cause =
351 RADIUS_ACCT_TERMINATE_CAUSE_IDLE_TIMEOUT;
352 accounting_sta_stop(hapd, sta);
353 ieee802_1x_free_station(sta);
354 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
355 HOSTAPD_LEVEL_INFO, "disassociated due to "
357 sta->timeout_next = STA_DEAUTH;
358 eloop_register_timeout(AP_DEAUTH_DELAY, 0, ap_handle_timer,
360 mlme_disassociate_indication(
361 hapd, sta, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
365 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
366 HOSTAPD_LEVEL_INFO, "deauthenticated due to "
368 if (!sta->acct_terminate_cause)
369 sta->acct_terminate_cause =
370 RADIUS_ACCT_TERMINATE_CAUSE_IDLE_TIMEOUT;
371 mlme_deauthenticate_indication(
373 WLAN_REASON_PREV_AUTH_NOT_VALID);
374 ap_free_sta(hapd, sta);
380 static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx)
382 struct hostapd_data *hapd = eloop_ctx;
383 struct sta_info *sta = timeout_ctx;
386 if (!(sta->flags & WLAN_STA_AUTH))
389 mlme_deauthenticate_indication(hapd, sta,
390 WLAN_REASON_PREV_AUTH_NOT_VALID);
391 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
392 HOSTAPD_LEVEL_INFO, "deauthenticated due to "
394 sta->acct_terminate_cause =
395 RADIUS_ACCT_TERMINATE_CAUSE_SESSION_TIMEOUT;
396 os_memcpy(addr, sta->addr, ETH_ALEN);
397 ap_free_sta(hapd, sta);
398 hapd->drv.sta_deauth(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
402 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
405 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
406 HOSTAPD_LEVEL_DEBUG, "setting session timeout to %d "
407 "seconds", session_timeout);
408 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
409 eloop_register_timeout(session_timeout, 0, ap_handle_session_timer,
414 void ap_sta_no_session_timeout(struct hostapd_data *hapd, struct sta_info *sta)
416 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
420 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
422 struct sta_info *sta;
424 sta = ap_get_sta(hapd, addr);
428 wpa_printf(MSG_DEBUG, " New STA");
429 if (hapd->num_sta >= hapd->conf->max_num_sta) {
430 /* FIX: might try to remove some old STAs first? */
431 wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)",
432 hapd->num_sta, hapd->conf->max_num_sta);
436 sta = os_zalloc(sizeof(struct sta_info));
438 wpa_printf(MSG_ERROR, "malloc failed");
441 sta->acct_interim_interval = hapd->conf->acct_interim_interval;
443 /* initialize STA info data */
444 eloop_register_timeout(hapd->conf->ap_max_inactivity, 0,
445 ap_handle_timer, hapd, sta);
446 os_memcpy(sta->addr, addr, ETH_ALEN);
447 sta->next = hapd->sta_list;
448 hapd->sta_list = sta;
450 ap_sta_hash_add(hapd, sta);
451 sta->ssid = &hapd->conf->ssid;
457 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta)
459 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
461 wpa_printf(MSG_DEBUG, "Removing STA " MACSTR " from kernel driver",
463 if (hapd->drv.sta_remove(hapd, sta->addr) &&
464 sta->flags & WLAN_STA_ASSOC) {
465 wpa_printf(MSG_DEBUG, "Could not remove station " MACSTR
466 " from kernel driver.", MAC2STR(sta->addr));
473 static int ap_sta_in_other_bss(struct hostapd_data *hapd,
474 struct sta_info *sta, u32 flags)
476 struct hostapd_iface *iface = hapd->iface;
479 for (i = 0; i < iface->num_bss; i++) {
480 struct hostapd_data *bss = iface->bss[i];
481 struct sta_info *sta2;
482 /* bss should always be set during operation, but it may be
483 * NULL during reconfiguration. Assume the STA is not
484 * associated to another BSS in that case to avoid NULL pointer
486 if (bss == hapd || bss == NULL)
488 sta2 = ap_get_sta(bss, sta->addr);
489 if (sta2 && ((sta2->flags & flags) == flags))
497 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
500 wpa_printf(MSG_DEBUG, "%s: disassociate STA " MACSTR,
501 hapd->conf->iface, MAC2STR(sta->addr));
502 sta->flags &= ~WLAN_STA_ASSOC;
503 if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC))
504 ap_sta_remove(hapd, sta);
505 sta->timeout_next = STA_DEAUTH;
506 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
507 eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DISASSOC, 0,
508 ap_handle_timer, hapd, sta);
509 accounting_sta_stop(hapd, sta);
510 ieee802_1x_free_station(sta);
512 mlme_disassociate_indication(hapd, sta, reason);
516 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
519 wpa_printf(MSG_DEBUG, "%s: deauthenticate STA " MACSTR,
520 hapd->conf->iface, MAC2STR(sta->addr));
521 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
522 if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC))
523 ap_sta_remove(hapd, sta);
524 sta->timeout_next = STA_REMOVE;
525 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
526 eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DEAUTH, 0,
527 ap_handle_timer, hapd, sta);
528 accounting_sta_stop(hapd, sta);
529 ieee802_1x_free_station(sta);
531 mlme_deauthenticate_indication(hapd, sta, reason);
535 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
538 #ifndef CONFIG_NO_VLAN
540 struct hostapd_vlan *vlan = NULL;
543 * Do not proceed furthur if the vlan id remains same. We do not want
544 * duplicate dynamic vlan entries.
546 if (sta->vlan_id == old_vlanid)
550 * During 1x reauth, if the vlan id changes, then remove the old id and
551 * proceed furthur to add the new one.
554 vlan_remove_dynamic(hapd, old_vlanid);
556 iface = hapd->conf->iface;
557 if (sta->ssid->vlan[0])
558 iface = sta->ssid->vlan;
560 if (sta->ssid->dynamic_vlan == DYNAMIC_VLAN_DISABLED)
562 else if (sta->vlan_id > 0) {
563 vlan = hapd->conf->vlan;
565 if (vlan->vlan_id == sta->vlan_id ||
566 vlan->vlan_id == VLAN_ID_WILDCARD) {
567 iface = vlan->ifname;
574 if (sta->vlan_id > 0 && vlan == NULL) {
575 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
576 HOSTAPD_LEVEL_DEBUG, "could not find VLAN for "
577 "binding station to (vlan_id=%d)",
580 } else if (sta->vlan_id > 0 && vlan->vlan_id == VLAN_ID_WILDCARD) {
581 vlan = vlan_add_dynamic(hapd, vlan, sta->vlan_id);
583 hostapd_logger(hapd, sta->addr,
584 HOSTAPD_MODULE_IEEE80211,
585 HOSTAPD_LEVEL_DEBUG, "could not add "
586 "dynamic VLAN interface for vlan_id=%d",
591 iface = vlan->ifname;
592 if (vlan_setup_encryption_dyn(hapd, sta->ssid, iface) != 0) {
593 hostapd_logger(hapd, sta->addr,
594 HOSTAPD_MODULE_IEEE80211,
595 HOSTAPD_LEVEL_DEBUG, "could not "
596 "configure encryption for dynamic VLAN "
597 "interface for vlan_id=%d",
601 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
602 HOSTAPD_LEVEL_DEBUG, "added new dynamic VLAN "
603 "interface '%s'", iface);
604 } else if (vlan && vlan->vlan_id == sta->vlan_id) {
605 if (sta->vlan_id > 0) {
606 vlan->dynamic_vlan++;
607 hostapd_logger(hapd, sta->addr,
608 HOSTAPD_MODULE_IEEE80211,
609 HOSTAPD_LEVEL_DEBUG, "updated existing "
610 "dynamic VLAN interface '%s'", iface);
614 * Update encryption configuration for statically generated
615 * VLAN interface. This is only used for static WEP
616 * configuration for the case where hostapd did not yet know
617 * which keys are to be used when the interface was added.
619 if (vlan_setup_encryption_dyn(hapd, sta->ssid, iface) != 0) {
620 hostapd_logger(hapd, sta->addr,
621 HOSTAPD_MODULE_IEEE80211,
622 HOSTAPD_LEVEL_DEBUG, "could not "
623 "configure encryption for VLAN "
624 "interface for vlan_id=%d",
629 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
630 HOSTAPD_LEVEL_DEBUG, "binding station to interface "
633 if (wpa_auth_sta_set_vlan(sta->wpa_sm, sta->vlan_id) < 0)
634 wpa_printf(MSG_INFO, "Failed to update VLAN-ID for WPA");
636 return hapd->drv.set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
637 #else /* CONFIG_NO_VLAN */
639 #endif /* CONFIG_NO_VLAN */
643 #ifdef CONFIG_IEEE80211W
645 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta)
648 struct os_time now, passed;
650 os_time_sub(&now, &sta->sa_query_start, &passed);
651 tu = (passed.sec * 1000000 + passed.usec) / 1024;
652 if (hapd->conf->assoc_sa_query_max_timeout < tu) {
653 hostapd_logger(hapd, sta->addr,
654 HOSTAPD_MODULE_IEEE80211,
656 "association SA Query timed out");
657 sta->sa_query_timed_out = 1;
658 os_free(sta->sa_query_trans_id);
659 sta->sa_query_trans_id = NULL;
660 sta->sa_query_count = 0;
661 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
669 static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx)
671 struct hostapd_data *hapd = eloop_ctx;
672 struct sta_info *sta = timeout_ctx;
673 unsigned int timeout, sec, usec;
676 if (sta->sa_query_count > 0 &&
677 ap_check_sa_query_timeout(hapd, sta))
680 nbuf = os_realloc(sta->sa_query_trans_id,
681 (sta->sa_query_count + 1) * WLAN_SA_QUERY_TR_ID_LEN);
684 if (sta->sa_query_count == 0) {
685 /* Starting a new SA Query procedure */
686 os_get_time(&sta->sa_query_start);
688 trans_id = nbuf + sta->sa_query_count * WLAN_SA_QUERY_TR_ID_LEN;
689 sta->sa_query_trans_id = nbuf;
690 sta->sa_query_count++;
692 os_get_random(trans_id, WLAN_SA_QUERY_TR_ID_LEN);
694 timeout = hapd->conf->assoc_sa_query_retry_timeout;
695 sec = ((timeout / 1000) * 1024) / 1000;
696 usec = (timeout % 1000) * 1024;
697 eloop_register_timeout(sec, usec, ap_sa_query_timer, hapd, sta);
699 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
701 "association SA Query attempt %d", sta->sa_query_count);
704 ieee802_11_send_sa_query_req(hapd, sta->addr, trans_id);
705 #endif /* NEED_AP_MLME */
709 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
711 ap_sa_query_timer(hapd, sta);
715 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
717 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
718 os_free(sta->sa_query_trans_id);
719 sta->sa_query_trans_id = NULL;
720 sta->sa_query_count = 0;
723 #endif /* CONFIG_IEEE80211W */
726 void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
727 const u8 *addr, u16 reason)
730 if (sta == NULL && addr)
731 sta = ap_get_sta(hapd, addr);
734 hapd->drv.sta_deauth(hapd, addr, reason);
738 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_AUTHORIZED);
739 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
740 eloop_register_timeout(0, 0, ap_handle_timer, hapd, sta);
741 sta->timeout_next = STA_REMOVE;