Lines Matching full:hapd
40 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
49 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta);
51 int ap_for_each_sta(struct hostapd_data *hapd,
52 int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
58 for (sta = hapd->sta_list; sta; sta = sta->next) {
59 if (cb(hapd, sta, ctx))
67 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta)
71 s = hapd->sta_hash[STA_HASH(sta)];
79 struct sta_info * ap_get_sta_p2p(struct hostapd_data *hapd, const u8 *addr)
83 for (sta = hapd->sta_list; sta; sta = sta->next) {
102 static void ap_sta_list_del(struct hostapd_data *hapd, struct sta_info *sta)
106 if (hapd->sta_list == sta) {
107 hapd->sta_list = sta->next;
111 tmp = hapd->sta_list;
122 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta)
124 sta->hnext = hapd->sta_hash[STA_HASH(sta->addr)];
125 hapd->sta_hash[STA_HASH(sta->addr)] = sta;
129 static void ap_sta_hash_del(struct hostapd_data *hapd, struct sta_info *sta)
133 s = hapd->sta_hash[STA_HASH(sta->addr)];
136 hapd->sta_hash[STA_HASH(sta->addr)] = s->hnext;
151 void ap_sta_ip6addr_del(struct hostapd_data *hapd, struct sta_info *sta)
153 sta_ip6addr_del(hapd, sta);
157 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
161 accounting_sta_stop(hapd, sta);
164 ap_sta_set_authorized(hapd, sta, 0);
167 hostapd_set_wds_sta(hapd, NULL, sta->addr, sta->aid, 0);
170 hostapd_drv_br_delete_ip_neigh(hapd, 4, (u8 *) &sta->ipaddr);
171 ap_sta_ip6addr_del(hapd, sta);
173 if (!hapd->iface->driver_ap_teardown &&
175 hostapd_drv_sta_remove(hapd, sta->addr);
179 ap_sta_hash_del(hapd, sta);
180 ap_sta_list_del(hapd, sta);
183 hapd->sta_aid[(sta->aid - 1) / 32] &=
186 hapd->num_sta--;
189 hapd->iface->num_sta_non_erp--;
190 if (hapd->iface->num_sta_non_erp == 0)
196 hapd->iface->num_sta_no_short_slot_time--;
197 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
198 && hapd->iface->num_sta_no_short_slot_time == 0)
204 hapd->iface->num_sta_no_short_preamble--;
205 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
206 && hapd->iface->num_sta_no_short_preamble == 0)
212 hapd->iface->num_sta_ht_no_gf--;
217 hapd->iface->num_sta_no_ht--;
222 hapd->iface->num_sta_ht_20mhz--;
226 ht40_intolerant_remove(hapd->iface, sta);
232 hapd->num_sta_no_p2p--;
233 if (hapd->num_sta_no_p2p == 0)
234 hostapd_p2p_non_p2p_sta_disconnected(hapd);
239 if (hostapd_ht_operation_update(hapd->iface) > 0)
244 if (hapd->mesh_sta_free_cb)
245 hapd->mesh_sta_free_cb(hapd, sta);
249 ieee802_11_set_beacons(hapd->iface);
253 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
254 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
255 eloop_cancel_timeout(ap_handle_session_warning_timer, hapd, sta);
256 ap_sta_clear_disconnect_timeouts(hapd, sta);
257 sae_clear_retransmit_timer(hapd, sta);
259 ieee802_1x_free_station(hapd, sta);
261 rsn_preauth_free_station(hapd, sta);
263 if (hapd->radius)
264 radius_client_flush_auth(hapd->radius, sta->addr);
274 vlan_remove_dynamic(hapd, sta->vlan_id);
280 if (hapd->iface->driver_ap_teardown &&
282 hostapd_drv_sta_remove(hapd, sta->addr);
285 vlan_remove_dynamic(hapd, sta->vlan_id_bound);
293 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
297 p2p_group_notif_disassoc(hapd->p2p_group, sta->addr);
337 void hostapd_free_stas(struct hostapd_data *hapd)
341 sta = hapd->sta_list;
347 hapd, sta, WLAN_REASON_UNSPECIFIED);
352 ap_free_sta(hapd, prev);
367 struct hostapd_data *hapd = eloop_ctx;
373 hapd->conf->iface, __func__, MAC2STR(sta->addr), sta->flags,
376 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
379 ap_free_sta(hapd, sta);
393 inactive_sec = hostapd_drv_get_inact_sec(hapd, sta->addr);
395 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
404 next_time = hapd->conf->ap_max_inactivity + fuzz;
406 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
413 } else if (inactive_sec < hapd->conf->ap_max_inactivity) {
415 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
419 next_time = hapd->conf->ap_max_inactivity + fuzz -
422 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
426 hapd->conf->ap_max_inactivity);
428 if (hapd->conf->skip_inactivity_poll)
436 !hapd->conf->skip_inactivity_poll) {
437 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR
442 next_time = hapd->conf->ap_max_inactivity;
450 eloop_register_timeout(next_time, 0, ap_handle_timer, hapd,
459 hostapd_drv_poll_client(hapd, hapd->own_addr, sta->addr,
464 wpa_dbg(hapd->msg_ctx, MSG_DEBUG,
471 hapd, sta->addr,
478 hostapd_drv_sta_disassoc(hapd, sta->addr, reason);
489 hapd, sta);
493 ap_sta_set_authorized(hapd, sta, 0);
499 accounting_sta_stop(hapd, sta);
500 ieee802_1x_free_station(hapd, sta);
501 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
512 hapd, sta);
513 mlme_disassociate_indication(hapd, sta, reason);
517 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
524 hapd, sta,
526 ap_free_sta(hapd, sta);
534 struct hostapd_data *hapd = eloop_ctx;
538 hapd->conf->iface, MAC2STR(sta->addr));
543 ap_free_sta(hapd, sta);
548 hostapd_drv_sta_deauth(hapd, sta->addr,
550 mlme_deauthenticate_indication(hapd, sta,
552 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
557 ap_free_sta(hapd, sta);
561 void ap_sta_replenish_timeout(struct hostapd_data *hapd, struct sta_info *sta,
565 ap_handle_session_timer, hapd, sta) == 1) {
566 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
573 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
576 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
579 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
581 hapd, sta);
585 void ap_sta_no_session_timeout(struct hostapd_data *hapd, struct sta_info *sta)
587 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
594 struct hostapd_data *hapd = eloop_ctx;
598 MACSTR, hapd->conf->iface, MAC2STR(sta->addr));
602 wnm_send_ess_disassoc_imminent(hapd, sta, sta->hs20_session_info_url,
608 void ap_sta_session_warning_timeout(struct hostapd_data *hapd,
611 eloop_cancel_timeout(ap_handle_session_warning_timer, hapd, sta);
613 hapd, sta);
617 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
621 sta = ap_get_sta(hapd, addr);
626 if (hapd->num_sta >= hapd->conf->max_num_sta) {
629 hapd->num_sta, hapd->conf->max_num_sta);
638 sta->acct_interim_interval = hapd->conf->acct_interim_interval;
639 if (accounting_sta_get_id(hapd, sta) < 0) {
644 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER)) {
648 hapd->conf->ap_max_inactivity);
649 eloop_register_timeout(hapd->conf->ap_max_inactivity, 0,
650 ap_handle_timer, hapd, sta);
655 sta->next = hapd->sta_list;
656 hapd->sta_list = sta;
657 hapd->num_sta++;
658 ap_sta_hash_add(hapd, sta);
659 ap_sta_remove_in_other_bss(hapd, sta);
667 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta)
672 hostapd_drv_br_delete_ip_neigh(hapd, 4, (u8 *) &sta->ipaddr);
673 ap_sta_ip6addr_del(hapd, sta);
676 hapd->conf->iface, MAC2STR(sta->addr));
677 if (hostapd_drv_sta_remove(hapd, sta->addr) &&
681 hapd->conf->iface, MAC2STR(sta->addr));
689 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
692 struct hostapd_iface *iface = hapd->iface;
702 if (bss == hapd || bss == NULL)
710 hapd->conf->iface, MAC2STR(sta2->addr),
720 struct hostapd_data *hapd = eloop_ctx;
724 hapd->conf->iface, MAC2STR(sta->addr));
725 ap_sta_remove(hapd, sta);
726 mlme_disassociate_indication(hapd, sta, sta->disassoc_reason);
730 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
734 hapd->conf->iface, MAC2STR(sta->addr));
737 ap_sta_set_authorized(hapd, sta, 0);
744 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
746 ap_handle_timer, hapd, sta);
747 accounting_sta_stop(hapd, sta);
748 ieee802_1x_free_station(hapd, sta);
752 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta);
753 eloop_register_timeout(hapd->iface->drv_flags &
755 ap_sta_disassoc_cb_timeout, hapd, sta);
761 struct hostapd_data *hapd = eloop_ctx;
765 hapd->conf->iface, MAC2STR(sta->addr));
766 ap_sta_remove(hapd, sta);
767 mlme_deauthenticate_indication(hapd, sta, sta->deauth_reason);
771 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
775 hapd->conf->iface, MAC2STR(sta->addr));
778 ap_sta_set_authorized(hapd, sta, 0);
785 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
787 ap_handle_timer, hapd, sta);
788 accounting_sta_stop(hapd, sta);
789 ieee802_1x_free_station(hapd, sta);
793 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta);
794 eloop_register_timeout(hapd->iface->drv_flags &
796 ap_sta_deauth_cb_timeout, hapd, sta);
801 int ap_sta_wps_cancel(struct hostapd_data *hapd,
805 ap_sta_deauthenticate(hapd, sta,
817 static int ap_sta_get_free_vlan_id(struct hostapd_data *hapd)
823 for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
833 int ap_sta_set_vlan(struct hostapd_data *hapd, struct sta_info *sta,
839 if (hapd->conf->ssid.dynamic_vlan == DYNAMIC_VLAN_DISABLED)
843 if (hapd->conf->ssid.per_sta_vif && !sta->vlan_id) {
845 } else if (hapd->conf->ssid.dynamic_vlan == DYNAMIC_VLAN_DISABLED &&
846 !hapd->conf->ssid.per_sta_vif && sta->vlan_id) {
853 if (hapd->conf->ssid.per_sta_vif) {
856 vlan_id = ap_sta_get_free_vlan_id(hapd);
858 for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
863 hostapd_logger(hapd, sta->addr,
872 for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
885 vlan_id = ap_sta_get_free_vlan_id(hapd);
888 hostapd_logger(hapd, sta->addr,
901 vlan = vlan_add_dynamic(hapd, vlan, vlan_id, vlan_desc);
903 hostapd_logger(hapd, sta->addr,
915 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
921 hostapd_logger(hapd, sta->addr,
933 vlan_remove_dynamic(hapd, old_vlan_id);
939 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta)
947 iface = hapd->conf->iface;
948 if (hapd->conf->ssid.vlan[0])
949 iface = hapd->conf->ssid.vlan;
952 for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
969 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
977 hostapd_logger(hapd, sta->addr,
988 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
995 ret = hostapd_drv_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
997 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1004 vlan_remove_dynamic(hapd, old_vlanid);
1016 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta)
1023 if (hapd->conf->assoc_sa_query_max_timeout < tu) {
1024 hostapd_logger(hapd, sta->addr,
1032 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
1042 struct hostapd_data *hapd = eloop_ctx;
1049 hapd->conf->iface, MAC2STR(sta->addr), sta->sa_query_count);
1052 ap_check_sa_query_timeout(hapd, sta))
1078 timeout = hapd->conf->assoc_sa_query_retry_timeout;
1081 eloop_register_timeout(sec, usec, ap_sa_query_timer, hapd, sta);
1083 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1087 ieee802_11_send_sa_query_req(hapd, sta->addr, trans_id);
1091 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
1093 ap_sa_query_timer(hapd, sta);
1097 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
1099 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
1108 void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
1127 if (hapd->p2p_group == NULL) {
1132 dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr);
1141 if (hapd->sta_authorized_cb)
1142 hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,
1157 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s",
1160 if (hapd->msg_ctx_parent &&
1161 hapd->msg_ctx_parent != hapd->msg_ctx)
1162 hapd->msg_ctx_parent, MSG_INFO,
1166 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);
1168 if (hapd->msg_ctx_parent &&
1169 hapd->msg_ctx_parent != hapd->msg_ctx)
1170 wpa_msg_no_global(hapd->msg_ctx_parent, MSG_INFO,
1175 if (hapd->iface->fst) {
1177 fst_notify_peer_connected(hapd->iface->fst, sta->addr);
1179 fst_notify_peer_disconnected(hapd->iface->fst,
1186 void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
1191 hapd->conf->iface, __func__, MAC2STR(sta->addr),
1195 hapd->conf->iface, __func__, MAC2STR(addr),
1199 sta = ap_get_sta(hapd, addr);
1202 hostapd_drv_sta_deauth(hapd, addr, reason);
1206 ap_sta_set_authorized(hapd, sta, 0);
1213 hapd->conf->iface, __func__, MAC2STR(sta->addr),
1215 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
1217 ap_handle_timer, hapd, sta);
1222 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta);
1223 eloop_register_timeout(hapd->iface->drv_flags &
1225 ap_sta_deauth_cb_timeout, hapd, sta);
1229 void ap_sta_deauth_cb(struct hostapd_data *hapd, struct sta_info *sta)
1236 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta);
1237 ap_sta_deauth_cb_timeout(hapd, sta);
1241 void ap_sta_disassoc_cb(struct hostapd_data *hapd, struct sta_info *sta)
1248 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta);
1249 ap_sta_disassoc_cb_timeout(hapd, sta);
1253 void ap_sta_clear_disconnect_timeouts(struct hostapd_data *hapd,
1256 if (eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta) > 0)
1260 hapd->conf->iface, MAC2STR(sta->addr));
1261 if (eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta) > 0)
1265 hapd->conf->iface, MAC2STR(sta->addr));