Home | History | Annotate | Download | only in ap

Lines Matching refs:hapd

41 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
50 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta);
53 int ap_for_each_sta(struct hostapd_data *hapd,
54 int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
60 for (sta = hapd->sta_list; sta; sta = sta->next) {
61 if (cb(hapd, sta, ctx))
69 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta)
73 s = hapd->sta_hash[STA_HASH(sta)];
81 struct sta_info * ap_get_sta_p2p(struct hostapd_data *hapd, const u8 *addr)
85 for (sta = hapd->sta_list; sta; sta = sta->next) {
104 static void ap_sta_list_del(struct hostapd_data *hapd, struct sta_info *sta)
108 if (hapd->sta_list == sta) {
109 hapd->sta_list = sta->next;
113 tmp = hapd->sta_list;
124 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta)
126 sta->hnext = hapd->sta_hash[STA_HASH(sta->addr)];
127 hapd->sta_hash[STA_HASH(sta->addr)] = sta;
131 static void ap_sta_hash_del(struct hostapd_data *hapd, struct sta_info *sta)
135 s = hapd->sta_hash[STA_HASH(sta->addr)];
138 hapd->sta_hash[STA_HASH(sta->addr)] = s->hnext;
153 void ap_sta_ip6addr_del(struct hostapd_data *hapd, struct sta_info *sta)
155 sta_ip6addr_del(hapd, sta);
159 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
163 accounting_sta_stop(hapd, sta);
166 ap_sta_set_authorized(hapd, sta, 0);
169 hostapd_set_wds_sta(hapd, NULL, sta->addr, sta->aid, 0);
172 hostapd_drv_br_delete_ip_neigh(hapd, 4, (u8 *) &sta->ipaddr);
173 ap_sta_ip6addr_del(hapd, sta);
175 if (!hapd->iface->driver_ap_teardown &&
177 hostapd_drv_sta_remove(hapd, sta->addr);
181 ap_sta_hash_del(hapd, sta);
182 ap_sta_list_del(hapd, sta);
185 hapd->sta_aid[(sta->aid - 1) / 32] &=
188 hapd->num_sta--;
191 hapd->iface->num_sta_non_erp--;
192 if (hapd->iface->num_sta_non_erp == 0)
198 hapd->iface->num_sta_no_short_slot_time--;
199 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
200 && hapd->iface->num_sta_no_short_slot_time == 0)
206 hapd->iface->num_sta_no_short_preamble--;
207 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
208 && hapd->iface->num_sta_no_short_preamble == 0)
214 hapd->iface->num_sta_ht_no_gf--;
219 hapd->iface->num_sta_no_ht--;
224 hapd->iface->num_sta_ht_20mhz--;
235 ht40_intolerant_remove(hapd->iface, sta);
241 hapd->num_sta_no_p2p--;
242 if (hapd->num_sta_no_p2p == 0)
243 hostapd_p2p_non_p2p_sta_disconnected(hapd);
248 if (hostapd_ht_operation_update(hapd->iface) > 0)
253 if (hapd->mesh_sta_free_cb)
254 hapd->mesh_sta_free_cb(hapd, sta);
258 ieee802_11_set_beacons(hapd->iface);
262 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
263 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
264 eloop_cancel_timeout(ap_handle_session_warning_timer, hapd, sta);
265 ap_sta_clear_disconnect_timeouts(hapd, sta);
266 sae_clear_retransmit_timer(hapd, sta);
268 ieee802_1x_free_station(hapd, sta);
270 rsn_preauth_free_station(hapd, sta);
272 if (hapd->radius)
273 radius_client_flush_auth(hapd->radius, sta->addr);
283 vlan_remove_dynamic(hapd, sta->vlan_id);
289 if (hapd->iface->driver_ap_teardown &&
291 hostapd_drv_sta_remove(hapd, sta->addr);
294 vlan_remove_dynamic(hapd, sta->vlan_id_bound);
302 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
306 p2p_group_notif_disassoc(hapd->p2p_group, sta->addr);
346 eloop_cancel_timeout(fils_hlp_timeout, hapd, sta);
353 void hostapd_free_stas(struct hostapd_data *hapd)
357 sta = hapd->sta_list;
363 hapd, sta, WLAN_REASON_UNSPECIFIED);
368 ap_free_sta(hapd, prev);
383 struct hostapd_data *hapd = eloop_ctx;
389 hapd->conf->iface, __func__, MAC2STR(sta->addr), sta->flags,
392 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
395 ap_free_sta(hapd, sta);
409 inactive_sec = hostapd_drv_get_inact_sec(hapd, sta->addr);
411 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
420 next_time = hapd->conf->ap_max_inactivity + fuzz;
422 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
429 } else if (inactive_sec < hapd->conf->ap_max_inactivity) {
431 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
435 next_time = hapd->conf->ap_max_inactivity + fuzz -
438 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
442 hapd->conf->ap_max_inactivity);
444 if (hapd->conf->skip_inactivity_poll)
452 !hapd->conf->skip_inactivity_poll) {
453 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR
458 next_time = hapd->conf->ap_max_inactivity;
466 eloop_register_timeout(next_time, 0, ap_handle_timer, hapd,
475 hostapd_drv_poll_client(hapd, hapd->own_addr, sta->addr,
480 wpa_dbg(hapd->msg_ctx, MSG_DEBUG,
487 hapd, sta->addr,
494 hostapd_drv_sta_disassoc(hapd, sta->addr, reason);
505 hapd, sta);
509 ap_sta_set_authorized(hapd, sta, 0);
515 accounting_sta_stop(hapd, sta);
516 ieee802_1x_free_station(hapd, sta);
517 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
528 hapd, sta);
529 mlme_disassociate_indication(hapd, sta, reason);
533 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
540 hapd, sta,
542 ap_free_sta(hapd, sta);
550 struct hostapd_data *hapd = eloop_ctx;
554 hapd->conf->iface, MAC2STR(sta->addr));
559 ap_free_sta(hapd, sta);
564 hostapd_drv_sta_deauth(hapd, sta->addr,
566 mlme_deauthenticate_indication(hapd, sta,
568 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
573 ap_free_sta(hapd, sta);
577 void ap_sta_replenish_timeout(struct hostapd_data *hapd, struct sta_info *sta,
581 ap_handle_session_timer, hapd, sta) == 1) {
582 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
589 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
592 hostapd_logger(hapd
595 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
597 hapd, sta);
601 void ap_sta_no_session_timeout(struct hostapd_data *hapd, struct sta_info *sta)
603 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
610 struct hostapd_data *hapd = eloop_ctx;
614 MACSTR, hapd->conf->iface, MAC2STR(sta->addr));
618 wnm_send_ess_disassoc_imminent(hapd, sta, sta->hs20_session_info_url,
624 void ap_sta_session_warning_timeout(struct hostapd_data *hapd,
627 eloop_cancel_timeout(ap_handle_session_warning_timer, hapd, sta);
629 hapd, sta);
633 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
637 sta = ap_get_sta(hapd, addr);
642 if (hapd->num_sta >= hapd->conf->max_num_sta) {
645 hapd->num_sta, hapd->conf->max_num_sta);
654 sta->acct_interim_interval = hapd->conf->acct_interim_interval;
655 if (accounting_sta_get_id(hapd, sta) < 0) {
660 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER)) {
664 hapd->conf->ap_max_inactivity);
665 eloop_register_timeout(hapd->conf->ap_max_inactivity, 0,
666 ap_handle_timer, hapd, sta);
671 sta->next = hapd->sta_list;
672 hapd->sta_list = sta;
673 hapd->num_sta++;
674 ap_sta_hash_add(hapd, sta);
675 ap_sta_remove_in_other_bss(hapd, sta);
680 sta_track_claim_taxonomy_info(hapd->iface, addr,
688 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta)
693 hostapd_drv_br_delete_ip_neigh(hapd, 4, (u8 *) &sta->ipaddr);
694 ap_sta_ip6addr_del(hapd, sta);
697 hapd->conf->iface, MAC2STR(sta->addr));
698 if (hostapd_drv_sta_remove(hapd, sta->addr) &&
702 hapd->conf->iface, MAC2STR(sta->addr));
710 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
713 struct hostapd_iface *iface = hapd->iface;
723 if (bss == hapd || bss == NULL)
731 hapd->conf->iface, MAC2STR(sta2->addr),
741 struct hostapd_data *hapd = eloop_ctx;
745 hapd->conf->iface, MAC2STR(sta->addr));
746 ap_sta_remove(hapd, sta);
747 mlme_disassociate_indication(hapd, sta, sta->disassoc_reason);
751 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
755 hapd->conf->iface, MAC2STR(sta->addr));
757 if (hapd->iface->current_mode &&
758 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AD) {
767 ap_sta_set_authorized(hapd, sta, 0);
773 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
775 ap_handle_timer, hapd, sta);
776 accounting_sta_stop(hapd, sta);
777 ieee802_1x_free_station(hapd, sta);
781 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta);
782 eloop_register_timeout(hapd->iface->drv_flags &
784 ap_sta_disassoc_cb_timeout, hapd, sta);
790 struct hostapd_data *hapd = eloop_ctx;
794 hapd->conf->iface, MAC2STR(sta->addr));
795 ap_sta_remove(hapd, sta);
796 mlme_deauthenticate_indication(hapd, sta, sta->deauth_reason);
800 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
803 if (hapd->iface->current_mode &&
804 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AD) {
807 ap_sta_disassociate(hapd, sta, reason);
812 hapd->conf->iface, MAC2STR(sta->addr));
815 ap_sta_set_authorized(hapd, sta, 0);
822 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
824 ap_handle_timer, hapd, sta);
825 accounting_sta_stop(hapd, sta);
826 ieee802_1x_free_station(hapd, sta);
830 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta);
831 eloop_register_timeout(hapd->iface->drv_flags &
833 ap_sta_deauth_cb_timeout, hapd, sta);
838 int ap_sta_wps_cancel(struct hostapd_data *hapd,
842 ap_sta_deauthenticate(hapd, sta,
854 static int ap_sta_get_free_vlan_id(struct hostapd_data *hapd)
860 for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
870 int ap_sta_set_vlan(struct hostapd_data *hapd, struct sta_info *sta,
876 if (hapd->conf->ssid.dynamic_vlan == DYNAMIC_VLAN_DISABLED)
880 if (hapd->conf->ssid.per_sta_vif && !sta->vlan_id) {
882 } else if (hapd->conf->ssid.dynamic_vlan == DYNAMIC_VLAN_DISABLED &&
883 !hapd->conf->ssid.per_sta_vif && sta->vlan_id) {
890 if (hapd->conf->ssid.per_sta_vif) {
893 vlan_id = ap_sta_get_free_vlan_id(hapd);
895 for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
900 hostapd_logger(hapd, sta->addr,
909 for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
922 vlan_id = ap_sta_get_free_vlan_id(hapd);
925 hostapd_logger(hapd, sta->addr,
938 vlan = vlan_add_dynamic(hapd, vlan, vlan_id, vlan_desc);
940 hostapd_logger(hapd, sta->addr,
952 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
958 hostapd_logger(hapd, sta->addr,
970 vlan_remove_dynamic(hapd, old_vlan_id);
976 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta)
984 iface = hapd->conf->iface;
985 if (hapd->conf->ssid.vlan[0])
986 iface = hapd->conf->ssid.vlan;
989 for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
1006 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1014 hostapd_logger(hapd, sta->addr,
1025 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1032 ret = hostapd_drv_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
1034 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1041 vlan_remove_dynamic(hapd, old_vlanid);
1053 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta)
1060 if (hapd->conf->assoc_sa_query_max_timeout < tu) {
1061 hostapd_logger(hapd, sta->addr,
1069 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
1079 struct hostapd_data *hapd = eloop_ctx;
1086 hapd->conf->iface, MAC2STR(sta->addr), sta->sa_query_count);
1089 ap_check_sa_query_timeout(hapd, sta))
1115 timeout = hapd->conf->assoc_sa_query_retry_timeout;
1118 eloop_register_timeout(sec, usec, ap_sa_query_timer, hapd, sta);
1120 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1124 ieee802_11_send_sa_query_req(hapd, sta->addr, trans_id);
1128 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
1130 ap_sa_query_timer(hapd, sta);
1134 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
1136 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
1145 void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
1164 if (hapd->p2p_group == NULL) {
1169 dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr);
1178 if (hapd->sta_authorized_cb)
1179 hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,
1194 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s",
1197 if (hapd->msg_ctx_parent &&
1198 hapd->msg_ctx_parent != hapd->msg_ctx)
1199 wpa_msg_no_global(hapd->msg_ctx_parent, MSG_INFO,
1203 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);
1205 if (hapd->msg_ctx_parent &&
1206 hapd->msg_ctx_parent != hapd->msg_ctx)
1207 wpa_msg_no_global(hapd->msg_ctx_parent, MSG_INFO,
1212 if (hapd->iface->fst) {
1214 fst_notify_peer_connected(hapd->iface->fst, sta->addr);
1216 fst_notify_peer_disconnected(hapd->iface->fst,
1223 void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
1228 hapd->conf->iface, __func__, MAC2STR(sta->addr),
1232 hapd->conf->iface, __func__, MAC2STR(addr),
1236 sta = ap_get_sta(hapd, addr);
1239 hostapd_drv_sta_deauth(hapd, addr, reason);
1243 ap_sta_set_authorized(hapd, sta, 0);
1250 hapd->conf->iface, __func__, MAC2STR(sta->addr),
1252 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
1254 ap_handle_timer, hapd, sta);
1257 if (hapd->iface->current_mode &&
1258 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AD) {
1263 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta);
1264 eloop_register_timeout(hapd->iface->drv_flags &
1267 hapd, sta);
1273 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta);
1274 eloop_register_timeout(hapd->iface->drv_flags &
1276 ap_sta_deauth_cb_timeout, hapd, sta);
1280 void ap_sta_deauth_cb(struct hostapd_data *hapd, struct sta_info *sta)
1287 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta);
1288 ap_sta_deauth_cb_timeout(hapd, sta);
1292 void ap_sta_disassoc_cb(struct hostapd_data *hapd, struct sta_info *sta)
1299 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta);
1300 ap_sta_disassoc_cb_timeout(hapd, sta);
1304 void ap_sta_clear_disconnect_timeouts(struct hostapd_data *hapd,
1307 if (eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta) > 0)
1311 hapd->conf->iface, MAC2STR(sta->addr));
1312 if (eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta) > 0)
1316 hapd->conf->iface, MAC2STR(sta->addr));
1317 if (eloop_cancel_timeout(ap_sta_delayed_1x_auth_fail_cb, hapd, sta) > 0)
1322 hapd->conf->iface, MAC2STR(sta->addr));
1324 hostapd_wps_eap_completed(hapd);
1364 struct hostapd_data *hapd = eloop_ctx;
1367 wpa_dbg(hapd->msg_ctx, MSG_DEBUG,
1371 ap_sta_disconnect(hapd, sta, sta->addr,
1374 hostapd_wps_eap_completed(hapd);
1378 void ap_sta_delayed_1x_auth_fail_disconnect(struct hostapd_data *hapd,
1381 wpa_dbg(hapd->msg_ctx, MSG_DEBUG,
1390 eloop_cancel_timeout(ap_sta_delayed_1x_auth_fail_cb, hapd, sta);
1392 hapd, sta);
1396 int ap_sta_pending_delayed_1x_auth_fail_disconnect(struct hostapd_data *hapd,
1400 hapd, sta);