Home | History | Annotate | Download | only in ap

Lines Matching defs:sta

36 				struct sta_info *sta, int success);
39 static void ieee802_1x_send(struct hostapd_data *hapd, struct sta_info *sta,
64 if (wpa_auth_pairwise_set(sta->wpa_sm))
66 if (sta->flags & WLAN_STA_PREAUTH) {
67 rsn_preauth_send(hapd, sta, buf, len);
69 hostapd_drv_hapd_send_eapol(hapd, sta->addr, buf, len,
70 encrypt, sta->flags);
78 struct sta_info *sta, int authorized)
82 if (sta->flags & WLAN_STA_PREAUTH)
86 ap_sta_set_authorized(hapd, sta, 1);
87 res = hostapd_set_authorized(hapd, sta, 1);
88 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
91 ap_sta_set_authorized(hapd, sta, 0);
92 res = hostapd_set_authorized(hapd, sta, 0);
93 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
99 "driver (errno=%d).\n", MAC2STR(sta->addr), errno);
103 accounting_sta_start(hapd, sta);
108 struct sta_info *sta,
116 struct eapol_state_machine *sm = sta->eapol_sm;
179 ieee802_1x_send(hapd, sta, IEEE802_1X_TYPE_EAPOL_KEY, (u8 *) key, len);
180 if (sta->eapol_sm)
181 sta->eapol_sm->dot1xAuthEapolFramesTx++;
286 void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta)
289 struct eapol_state_machine *sm = sta->eapol_sm;
299 MAC2STR(sta->addr));
302 vlan_id = sta->vlan_id;
307 key = ieee802_1x_get_group(hapd, sta->ssid, vlan_id);
309 ieee802_1x_tx_key_one(hapd, sta, key->idx, 1,
315 ieee802_1x_tx_key_one(hapd, sta, eapol->default_wep_key_idx, 1,
335 ieee802_1x_tx_key_one(hapd, sta, 0, 0, ikey,
338 /* TODO: set encryption in TX callback, i.e., only after STA
341 sta->addr, 0, 1, NULL, 0, ikey,
366 int radius_sta_rate(struct hostapd_data *hapd, struct sta_info *sta)
371 for (i = 0; i < sta->supported_rates_len; i++)
372 if ((sta->supported_rates[i] & 0x7f) > rate)
373 rate = sta->supported_rates[i] & 0x7f;
407 HOSTAPD_LEVEL_DEBUG, "STA identity '%s'", sm->identity);
413 struct sta_info *sta,
418 struct eapol_state_machine *sm = sta->eapol_sm;
436 radius_msg_make_authenticator(msg, (u8 *) sta, sizeof(*sta));
469 if (!radius_msg_add_attr_int32(msg, RADIUS_ATTR_NAS_PORT, sta->aid)) {
484 MAC2STR(sta->addr));
506 if (sta->flags & WLAN_STA_PREAUTH) {
511 radius_sta_rate(hapd, sta) / 2,
512 (radius_sta_rate(hapd, sta) & 1) ? ".5" : "",
544 if (radius_client_send(hapd->radius, msg, RADIUS_AUTH, sta->addr) < 0)
556 struct sta_info *sta, struct eap_hdr *eap,
560 struct eapol_state_machine *sm = sta->eapol_sm;
575 "id=%d len=%d) from STA: EAP Response-%s (%d)",
588 static void handle_eap(struct hostapd_data *hapd, struct sta_info *sta,
622 handle_eap_response(hapd, sta, eap, eap_len);
638 ieee802_1x_alloc_eapol_sm(struct hostapd_data *hapd, struct sta_info *sta)
641 if (sta->flags & WLAN_STA_PREAUTH)
643 if (sta->wpa_sm) {
645 if (wpa_auth_sta_get_pmksa(sta->wpa_sm))
648 return eapol_auth_alloc(hapd->eapol_auth, sta->addr, flags,
649 sta->wps_ie, sta->p2p_ie, sta);
665 struct sta_info *sta;
678 sta = ap_get_sta(hapd, sa);
679 if (!sta || (!(sta->flags & (WLAN_STA_ASSOC | WLAN_STA_PREAUTH)) &&
682 "associated/Pre-authenticating STA");
698 if (sta->eapol_sm)
699 sta->eapol_sm->dot1xAuthEapLengthErrorFramesRx++;
708 if (sta->eapol_sm) {
709 sta->eapol_sm->dot1xAuthLastEapolFrameVersion = hdr->version;
710 sta->eapol_sm->dot1xAuthEapolFramesRx++;
718 wpa_receive(hapd->wpa_auth, sta->wpa_sm, (u8 *) hdr,
724 !(sta->flags & (WLAN_STA_WPS | WLAN_STA_MAYBE_WPS))) {
730 key_mgmt = wpa_auth_sta_key_mgmt(sta->wpa_sm);
733 "STA is using PSK");
737 if (!sta->eapol_sm) {
738 sta->eapol_sm = ieee802_1x_alloc_eapol_sm(hapd, sta);
739 if (!sta->eapol_sm)
744 u32 wflags = sta->flags & (WLAN_STA_WPS |
751 * possible WPS STA initiates the handshake
753 * skipped if the STA is known to support WPS
759 sta->eapol_sm->flags |= EAPOL_SM_WAIT_START;
764 sta->eapol_sm->eap_if->portEnabled = TRUE;
776 handle_eap(hapd, sta, (u8 *) (hdr + 1), datalen);
780 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
782 "from STA");
783 sta->eapol_sm->flags &= ~EAPOL_SM_WAIT_START;
784 pmksa = wpa_auth_sta_get_pmksa(sta->wpa_sm);
786 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_WPA,
789 "STA sent EAPOL-Start");
790 wpa_auth_sta_clear_pmksa(sta->wpa_sm, pmksa);
792 sta->eapol_sm->eapolStart = TRUE;
793 sta->eapol_sm->dot1xAuthEapolStartFramesRx++;
794 eap_server_clear_identity(sta->eapol_sm->eap);
795 wpa_auth_sm_event(sta->wpa_sm, WPA_REAUTH_EAPOL);
799 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
801 "from STA");
802 sta->acct_terminate_cause =
804 accounting_sta_stop(hapd, sta);
805 sta->eapol_sm->eapolLogoff = TRUE;
806 sta->eapol_sm->dot1xAuthEapolLogoffFramesRx++;
807 eap_server_clear_identity(sta->eapol_sm->eap);
812 if (!ap_sta_is_authorized(sta)) {
826 sta->eapol_sm->dot1xAuthInvalidEapolFramesRx++;
830 eapol_auth_step(sta->eapol_sm);
837 * @sta: The station
842 void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta)
851 (sta->flags & (WLAN_STA_WPS | WLAN_STA_MAYBE_WPS))) {
862 wpa_printf(MSG_DEBUG, "IEEE 802.1X: Ignore STA - "
867 key_mgmt = wpa_auth_sta_key_mgmt(sta->wpa_sm);
869 wpa_printf(MSG_DEBUG, "IEEE 802.1X: Ignore STA - using PSK");
873 if (sta->eapol_sm == NULL) {
874 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
876 sta->eapol_sm = ieee802_1x_alloc_eapol_sm(hapd, sta);
877 if (sta->eapol_sm == NULL) {
878 hostapd_logger(hapd, sta->addr,
888 sta->eapol_sm->flags &= ~EAPOL_SM_WAIT_START;
889 if (!hapd->conf->ieee802_1x && !(sta->flags & WLAN_STA_WPS2)) {
891 * Delay EAPOL frame transmission until a possible WPS STA
893 * wait to be skipped if the STA is known to support WPS 2.0.
897 sta->eapol_sm->flags |= EAPOL_SM_WAIT_START;
901 sta->eapol_sm->eap_if->portEnabled = TRUE;
904 if (sta->auth_alg == WLAN_AUTH_FT) {
905 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
910 sta->eapol_sm->keyRun = TRUE;
911 sta->eapol_sm->eap_if->eapKeyAvailable = TRUE;
912 sta->eapol_sm->auth_pae_state = AUTH_PAE_AUTHENTICATING;
913 sta->eapol_sm->be_auth_state = BE_AUTH_SUCCESS;
914 sta->eapol_sm->authSuccess = TRUE;
915 sta->eapol_sm->authFail = FALSE;
916 if (sta->eapol_sm->eap)
917 eap_sm_notify_cached(sta->eapol_sm->eap);
923 pmksa = wpa_auth_sta_get_pmksa(sta->wpa_sm);
927 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
932 sta->eapol_sm->keyRun = TRUE;
933 sta->eapol_sm->eap_if->eapKeyAvailable = TRUE;
934 sta->eapol_sm->auth_pae_state = AUTH_PAE_AUTHENTICATING;
935 sta->eapol_sm->be_auth_state = BE_AUTH_SUCCESS;
936 sta->eapol_sm->authSuccess = TRUE;
937 sta->eapol_sm->authFail = FALSE;
938 if (sta->eapol_sm->eap)
939 eap_sm_notify_cached(sta->eapol_sm->eap);
940 old_vlanid = sta->vlan_id;
941 pmksa_cache_to_eapol_data(pmksa, sta->eapol_sm);
942 if (sta->ssid->dynamic_vlan == DYNAMIC_VLAN_DISABLED)
943 sta->vlan_id = 0;
944 ap_sta_bind_vlan(hapd, sta, old_vlanid);
952 sta->eapol_sm->reAuthenticate = TRUE;
954 eapol_auth_step(sta->eapol_sm);
959 void ieee802_1x_free_station(struct sta_info *sta)
961 struct eapol_state_machine *sm = sta->eapol_sm;
966 sta->eapol_sm = NULL;
980 struct sta_info *sta)
988 struct eapol_state_machine *sm = sta->eapol_sm;
1003 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1011 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1049 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1062 struct sta_info *sta, struct radius_msg *msg,
1068 struct eapol_state_machine *sm = sta->eapol_sm;
1103 struct sta_info *sta,
1108 struct eapol_state_machine *sm = sta->eapol_sm;
1153 MAC2STR(sta->addr));
1157 /* Update sta->identity based on User-Name attribute in Access-Accept */
1159 struct sta_info *sta,
1164 struct eapol_state_machine *sm = sta->eapol_sm;
1180 sta->addr, HOSTAPD_MODULE_IEEE8021X,
1199 struct sta_info *sta,
1203 struct eapol_state_machine *sm = sta->eapol_sm;
1240 struct sta_info *sta;
1253 sta = sm->sta;
1280 MAC2STR(sta->addr));
1297 hostapd_logger(hapd, sta->addr,
1304 sta->acct_interim_interval = acct_interim_interval;
1310 if (sta->ssid->dynamic_vlan == DYNAMIC_VLAN_DISABLED)
1311 sta->vlan_id = 0;
1314 old_vlanid = sta->vlan_id;
1315 sta->vlan_id = radius_msg_get_vlanid(msg);
1317 if (sta->vlan_id > 0 &&
1319 sta->vlan_id)) {
1320 hostapd_logger(hapd, sta->addr,
1323 "VLAN ID %d", sta->vlan_id);
1324 } else if (sta->ssid->dynamic_vlan == DYNAMIC_VLAN_REQUIRED) {
1325 sta->eapol_sm->authFail = TRUE;
1326 hostapd_logger(hapd, sta->addr,
1335 if (ap_sta_bind_vlan(hapd, sta, old_vlanid) < 0)
1343 ap_sta_session_timeout(hapd, sta, session_timeout);
1347 ieee802_1x_get_keys(hapd, sta, msg, req, shared_secret,
1349 ieee802_1x_store_radius_class(hapd, sta, msg);
1350 ieee802_1x_update_sta_identity(hapd, sta, msg);
1352 wpa_auth_pmksa_add(sta->wpa_sm, sm->eapol_key_crypt,
1355 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_WPA,
1385 ieee802_1x_decapsulate_radius(hapd, sta);
1396 void ieee802_1x_abort_auth(struct hostapd_data *hapd, struct sta_info *sta)
1398 struct eapol_state_machine *sm = sta->eapol_sm;
1402 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1412 * Disconnect the STA since it did not reply to the last EAP
1416 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "EAP Timeout, STA " MACSTR,
1417 MAC2STR(sta->addr));
1420 ap_sta_disconnect(hapd, sta, sta->addr,
1453 struct sta_info *sta, void *ctx)
1455 if (sta->eapol_sm) {
1456 sta->eapol_sm->eap_if->eapKeyAvailable = TRUE;
1457 eapol_auth_step(sta->eapol_sm);
1514 struct sta_info *sta = sta_ctx;
1516 if ((sta->flags & (WLAN_STA_WPS | WLAN_STA_MAYBE_WPS)) ==
1520 struct eapol_state_machine *sm = sta->eapol_sm;
1532 sta->flags |= WLAN_STA_WPS;
1546 struct sta_info *sta = sta_ctx;
1548 ieee802_1x_encapsulate_radius(hapd, sta, data, datalen);
1557 struct sta_info *sta = sta_ctx;
1559 rsn_preauth_finished(hapd, sta, success);
1561 ieee802_1x_finished(hapd, sta, success);
1604 struct sta_info *sta;
1605 sta = ap_get_sta(hapd, addr);
1606 if (sta == NULL || sta->eapol_sm == NULL)
1642 struct sta_info *sta = sta_ctx;
1643 ieee802_1x_set_sta_authorized(hapd, sta, authorized);
1650 struct sta_info *sta = sta_ctx;
1651 ieee802_1x_abort_auth(hapd, sta);
1658 struct sta_info *sta = sta_ctx;
1659 ieee802_1x_tx_key(hapd, sta);
1667 struct sta_info *sta = sta_ctx;
1670 wpa_auth_sm_notify(sta->wpa_sm);
1673 wpa_auth_sm_event(sta->wpa_sm, WPA_REAUTH_EAPOL);
1765 int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
1773 if (sta == NULL)
1787 return ieee802_1x_eapol_tx_status(hapd, sta, pos, buf + len - pos,
1792 int ieee802_1x_eapol_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
1804 MAC2STR(sta->addr), xhdr->version, xhdr->type,
1816 sta->wpa_sm, ack);
1822 * packets couple of times because otherwise STA keys become
1826 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1833 * deauthenticate STA so that it will get new keys when
1923 int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
1927 struct eapol_state_machine *sm = sta->eapol_sm;
1939 sta->aid,
2054 sta->acct_session_id_hi, sta->acct_session_id_lo,
2056 wpa_auth_sta_key_mgmt(sta->wpa_sm))) ?
2058 (unsigned int) (t.sec - sta->acct_session_start),
2069 struct sta_info *sta, int success)
2076 key = ieee802_1x_get_key(sta->eapol_sm, &len);
2078 wpa_auth_pmksa_add(sta->wpa_sm, key, dot11RSNAConfigPMKLifetime,
2079 sta->eapol_sm) == 0) {
2080 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_WPA,
2103 ap_sta_disconnect(hapd, sta, sta->addr,