Lines Matching refs:sta

133 u16 hostapd_own_capab_info(struct hostapd_data *hapd, struct sta_info *sta,
153 if (sta) {
155 if (probe && sta->ssid_probe) {
156 policy = sta->ssid_probe->security_policy;
157 def_klen = sta->ssid_probe->wep.default_len;
159 policy = sta->ssid->security_policy;
160 def_klen = sta->ssid->wep.default_len;
194 static u16 auth_shared_key(struct hostapd_data *hapd, struct sta_info *sta,
198 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
204 if (!sta->challenge) {
209 sta->challenge = os_zalloc(WLAN_AUTH_CHALLENGE_LEN);
210 if (sta->challenge == NULL)
218 sta->challenge, WLAN_AUTH_CHALLENGE_LEN);
227 if (!iswep || !sta->challenge || !challenge ||
228 os_memcmp(sta->challenge, challenge, WLAN_AUTH_CHALLENGE_LEN)) {
229 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
236 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
243 sta->flags |= WLAN_STA_AUTH;
244 wpa_auth_sm_event(sta->wpa_sm, WPA_AUTH);
246 os_free(sta->challenge);
247 sta->challenge = NULL;
298 struct sta_info *sta;
306 sta = ap_get_sta(hapd, dst);
307 if (sta == NULL)
312 sta->flags |= WLAN_STA_AUTH;
313 mlme_authenticate_indication(hapd, sta);
321 struct sta_info *sta)
339 struct sta_info *sta)
347 wpabuf_put_le16(buf, sta->sae_send_confirm);
348 sta->sae_send_confirm++;
355 static u16 handle_sae_commit(struct hostapd_data *hapd, struct sta_info *sta,
373 static u16 handle_sae_confirm(struct hostapd_data *hapd, struct sta_info *sta,
389 static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
397 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
400 resp = handle_sae_commit(hapd, sta, mgmt->u.auth.variable,
404 sta->sae_state = SAE_COMMIT;
406 if (sta->sae_state != SAE_COMMIT) {
407 hostapd_logger(hapd, sta->addr,
413 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
416 resp = handle_sae_confirm(hapd, sta, mgmt->u.auth.variable,
420 sta->flags |= WLAN_STA_AUTH;
421 wpa_auth_sm_event(sta->wpa_sm, WPA_AUTH);
422 sta->auth_alg = WLAN_AUTH_SAE;
423 mlme_authenticate_indication(hapd, sta);
426 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
433 sta->auth_alg = WLAN_AUTH_SAE;
437 data = auth_build_sae_commit(hapd, sta);
439 data = auth_build_sae_confirm(hapd, sta);
459 struct sta_info *sta = NULL;
553 sta = ap_sta_add(hapd, mgmt->sa);
554 if (!sta) {
562 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
569 sta->vlan_id = vlan_id;
570 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
571 HOSTAPD_LEVEL_INFO, "VLAN ID %d", sta->vlan_id);
574 hostapd_free_psk_list(sta->psk);
576 sta->psk = psk;
579 sta->psk = NULL;
582 sta->identity = identity;
584 sta->radius_cui = radius_cui;
587 sta->flags &= ~WLAN_STA_PREAUTH;
588 ieee802_1x_notify_pre_auth(sta->eapol_sm, 0);
591 sta->acct_interim_interval = acct_interim_interval;
593 ap_sta_session_timeout(hapd, sta, session_timeout);
595 ap_sta_no_session_timeout(hapd, sta);
599 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
606 sta->flags |= WLAN_STA_AUTH;
607 wpa_auth_sm_event(sta->wpa_sm, WPA_AUTH);
608 sta->auth_alg = WLAN_AUTH_OPEN;
609 mlme_authenticate_indication(hapd, sta);
613 resp = auth_shared_key(hapd, sta, auth_transaction, challenge,
615 sta->auth_alg = WLAN_AUTH_SHARED_KEY;
616 mlme_authenticate_indication(hapd, sta);
617 if (sta->challenge && auth_transaction == 1) {
620 os_memcpy(resp_ies + 2, sta->challenge,
627 sta->auth_alg = WLAN_AUTH_FT;
628 if (sta->wpa_sm == NULL)
629 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
630 sta->addr);
631 if (sta->wpa_sm == NULL) {
637 wpa_ft_process_auth(sta->wpa_sm, mgmt->bssid,
647 handle_auth_sae(hapd, sta, mgmt, len, auth_transaction);
662 static int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta)
667 if (sta->aid > 0) {
668 wpa_printf(MSG_DEBUG, " old AID %d", sta->aid);
688 sta->aid = aid;
690 wpa_printf(MSG_DEBUG, " new AID %d", sta->aid);
695 static u16 check_ssid(struct hostapd_data *hapd, struct sta_info *sta,
705 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
716 static u16 check_wmm(struct hostapd_data *hapd, struct sta_info *sta,
719 sta->flags &= ~WLAN_STA_WMM;
720 sta->qosinfo = 0;
725 hostapd_logger(hapd, sta->addr,
733 sta->flags |= WLAN_STA_WMM;
735 sta->qosinfo = wmm->qos_info;
741 static u16 copy_supp_rates(struct hostapd_data *hapd, struct sta_info *sta,
745 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
752 sizeof(sta->supported_rates)) {
753 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
761 sta->supported_rates_len = merge_byte_arrays(
762 sta->supported_rates, sizeof(sta->supported_rates),
770 static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
779 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
785 resp = check_ssid(hapd, sta, elems.ssid, elems.ssid_len);
788 resp = check_wmm(hapd, sta, elems.wmm, elems.wmm_len);
791 resp = copy_supp_rates(hapd, sta, &elems);
795 resp = copy_sta_ht_capab(hapd, sta, elems.ht_capabilities,
800 !(sta->flags & WLAN_STA_HT)) {
801 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
809 resp = copy_sta_vht_capab(hapd, sta, elems.vht_capabilities,
814 !(sta->flags & WLAN_STA_VHT)) {
815 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
835 sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS | WLAN_STA_WPS2);
839 sta->flags |= WLAN_STA_WPS;
840 wpabuf_free(sta->wps_ie);
841 sta->wps_ie = ieee802_11_vendor_ie_concat(ies, ies_len,
843 if (sta->wps_ie && wps_is_20(sta->wps_ie)) {
845 sta->flags |= WLAN_STA_WPS2;
849 if (sta->wps_ie && wps_validate_assoc_req(sta->wps_ie) < 0) {
857 sta->flags |= WLAN_STA_MAYBE_WPS;
861 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
871 if (sta->wpa_sm == NULL)
872 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
873 sta->addr);
874 if (sta->wpa_sm == NULL) {
879 res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm,
903 if ((sta->flags & WLAN_STA_MFP) && !sta->sa_query_timed_out &&
904 sta->sa_query_count > 0)
905 ap_check_sa_query_timeout(hapd, sta);
906 if ((sta->flags & WLAN_STA_MFP) && !sta->sa_query_timed_out &&
907 (!reassoc || sta->auth_alg != WLAN_AUTH_FT)) {
915 if (sta->sa_query_count == 0)
916 ap_sta_start_sa_query(hapd, sta);
921 if (wpa_auth_uses_mfp(sta->wpa_sm))
922 sta->flags |= WLAN_STA_MFP;
924 sta->flags &= ~WLAN_STA_MFP;
928 if (sta->auth_alg == WLAN_AUTH_FT) {
933 MAC2STR(sta->addr));
937 resp = wpa_ft_validate_reassoc(sta->wpa_sm, ies,
945 if (wpa_auth_uses_sae(sta->wpa_sm) &&
946 sta->auth_alg != WLAN_AUTH_SAE) {
949 MAC2STR(sta->addr), sta->auth_alg);
955 if ((sta->flags & (WLAN_STA_HT | WLAN_STA_VHT)) &&
956 wpa_auth_get_pairwise(sta->wpa_sm) == WPA_CIPHER_TKIP) {
957 hostapd_logger(hapd, sta->addr,
966 wpa_auth_sta_no_wpa(sta->wpa_sm);
970 wpabuf_free(sta->p2p_ie);
971 sta->p2p_ie = ieee802_11_vendor_ie_concat(ies, ies_len,
975 wpabuf_free(sta->p2p_ie);
976 sta->p2p_ie = NULL;
979 p2p_group_notif_assoc(hapd->p2p_group, sta->addr, ies, ies_len);
983 wpabuf_free(sta->hs20_ie);
985 sta->hs20_ie = wpabuf_alloc_copy(elems.hs20 + 4,
988 sta->hs20_ie = NULL;
1017 static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
1032 os_memcpy(reply->da, sta->addr, ETH_ALEN);
1039 host_to_le16(hostapd_own_capab_info(hapd, sta, 0));
1041 reply->u.assoc_resp.aid = host_to_le16((sta ? sta->aid : 0)
1052 p = wpa_sm_write_assoc_resp_ies(sta->wpa_sm, p,
1054 sta->auth_alg, ies, ies_len);
1060 p = hostapd_eid_assoc_comeback_time(hapd, sta, p);
1076 if (sta->flags & WLAN_STA_WMM)
1080 if ((sta->flags & WLAN_STA_WPS) ||
1081 ((sta->flags & WLAN_STA_MAYBE_WPS) && hapd->conf->wpa)) {
1092 if (sta->p2p_ie) {
1137 struct sta_info *sta;
1168 sta = ap_get_sta(hapd, mgmt->sa);
1170 if (sta && sta->auth_alg == WLAN_AUTH_FT &&
1171 (sta->flags & WLAN_STA_AUTH) == 0) {
1177 if (sta == NULL || (sta->flags & WLAN_STA_AUTH) == 0) {
1182 sta ? sta->aid : -1,
1183 sta ? sta->flags : 0);
1205 resp = check_assoc_ies(hapd, sta, pos, left, reassoc);
1209 if (hostapd_get_aid(hapd, sta) < 0) {
1216 sta->capability = capab_info;
1217 sta->listen_interval = listen_interval;
1220 sta->flags |= WLAN_STA_NONERP;
1221 for (i = 0; i < sta->supported_rates_len; i++) {
1222 if ((sta->supported_rates[i] & 0x7f) > 22) {
1223 sta->flags &= ~WLAN_STA_NONERP;
1227 if (sta->flags & WLAN_STA_NONERP && !sta->nonerp_set) {
1228 sta->nonerp_set = 1;
1234 if (!(sta->capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) &&
1235 !sta->no_short_slot_time_set) {
1236 sta->no_short_slot_time_set = 1;
1244 if (sta->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
1245 sta->flags |= WLAN_STA_SHORT_PREAMBLE;
1247 sta->flags &= ~WLAN_STA_SHORT_PREAMBLE;
1249 if (!(sta->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) &&
1250 !sta->no_short_preamble_set) {
1251 sta->no_short_preamble_set = 1;
1259 update_ht_state(hapd, sta);
1262 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1264 "association OK (aid %d)", sta->aid);
1267 sta->flags |= WLAN_STA_ASSOC_REQ_OK;
1270 if ((sta->flags & WLAN_STA_MFP) && sta->sa_query_timed_out) {
1283 os_memcpy(sta->previous_ap, mgmt->u.reassoc_req.current_ap,
1287 if (sta->last_assoc_req)
1288 os_free(sta->last_assoc_req);
1289 sta->last_assoc_req = os_malloc(len);
1290 if (sta->last_assoc_req)
1291 os_memcpy(sta->last_assoc_req, mgmt, len);
1295 sta->timeout_next = STA_NULLFUNC;
1298 send_assoc_resp(hapd, sta, resp, reassoc, pos, left);
1305 struct sta_info *sta;
1317 sta = ap_get_sta(hapd, mgmt->sa);
1318 if (sta == NULL) {
1324 ap_sta_set_authorized(hapd, sta, 0);
1325 sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_ASSOC_REQ_OK);
1326 wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
1327 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1329 sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
1330 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
1333 accounting_sta_stop(hapd, sta);
1334 ieee802_1x_free_station(sta);
1335 hostapd_drv_sta_remove(hapd, sta->addr);
1337 if (sta->timeout_next == STA_NULLFUNC ||
1338 sta->timeout_next == STA_DISASSOC) {
1339 sta->timeout_next = STA_DEAUTH;
1340 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
1342 hapd, sta);
1346 hapd, sta, le_to_host16(mgmt->u.disassoc.reason_code));
1353 struct sta_info *sta;
1365 sta = ap_get_sta(hapd, mgmt->sa);
1366 if (sta == NULL) {
1373 ap_sta_set_authorized(hapd, sta, 0);
1374 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC |
1376 wpa_auth_sm_event(sta->wpa_sm, WPA_DEAUTH);
1377 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1380 hapd, sta, le_to_host16(mgmt->u.deauth.reason_code));
1381 sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
1382 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
1383 ap_free_sta(hapd, sta);
1439 static void hostapd_wnm_action(struct hostapd_data *hapd, struct sta_info *sta,
1462 struct sta_info *sta;
1463 sta = ap_get_sta(hapd, mgmt->sa);
1474 (sta == NULL || !(sta->flags & WLAN_STA_ASSOC))) {
1482 if (sta && (sta->flags & WLAN_STA_MFP) &&
1496 if (wpa_ft_action_rx(sta->wpa_sm, (u8 *) &mgmt->u.action,
1511 hostapd_wnm_action(hapd, sta, mgmt, len);
1667 struct sta_info *sta;
1686 sta = ap_get_sta(hapd, mgmt->da);
1687 if (!sta) {
1696 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1698 sta->flags |= WLAN_STA_AUTH;
1708 struct sta_info *sta;
1719 sta = ap_get_sta(hapd, mgmt->da);
1720 if (!sta) {
1730 sta->flags &= ~WLAN_STA_ASSOC_REQ_OK;
1744 accounting_sta_stop(hapd, sta);
1746 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1749 sta->aid);
1751 if (sta->flags & WLAN_STA_ASSOC)
1753 sta->flags |= WLAN_STA_ASSOC;
1755 sta->auth_alg == WLAN_AUTH_FT) {
1760 ap_sta_set_authorized(hapd, sta, 1);
1764 mlme_reassociate_indication(hapd, sta);
1766 mlme_associate_indication(hapd, sta);
1769 sta->sa_query_timed_out = 0;
1777 hostapd_drv_sta_remove(hapd, sta->addr);
1780 if (sta->flags & WLAN_STA_HT)
1781 hostapd_get_ht_capab(hapd, sta->ht_capabilities, &ht_cap);
1784 if (hostapd_sta_add(hapd, sta->addr, sta->aid, sta->capability,
1785 sta->supported_rates, sta->supported_rates_len,
1786 sta->listen_interval,
1787 sta->flags & WLAN_STA_HT ? &ht_cap : NULL,
1788 sta->flags, sta->qosinfo)) {
1789 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
1793 ap_sta_disconnect(hapd, sta, sta->addr,
1799 if (sta->flags & WLAN_STA_WDS)
1800 hostapd_set_wds_sta(hapd, sta->addr, sta->aid, 1);
1802 if (sta->eapol_sm == NULL) {
1808 if (ap_sta_bind_vlan(hapd, sta, 0) < 0)
1810 } else if (sta->vlan_id) {
1812 if (ap_sta_bind_vlan(hapd, sta, 0) < 0)
1816 hostapd_set_sta_flags(hapd, sta);
1818 if (sta->auth_alg == WLAN_AUTH_FT)
1819 wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC_FT);
1821 wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC);
1822 hapd->new_assoc_sta_cb(hapd, sta, !new_assoc);
1824 ieee802_1x_notify_port_enabled(sta->eapol_sm, 1);
1828 if (sta->last_assoc_req) {
1829 os_free(sta->last_assoc_req);
1830 sta->last_assoc_req = NULL;
1839 struct sta_info *sta;
1842 sta = ap_get_sta(hapd, mgmt->da);
1843 if (!sta) {
1850 MAC2STR(sta->addr));
1853 "deauth", MAC2STR(sta->addr));
1855 ap_sta_deauth_cb(hapd, sta);
1863 struct sta_info *sta;
1866 sta = ap_get_sta(hapd, mgmt->da);
1867 if (!sta) {
1874 MAC2STR(sta->addr));
1877 "disassoc", MAC2STR(sta->addr));
1879 ap_sta_disassoc_cb(hapd, sta);
1939 int ieee802_11_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
1950 struct sta_info *sta;
1953 sta = ap_get_sta(hapd, addr);
1954 if (sta == NULL && iface->num_bss > 1) {
1958 sta = ap_get_sta(hapd, addr);
1959 if (sta)
1963 if (sta == NULL || !(sta->flags & WLAN_STA_ASSOC))
1965 if (sta->flags & WLAN_STA_PENDING_POLL) {
1967 "activity poll", MAC2STR(sta->addr),
1970 sta->flags &= ~WLAN_STA_PENDING_POLL;
1973 ieee802_1x_tx_status(hapd, sta, buf, len, ack);
1980 struct sta_info *sta;
1983 sta = ap_get_sta(hapd, dst);
1984 if (sta == NULL && iface->num_bss > 1) {
1988 sta = ap_get_sta(hapd, dst);
1989 if (sta)
1993 if (sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) {
2000 ieee802_1x_eapol_tx_status(hapd, sta, data, len, ack);
2006 struct sta_info *sta;
2009 sta = ap_get_sta(hapd, addr);
2010 if (sta == NULL && iface->num_bss > 1) {
2014 sta = ap_get_sta(hapd, addr);
2015 if (sta)
2019 if (sta == NULL)
2021 if (!(sta->flags & WLAN_STA_PENDING_POLL))
2025 "activity poll", MAC2STR(sta->addr));
2026 sta->flags &= ~WLAN_STA_PENDING_POLL;
2033 struct sta_info *sta;
2035 sta = ap_get_sta(hapd, src);
2036 if (sta && (sta->flags & WLAN_STA_ASSOC)) {
2040 if (wds && !(sta->flags & WLAN_STA_WDS)) {
2043 MAC2STR(sta->addr), sta->aid);
2044 sta->flags |= WLAN_STA_WDS;
2045 hostapd_set_wds_sta(hapd, sta->addr, sta->aid, 1);
2057 if (sta && (sta->flags & WLAN_STA_ASSOC_REQ_OK)) {
2065 if (sta && (sta->flags & WLAN_STA_AUTH))