Home | History | Annotate | Download | only in ap

Lines Matching defs:hapd

36 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
44 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta);
46 int ap_for_each_sta(struct hostapd_data *hapd,
47 int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
53 for (sta = hapd->sta_list; sta; sta = sta->next) {
54 if (cb(hapd, sta, ctx))
62 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta)
66 s = hapd->sta_hash[STA_HASH(sta)];
74 struct sta_info * ap_get_sta_p2p(struct hostapd_data *hapd, const u8 *addr)
78 for (sta = hapd->sta_list; sta; sta = sta->next) {
97 static void ap_sta_list_del(struct hostapd_data *hapd, struct sta_info *sta)
101 if (hapd->sta_list == sta) {
102 hapd->sta_list = sta->next;
106 tmp = hapd->sta_list;
117 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta)
119 sta->hnext = hapd->sta_hash[STA_HASH(sta->addr)];
120 hapd->sta_hash[STA_HASH(sta->addr)] = sta;
124 static void ap_sta_hash_del(struct hostapd_data *hapd, struct sta_info *sta)
128 s = hapd->sta_hash[STA_HASH(sta->addr)];
131 hapd->sta_hash[STA_HASH(sta->addr)] = s->hnext;
146 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
150 accounting_sta_stop(hapd, sta);
153 ap_sta_set_authorized(hapd, sta, 0);
156 hostapd_set_wds_sta(hapd, NULL, sta->addr, sta->aid, 0);
159 hostapd_drv_sta_remove(hapd, sta->addr);
161 ap_sta_hash_del(hapd, sta);
162 ap_sta_list_del(hapd, sta);
165 hapd->sta_aid[(sta->aid - 1) / 32] &=
168 hapd->num_sta--;
171 hapd->iface->num_sta_non_erp--;
172 if (hapd->iface->num_sta_non_erp == 0)
178 hapd->iface->num_sta_no_short_slot_time--;
179 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
180 && hapd->iface->num_sta_no_short_slot_time == 0)
186 hapd->iface->num_sta_no_short_preamble--;
187 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
188 && hapd->iface->num_sta_no_short_preamble == 0)
194 hapd->iface->num_sta_ht_no_gf--;
199 hapd->iface->num_sta_no_ht--;
204 hapd->iface->num_sta_ht_20mhz--;
210 hapd->num_sta_no_p2p--;
211 if (hapd->num_sta_no_p2p == 0)
212 hostapd_p2p_non_p2p_sta_disconnected(hapd);
217 if (hostapd_ht_operation_update(hapd->iface) > 0)
222 ieee802_11_set_beacons(hapd->iface);
226 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
227 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
228 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta);
229 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta);
233 rsn_preauth_free_station(hapd, sta);
235 radius_client_flush_auth(hapd->radius, sta->addr);
243 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
247 p2p_group_notif_disassoc(hapd->p2p_group, sta->addr);
277 void hostapd_free_stas(struct hostapd_data *hapd)
281 sta = hapd->sta_list;
287 hapd, sta, WLAN_REASON_UNSPECIFIED);
292 ap_free_sta(hapd, prev);
307 struct hostapd_data *hapd = eloop_ctx;
316 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
319 ap_free_sta(hapd, sta);
333 inactive_sec = hostapd_drv_get_inact_sec(hapd, sta->addr);
335 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
344 next_time = hapd->conf->ap_max_inactivity + fuzz;
345 } else if (inactive_sec < hapd->conf->ap_max_inactivity &&
348 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
352 next_time = hapd->conf->ap_max_inactivity + fuzz -
355 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
359 hapd->conf->ap_max_inactivity);
361 if (hapd->conf->skip_inactivity_poll)
369 !hapd->conf->skip_inactivity_poll) {
370 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR
375 next_time = hapd->conf->ap_max_inactivity;
382 eloop_register_timeout(next_time, 0, ap_handle_timer, hapd,
391 hostapd_drv_poll_client(hapd, hapd->own_addr, sta->addr,
396 wpa_dbg(hapd->msg_ctx, MSG_DEBUG,
403 hapd, sta->addr,
410 hostapd_drv_sta_disassoc(hapd, sta->addr, reason);
421 hapd, sta);
425 ap_sta_set_authorized(hapd, sta, 0);
431 accounting_sta_stop(hapd, sta);
433 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
444 hapd, sta);
445 mlme_disassociate_indication(hapd, sta, reason);
449 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
456 hapd, sta,
458 ap_free_sta(hapd, sta);
466 struct hostapd_data *hapd = eloop_ctx;
474 ap_free_sta(hapd, sta);
479 mlme_deauthenticate_indication(hapd, sta,
481 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
487 ap_free_sta(hapd, sta);
488 hostapd_drv_sta_deauth(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
492 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
495 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
498 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
500 hapd, sta);
504 void ap_sta_no_session_timeout(struct hostapd_data *hapd, struct sta_info *sta)
506 eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
510 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
514 sta = ap_get_sta(hapd, addr);
519 if (hapd->num_sta >= hapd->conf->max_num_sta) {
522 hapd->num_sta, hapd->conf->max_num_sta);
531 sta->acct_interim_interval = hapd->conf->acct_interim_interval;
532 accounting_sta_get_id(hapd, sta);
538 hapd->conf->ap_max_inactivity);
539 eloop_register_timeout(hapd->conf->ap_max_inactivity, 0,
540 ap_handle_timer, hapd, sta);
542 sta->next = hapd->sta_list;
543 hapd->sta_list = sta;
544 hapd->num_sta++;
545 ap_sta_hash_add(hapd, sta);
546 sta->ssid = &hapd->conf->ssid;
547 ap_sta_remove_in_other_bss(hapd, sta);
553 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta)
559 if (hostapd_drv_sta_remove(hapd, sta->addr) &&
569 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
572 struct hostapd_iface *iface = hapd->iface;
582 if (bss == hapd || bss == NULL)
596 struct hostapd_data *hapd = eloop_ctx;
599 ap_sta_remove(hapd, sta);
600 mlme_disassociate_indication(hapd, sta, sta->disassoc_reason);
604 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
608 hapd->conf->iface, MAC2STR(sta->addr));
610 ap_sta_set_authorized(hapd, sta, 0);
617 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
619 ap_handle_timer, hapd, sta);
620 accounting_sta_stop(hapd, sta);
625 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta);
626 eloop_register_timeout(hapd->iface->drv_flags &
628 ap_sta_disassoc_cb_timeout, hapd, sta);
634 struct hostapd_data *hapd = eloop_ctx;
637 ap_sta_remove(hapd, sta);
638 mlme_deauthenticate_indication(hapd, sta, sta->deauth_reason);
642 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
646 hapd->conf->iface, MAC2STR(sta->addr));
648 ap_sta_set_authorized(hapd, sta, 0);
655 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
657 ap_handle_timer, hapd, sta);
658 accounting_sta_stop(hapd, sta);
663 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta);
664 eloop_register_timeout(hapd->iface->drv_flags &
666 ap_sta_deauth_cb_timeout, hapd, sta);
671 int ap_sta_wps_cancel(struct hostapd_data *hapd,
675 ap_sta_deauthenticate(hapd, sta,
687 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
707 vlan_remove_dynamic(hapd, old_vlanid);
709 iface = hapd->conf->iface;
717 vlan = hapd->conf->vlan;
732 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
738 vlan = vlan_add_dynamic(hapd, vlan, sta->vlan_id);
740 hostapd_logger(hapd, sta->addr,
749 if (vlan_setup_encryption_dyn(hapd, sta->ssid, iface) != 0) {
750 hostapd_logger(hapd, sta->addr,
758 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
764 hostapd_logger(hapd, sta->addr,
776 if (vlan_setup_encryption_dyn(hapd, sta->ssid, iface) != 0) {
777 hostapd_logger(hapd, sta->addr,
786 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
793 ret = hostapd_drv_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
795 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
808 int ap_check_sa_query_timeout(struct hostapd_data *hapd, struct sta_info *sta)
815 if (hapd->conf->assoc_sa_query_max_timeout < tu) {
816 hostapd_logger(hapd, sta->addr,
824 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
834 struct hostapd_data *hapd = eloop_ctx;
840 ap_check_sa_query_timeout(hapd, sta))
858 timeout = hapd->conf->assoc_sa_query_retry_timeout;
861 eloop_register_timeout(sec, usec, ap_sa_query_timer, hapd, sta);
863 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
867 ieee802_11_send_sa_query_req(hapd, sta->addr, trans_id);
871 void ap_sta_start_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
873 ap_sa_query_timer(hapd, sta);
877 void ap_sta_stop_sa_query(struct hostapd_data *hapd, struct sta_info *sta)
879 eloop_cancel_timeout(ap_sa_query_timer, hapd, sta);
888 void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
901 if (hapd->p2p_group == NULL) {
906 dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr);
916 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s", buf);
918 if (hapd->msg_ctx_parent &&
919 hapd->msg_ctx_parent != hapd->msg_ctx)
920 wpa_msg_no_global(hapd->msg_ctx_parent, MSG_INFO,
925 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);
927 if (hapd->msg_ctx_parent &&
928 hapd->msg_ctx_parent != hapd->msg_ctx)
929 wpa_msg_no_global(hapd->msg_ctx_parent, MSG_INFO,
935 if (hapd->sta_authorized_cb)
936 hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,
941 void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
946 sta = ap_get_sta(hapd, addr);
949 hostapd_drv_sta_deauth(hapd, addr, reason);
953 ap_sta_set_authorized(hapd, sta, 0);
962 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
964 ap_handle_timer, hapd, sta);
969 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta);
970 eloop_register_timeout(hapd->iface->drv_flags &
972 ap_sta_deauth_cb_timeout, hapd, sta);
976 void ap_sta_deauth_cb(struct hostapd_data *hapd, struct sta_info *sta)
983 eloop_cancel_timeout(ap_sta_deauth_cb_timeout, hapd, sta);
984 ap_sta_deauth_cb_timeout(hapd, sta);
988 void ap_sta_disassoc_cb(struct hostapd_data *hapd, struct sta_info *sta)
995 eloop_cancel_timeout(ap_sta_disassoc_cb_timeout, hapd, sta);
996 ap_sta_disassoc_cb_timeout(hapd, sta);