Lines Matching defs:hapd
35 static void ieee802_1x_finished(struct hostapd_data *hapd,
39 static void ieee802_1x_send(struct hostapd_data *hapd, struct sta_info *sta,
57 xhdr->version = hapd->conf->eapol_version;
67 rsn_preauth_send(hapd, sta, buf, len);
70 hapd, sta->addr, buf, len,
78 void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd,
87 ap_sta_set_authorized(hapd, sta, 1);
88 res = hostapd_set_authorized(hapd, sta, 1);
89 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
92 ap_sta_set_authorized(hapd, sta, 0);
93 res = hostapd_set_authorized(hapd, sta, 0);
94 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
105 accounting_sta_start(hapd, sta);
110 static void ieee802_1x_tx_key_one(struct hostapd_data *hapd,
142 if (hapd->conf->eapol_key_index_workaround) {
173 hdr->version = hapd->conf->eapol_version;
182 ieee802_1x_send(hapd, sta, IEEE802_1X_TYPE_EAPOL_KEY, (u8 *) key, len);
189 void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta)
191 struct eapol_authenticator *eapol = hapd->eapol_auth;
208 ieee802_1x_tx_key_one(hapd, sta, eapol->default_wep_key_idx, 1,
210 hapd->conf->default_wep_key_len);
213 if (hapd->conf->individual_wep_key_len > 0) {
215 ikey = os_malloc(hapd->conf->individual_wep_key_len);
217 random_get_bytes(ikey, hapd->conf->individual_wep_key_len))
226 ikey, hapd->conf->individual_wep_key_len);
228 ieee802_1x_tx_key_one(hapd, sta, 0, 0, ikey,
229 hapd->conf->individual_wep_key_len);
233 if (hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_WEP,
235 hapd->conf->individual_wep_key_len)) {
245 const char *radius_mode_txt(struct hostapd_data *hapd)
247 switch (hapd->iface->conf->hw_mode) {
261 int radius_sta_rate(struct hostapd_data *hapd, struct sta_info *sta)
275 static void ieee802_1x_learn_identity(struct hostapd_data *hapd,
299 hostapd_logger(hapd, sm->addr, HOSTAPD_MODULE_IEEE8021X,
305 static int add_common_radius_sta_attr(struct hostapd_data *hapd,
333 radius_sta_rate(hapd, sta) / 2,
334 (radius_sta_rate(hapd, sta) & 1) ? ".5" : "",
335 radius_mode_txt(hapd));
360 int add_common_radius_attr(struct hostapd_data *hapd,
370 hapd->conf->own_ip_addr.af == AF_INET &&
372 (u8 *) &hapd->conf->own_ip_addr.u.v4, 4)) {
380 hapd->conf->own_ip_addr.af == AF_INET6 &&
382 (u8 *) &hapd->conf->own_ip_addr.u.v6, 16)) {
390 hapd->conf->nas_identifier &&
392 (u8 *) hapd->conf->nas_identifier,
393 os_strlen(hapd->conf->nas_identifier))) {
399 MAC2STR(hapd->own_addr),
400 wpa_ssid_txt(hapd->conf->ssid.ssid,
401 hapd->conf->ssid.ssid_len));
419 if (sta && add_common_radius_sta_attr(hapd, req_attr, sta, msg) < 0)
436 static void ieee802_1x_encapsulate_radius(struct hostapd_data *hapd,
446 ieee802_1x_learn_identity(hapd, sm, eap, len);
451 sm->radius_identifier = radius_client_get_id(hapd->radius);
468 if (add_common_radius_attr(hapd, hapd->conf->radius_auth_req_attr, sta,
475 if (!hostapd_config_get_radius_attr(hapd->conf->radius_auth_req_attr,
504 if (hapd->conf->radius_request_cui) {
523 if (radius_client_send(hapd->radius, msg, RADIUS_AUTH, sta->addr) < 0)
534 static void handle_eap_response(struct hostapd_data *hapd,
552 hostapd_logger(hapd, sm->addr, HOSTAPD_MODULE_IEEE8021X,
567 static void handle_eap(struct hostapd_data *hapd, struct sta_info *sta,
601 handle_eap_response(hapd, sta, eap, eap_len);
617 ieee802_1x_alloc_eapol_sm(struct hostapd_data *hapd, struct sta_info *sta)
627 return eapol_auth_alloc(hapd->eapol_auth, sta->addr, flags,
635 * @hapd: hostapd BSS data
642 void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
652 if (!hapd->conf->ieee802_1x && !hapd->conf->wpa &&
653 !hapd->conf->wps_state)
658 sta = ap_get_sta(hapd, sa);
660 !(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_WIRED))) {
698 wpa_receive(hapd->wpa_auth, sta->wpa_sm, (u8 *) hdr,
703 if (!hapd->conf->ieee802_1x &&
718 sta->eapol_sm = ieee802_1x_alloc_eapol_sm(hapd, sta);
723 if (!hapd->conf->ieee802_1x) {
756 handle_eap(hapd, sta, (u8 *) (hdr + 1), datalen);
760 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
766 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_WPA,
779 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
784 accounting_sta_stop(hapd, sta);
816 * @hapd: hostapd BSS data
822 void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta)
830 if (hapd->conf->wps_state && hapd->conf->wpa &&
841 if (!force_1x && !hapd->conf->ieee802_1x) {
864 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
866 sta->eapol_sm = ieee802_1x_alloc_eapol_sm(hapd, sta);
868 hostapd_logger(hapd, sta->addr,
879 if (!hapd->conf->ieee802_1x && !(sta->flags & WLAN_STA_WPS2)) {
895 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
917 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
934 ap_sta_bind_vlan(hapd, sta, old_vlanid);
970 static void ieee802_1x_decapsulate_radius(struct hostapd_data *hapd,
993 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1001 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1039 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1051 static void ieee802_1x_get_keys(struct hostapd_data *hapd,
1092 static void ieee802_1x_store_radius_class(struct hostapd_data *hapd,
1103 if (!hapd->conf->radius->acct_server || hapd->radius == NULL ||
1148 static void ieee802_1x_update_sta_identity(struct hostapd_data *hapd,
1167 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1180 static void ieee802_1x_update_sta_cui(struct hostapd_data *hapd,
1211 static int ieee802_1x_select_radius_identifier(struct hostapd_data *hapd,
1228 ieee802_1x_search_radius_identifier(struct hostapd_data *hapd, u8 identifier)
1233 ap_for_each_sta(hapd, ieee802_1x_select_radius_identifier, &id_search);
1252 struct hostapd_data *hapd = data;
1260 sm = ieee802_1x_search_radius_identifier(hapd, hdr->identifier);
1305 if (hapd->conf->acct_interim_interval == 0 &&
1310 hostapd_logger(hapd, sta->addr,
1331 hostapd_vlan_id_valid(hapd->conf->vlan, sta->vlan_id)) {
1332 hostapd_logger(hapd, sta->addr,
1338 hostapd_logger(hapd, sta->addr,
1347 if (ap_sta_bind_vlan(hapd, sta, old_vlanid) < 0)
1355 ap_sta_session_timeout(hapd, sta, session_timeout);
1359 ieee802_1x_get_keys(hapd, sta, msg, req, shared_secret,
1361 ieee802_1x_store_radius_class(hapd, sta, msg);
1362 ieee802_1x_update_sta_identity(hapd, sta, msg);
1363 ieee802_1x_update_sta_cui(hapd, sta, msg);
1368 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_WPA,
1382 hostapd_logger(hapd, sm->addr,
1398 ieee802_1x_decapsulate_radius(hapd, sta);
1409 void ieee802_1x_abort_auth(struct hostapd_data *hapd, struct sta_info *sta)
1415 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1429 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "EAP Timeout, STA " MACSTR,
1433 ap_sta_disconnect(hapd, sta, sta->addr,
1439 static int ieee802_1x_rekey_broadcast(struct hostapd_data *hapd)
1441 struct eapol_authenticator *eapol = hapd->eapol_auth;
1443 if (hapd->conf->default_wep_key_len < 1)
1447 eapol->default_wep_key = os_malloc(hapd->conf->default_wep_key_len);
1450 hapd->conf->default_wep_key_len)) {
1459 hapd->conf->default_wep_key_len);
1465 static int ieee802_1x_sta_key_available(struct hostapd_data *hapd,
1478 struct hostapd_data *hapd = eloop_ctx;
1479 struct eapol_authenticator *eapol = hapd->eapol_auth;
1483 hapd->conf->individual_wep_key_len > 0 ? 1 : 0;
1490 if (ieee802_1x_rekey_broadcast(hapd)) {
1491 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE8021X,
1501 if (hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_WEP,
1505 hapd->conf->default_wep_key_len)) {
1506 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE8021X,
1514 ap_for_each_sta(hapd, ieee802_1x_sta_key_available, NULL);
1516 if (hapd->conf->wep_rekeying_period > 0) {
1517 eloop_register_timeout(hapd->conf->wep_rekeying_period, 0,
1518 ieee802_1x_rekey, hapd, NULL);
1558 struct hostapd_data *hapd = ctx;
1561 ieee802_1x_encapsulate_radius(hapd, sta, data, datalen);
1569 struct hostapd_data *hapd = ctx;
1572 rsn_preauth_finished(hapd, sta, success);
1574 ieee802_1x_finished(hapd, sta, success);
1582 struct hostapd_data *hapd = ctx;
1586 eap_user = hostapd_get_eap_user(hapd, identity, identity_len, phase2);
1615 struct hostapd_data *hapd = ctx;
1617 sta = ap_get_sta(hapd, addr);
1628 struct hostapd_data *hapd = ctx;
1644 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE8021X, hlevel, "%s",
1653 struct hostapd_data *hapd = ctx;
1655 ieee802_1x_set_sta_authorized(hapd, sta, authorized);
1661 struct hostapd_data *hapd = ctx;
1663 ieee802_1x_abort_auth(hapd, sta);
1669 struct hostapd_data *hapd = ctx;
1671 ieee802_1x_tx_key(hapd, sta);
1678 /* struct hostapd_data *hapd = ctx; */
1691 int ieee802_1x_init(struct hostapd_data *hapd)
1698 conf.ctx = hapd;
1699 conf.eap_reauth_period = hapd->conf->eap_reauth_period;
1700 conf.wpa = hapd->conf->wpa;
1701 conf.individual_wep_key_len = hapd->conf->individual_wep_key_len;
1702 conf.eap_server = hapd->conf->eap_server;
1703 conf.ssl_ctx = hapd->ssl_ctx;
1704 conf.msg_ctx = hapd->msg_ctx;
1705 conf.eap_sim_db_priv = hapd->eap_sim_db_priv;
1706 conf.eap_req_id_text = hapd->conf->eap_req_id_text;
1707 conf.eap_req_id_text_len = hapd->conf->eap_req_id_text_len;
1708 conf.pac_opaque_encr_key = hapd->conf->pac_opaque_encr_key;
1709 conf.eap_fast_a_id = hapd->conf->eap_fast_a_id;
1710 conf.eap_fast_a_id_len = hapd->conf->eap_fast_a_id_len;
1711 conf.eap_fast_a_id_info = hapd->conf->eap_fast_a_id_info;
1712 conf.eap_fast_prov = hapd->conf->eap_fast_prov;
1713 conf.pac_key_lifetime = hapd->conf->pac_key_lifetime;
1714 conf.pac_key_refresh_time = hapd->conf->pac_key_refresh_time;
1715 conf.eap_sim_aka_result_ind = hapd->conf->eap_sim_aka_result_ind;
1716 conf.tnc = hapd->conf->tnc;
1717 conf.wps = hapd->wps;
1718 conf.fragment_size = hapd->conf->fragment_size;
1719 conf.pwd_group = hapd->conf->pwd_group;
1720 conf.pbc_in_m1 = hapd->conf->pbc_in_m1;
1721 if (hapd->conf->server_id) {
1722 conf.server_id = (const u8 *) hapd->conf->server_id;
1723 conf.server_id_len = os_strlen(hapd->conf->server_id);
1741 hapd->eapol_auth = eapol_auth_init(&conf, &cb);
1742 if (hapd->eapol_auth == NULL)
1745 if ((hapd->conf->ieee802_1x || hapd->conf->wpa) &&
1746 hapd, hapd->conf->iface, 1))
1750 if (radius_client_register(hapd->radius, RADIUS_AUTH,
1751 ieee802_1x_receive_auth, hapd))
1755 if (hapd->conf->default_wep_key_len) {
1757 hostapd_drv_set_key(hapd->conf->iface, hapd,
1761 ieee802_1x_rekey(hapd, NULL);
1763 if (hapd->eapol_auth->default_wep_key == NULL)
1771 void ieee802_1x_deinit(struct hostapd_data *hapd)
1773 eloop_cancel_timeout(ieee802_1x_rekey, hapd, NULL);
1775 if (hapd->driver != NULL &&
1776 (hapd->conf->ieee802_1x || hapd->conf->wpa))
1777 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
1779 eapol_auth_deinit(hapd->eapol_auth);
1780 hapd->eapol_auth = NULL;
1784 int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
1806 return ieee802_1x_eapol_tx_status(hapd, sta, pos, buf + len - pos,
1811 int ieee802_1x_eapol_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
1834 wpa_auth_eapol_key_tx_status(hapd->wpa_auth,
1845 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
1943 int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
1950 int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
2095 static void ieee802_1x_finished(struct hostapd_data *hapd,
2107 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_WPA,
2123 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "IEEE 802.1X: Force "
2134 ap_sta_disconnect(hapd, sta, sta->addr,