Home | History | Annotate | Download | only in hostapd

Lines Matching defs:hapd

51 static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
55 static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
67 dst->next = hapd->ctrl_dst;
68 hapd->ctrl_dst = dst;
76 static int hostapd_ctrl_iface_detach(struct hostapd_data *hapd,
82 dst = hapd->ctrl_dst;
93 hapd->ctrl_dst = dst->next;
106 static int hostapd_ctrl_iface_level(struct hostapd_data *hapd,
115 dst = hapd->ctrl_dst;
134 static int hostapd_ctrl_iface_new_sta(struct hostapd_data *hapd,
145 sta = ap_get_sta(hapd, addr);
151 sta = ap_sta_add(hapd, addr);
155 hostapd_new_assoc_sta(hapd, sta, 0);
162 static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd,
174 ieee802_11_send_sa_query_req(hapd, addr, trans_id);
183 static int hostapd_ctrl_iface_wps_pin(struct hostapd_data *hapd, char *txt)
208 return hostapd_wps_add_pin(hapd, addr, txt, pin, timeout);
213 struct hostapd_data *hapd, char *cmd, char *buf, size_t buflen)
258 static int hostapd_ctrl_iface_wps_nfc_tag_read(struct hostapd_data *hapd,
278 ret = hostapd_wps_nfc_tag_read(hapd, buf);
285 static int hostapd_ctrl_iface_wps_nfc_config_token(struct hostapd_data *hapd,
300 buf = hostapd_wps_nfc_config_token(hapd, ndef);
315 static int hostapd_ctrl_iface_wps_nfc_token_gen(struct hostapd_data *hapd,
322 buf = hostapd_wps_nfc_token_gen(hapd, ndef);
337 static int hostapd_ctrl_iface_wps_nfc_token(struct hostapd_data *hapd,
342 return hostapd_ctrl_iface_wps_nfc_token_gen(hapd, reply,
346 return hostapd_ctrl_iface_wps_nfc_token_gen(hapd, reply,
350 return hostapd_wps_nfc_token_enable(hapd);
353 hostapd_wps_nfc_token_disable(hapd);
361 static int hostapd_ctrl_iface_nfc_get_handover_sel(struct hostapd_data *hapd,
383 buf = hostapd_wps_nfc_hs_cr(hapd, ndef);
400 static int hostapd_ctrl_iface_nfc_report_handover(struct hostapd_data *hapd,
457 ret = hostapd_wps_nfc_report_handover(hapd, req, sel);
472 static int hostapd_ctrl_iface_wps_ap_pin(struct hostapd_data *hapd, char *txt,
484 hostapd_wps_ap_pin_disable(hapd);
491 pin_txt = hostapd_wps_ap_pin_random(hapd, timeout);
498 pin_txt = hostapd_wps_ap_pin_get(hapd);
516 if (hostapd_wps_ap_pin_set(hapd, pin, timeout) < 0)
525 static int hostapd_ctrl_iface_wps_config(struct hostapd_data *hapd, char *txt)
548 return hostapd_wps_config_ap(hapd, ssid, auth, encr, key);
569 static int hostapd_ctrl_iface_wps_get_status(struct hostapd_data *hapd,
579 pbc_status_str(hapd->wps_stats.pbc_status));
586 (hapd->wps_stats.status == WPS_STATUS_SUCCESS ?
588 (hapd->wps_stats.status == WPS_STATUS_FAILURE ?
596 if(hapd->wps_stats.status == WPS_STATUS_FAILURE &&
597 hapd->wps_stats.failure_reason > 0) {
600 wps_ei_str(hapd->wps_stats.failure_reason));
607 if (hapd->wps_stats.status) {
609 MAC2STR(hapd->wps_stats.peer_addr));
623 static int hostapd_ctrl_iface_hs20_wnm_notif(struct hostapd_data *hapd,
642 return hs20_send_wnm_notification(hapd, addr, 1, url);
646 static int hostapd_ctrl_iface_hs20_deauth_req(struct hostapd_data *hapd,
690 ret = hs20_send_wnm_notification_deauth_req(hapd, addr, req);
700 static int hostapd_ctrl_iface_set_qos_map_set(struct hostapd_data *hapd,
731 ret = hostapd_drv_set_qos_map(hapd, qos_map_set, count);
737 os_memcpy(hapd->conf->qos_map_set, qos_map_set, count);
738 hapd->conf->qos_map_set_len = count;
744 static int hostapd_ctrl_iface_send_qos_map_conf(struct hostapd_data *hapd,
750 u8 *qos_map_set = hapd->conf->qos_map_set;
751 u8 qos_map_set_len = hapd->conf->qos_map_set_len;
762 sta = ap_get_sta(hapd, addr);
788 ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr,
800 static int hostapd_ctrl_iface_disassoc_imminent(struct hostapd_data *hapd,
813 sta = ap_get_sta(hapd, addr);
821 return wnm_send_disassoc_imminent(hapd, sta, disassoc_timer);
825 static int hostapd_ctrl_iface_ess_disassoc(struct hostapd_data *hapd,
836 sta = ap_get_sta(hapd, addr);
857 return wnm_send_ess_disassoc_imminent(hapd, sta, url, disassoc_timer);
863 static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
874 MAC2STR(hapd->own_addr),
875 wpa_ssid_txt(hapd->conf->ssid.ssid,
876 hapd->conf->ssid.ssid_len));
883 hapd->conf->wps_state == 0 ? "disabled" :
884 (hapd->conf->wps_state == 1 ? "not configured" :
890 if (hapd->conf->wps_state && hapd->conf->wpa &&
891 hapd->conf->ssid.wpa_passphrase) {
893 hapd->conf->ssid.wpa_passphrase);
899 if (hapd->conf->wps_state && hapd->conf->wpa &&
900 hapd->conf->ssid.wpa_psk &&
901 hapd->conf->ssid.wpa_psk->group) {
904 hapd->conf->ssid.wpa_psk->psk, PMK_LEN);
912 if (hapd->conf->wpa && hapd->conf->wpa_key_mgmt) {
918 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK) {
924 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X) {
931 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_PSK) {
937 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_IEEE8021X) {
944 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_SAE) {
953 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK_SHA256) {
959 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X_SHA256) {
967 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_SAE) {
981 if (hapd->conf->wpa) {
983 wpa_cipher_txt(hapd->conf->wpa_group));
989 if ((hapd->conf->wpa & WPA_PROTO_RSN) && hapd->conf->rsn_pairwise) {
995 ret = wpa_write_ciphers(pos, end, hapd->conf->rsn_pairwise,
1007 if ((hapd->conf->wpa & WPA_PROTO_WPA) && hapd->conf->wpa_pairwise) {
1013 ret = wpa_write_ciphers(pos, end, hapd->conf->rsn_pairwise,
1029 static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
1055 hostapd_wps_update_ie(hapd);
1072 hapd->gas_frag_limit = val;
1076 hapd->ext_mgmt_frame_handling = atoi(value);
1082 ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value);
1087 for (sta = hapd->sta_list; sta; sta = sta->next) {
1089 hapd->conf->deny_mac,
1090 hapd->conf->num_deny_mac, sta->addr,
1094 hapd, sta, sta->addr,
1097 } else if (hapd->conf->macaddr_acl == DENY_UNLESS_ACCEPTED &&
1099 for (sta = hapd->sta_list; sta; sta = sta->next) {
1101 hapd->conf->accept_mac,
1102 hapd->conf->num_accept_mac,
1106 hapd, sta, sta->addr,
1116 static int hostapd_ctrl_iface_get(struct hostapd_data *hapd, char *cmd,
1166 static int hostapd_ctrl_iface_radar(struct hostapd_data *hapd, char *cmd)
1219 wpa_supplicant_event(hapd, event, &data);
1225 static int hostapd_ctrl_iface_mgmt_tx(struct hostapd_data *hapd, char *cmd)
1247 res = hostapd_drv_send_mlme(hapd, buf, len, 0);
1283 static int hostapd_ctrl_iface_mib(struct hostapd_data *hapd, char *reply,
1288 return radius_server_get_mib(hapd->radius_srv, reply,
1296 static int hostapd_ctrl_iface_vendor(struct hostapd_data *hapd, char *cmd,
1339 ret = hostapd_drv_vendor_cmd(hapd, vendor_id, subcmd, data, data_len,
1356 struct hostapd_data *hapd = eloop_ctx;
1394 reply_len = hostapd_ctrl_iface_status(hapd, reply,
1397 reply_len = hostapd_drv_status(hapd, reply, reply_size);
1399 reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
1401 res = wpa_get_mib(hapd->wpa_auth, reply + reply_len,
1409 res = ieee802_1x_get_mib(hapd, reply + reply_len,
1418 res = radius_client_get_mib(hapd->radius,
1428 reply_len = hostapd_ctrl_iface_mib(hapd, reply, reply_size,
1431 reply_len = hostapd_ctrl_iface_sta_first(hapd, reply,
1434 reply_len = hostapd_ctrl_iface_sta(hapd, buf + 4, reply,
1437 reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
1440 if (hostapd_ctrl_iface_attach(hapd, &from, fromlen))
1443 if (hostapd_ctrl_iface_detach(hapd, &from, fromlen))
1446 if (hostapd_ctrl_iface_level(hapd, &from, fromlen,
1450 if (hostapd_ctrl_iface_new_sta(hapd, buf + 8))
1453 if (hostapd_ctrl_iface_deauthenticate(hapd, buf + 15))
1456 if (hostapd_ctrl_iface_disassociate(hapd, buf + 13))
1461 hapd, buf + 9))
1467 if (hostapd_ctrl_iface_wps_pin(hapd, buf + 8))
1471 hapd, buf + 14, reply, reply_size);
1473 if (hostapd_wps_button_pushed(hapd, NULL))
1476 if (hostapd_wps_cancel(hapd))
1479 reply_len = hostapd_ctrl_iface_wps_ap_pin(hapd, buf + 11,
1482 if (hostapd_ctrl_iface_wps_config(hapd, buf + 11) < 0)
1485 reply_len = hostapd_ctrl_iface_wps_get_status(hapd, reply,
1489 if (hostapd_ctrl_iface_wps_nfc_tag_read(hapd, buf + 17))
1493 hapd, buf + 21, reply, reply_size);
1496 hapd, buf + 14, reply, reply_size);
1499 hapd, buf + 21, reply, reply_size);
1501 if (hostapd_ctrl_iface_nfc_report_handover(hapd, buf + 20))
1507 if (hostapd_ctrl_iface_set_qos_map_set(hapd, buf + 16))
1510 if (hostapd_ctrl_iface_send_qos_map_conf(hapd, buf + 18))
1515 if (hostapd_ctrl_iface_hs20_wnm_notif(hapd, buf + 15))
1518 if (hostapd_ctrl_iface_hs20_deauth_req(hapd, buf + 16))
1523 if (hostapd_ctrl_iface_disassoc_imminent(hapd, buf + 18))
1526 if (hostapd_ctrl_iface_ess_disassoc(hapd, buf + 13))
1530 reply_len = hostapd_ctrl_iface_get_config(hapd, reply,
1533 if (hostapd_ctrl_iface_set(hapd, buf + 4))
1536 reply_len = hostapd_ctrl_iface_get(hapd, buf + 4, reply,
1539 if (hostapd_ctrl_iface_enable(hapd->iface))
1542 if (hostapd_ctrl_iface_reload(hapd->iface))
1545 if (hostapd_ctrl_iface_disable(hapd->iface))
1549 if (hostapd_ctrl_iface_radar(hapd, buf + 6))
1552 if (hostapd_ctrl_iface_mgmt_tx(hapd, buf + 8))
1556 if (hostapd_ctrl_iface_chan_switch(hapd->iface, buf + 12))
1559 reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
1576 static char * hostapd_ctrl_iface_path(struct hostapd_data *hapd)
1581 if (hapd->conf->ctrl_interface == NULL)
1584 len = os_strlen(hapd->conf->ctrl_interface) +
1585 os_strlen(hapd->conf->iface) + 2;
1591 hapd->conf->ctrl_interface, hapd->conf->iface);
1600 struct hostapd_data *hapd = ctx;
1601 if (hapd == NULL)
1603 hostapd_ctrl_iface_send(hapd, level, txt, len);
1607 int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
1613 if (hapd->ctrl_sock > -1) {
1618 if (hapd->conf->ctrl_interface == NULL)
1621 if (mkdir(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) {
1631 if (hapd->conf->ctrl_interface_gid_set &&
1632 chown(hapd->conf->ctrl_interface, -1,
1633 hapd->conf->ctrl_interface_gid) < 0) {
1638 if (!hapd->conf->ctrl_interface_gid_set &&
1639 hapd->iface->interfaces->ctrl_iface_group &&
1640 chown(hapd->conf->ctrl_interface, -1,
1641 hapd->iface->interfaces->ctrl_iface_group) < 0) {
1654 if (chmod(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) {
1661 if (os_strlen(hapd->conf->ctrl_interface) + 1 +
1662 os_strlen(hapd->conf->iface) >= sizeof(addr.sun_path))
1676 fname = hostapd_ctrl_iface_path(hapd);
1712 if (hapd->conf->ctrl_interface_gid_set &&
1713 chown(fname, -1, hapd->conf->ctrl_interface_gid) < 0) {
1718 if (!hapd->conf->ctrl_interface_gid_set &&
1719 hapd->iface->interfaces->ctrl_iface_group &&
1720 chown(fname, -1, hapd->iface->interfaces->ctrl_iface_group) < 0) {
1731 hapd->ctrl_sock = s;
1732 eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
1734 hapd->msg_ctx = hapd;
1750 void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd)
1754 if (hapd->ctrl_sock > -1) {
1756 eloop_unregister_read_sock(hapd->ctrl_sock);
1757 close(hapd->ctrl_sock);
1758 hapd->ctrl_sock = -1;
1759 fname = hostapd_ctrl_iface_path(hapd);
1764 if (hapd->conf->ctrl_interface &&
1765 rmdir(hapd->conf->ctrl_interface) < 0) {
1773 hapd->conf->ctrl_interface,
1779 dst = hapd->ctrl_dst;
2038 static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
2047 dst = hapd->ctrl_dst;
2048 if (hapd->ctrl_sock < 0 || dst == NULL)
2069 if (sendmsg(hapd->ctrl_sock, &msg, 0) < 0) {
2077 hapd, &dst->addr,