Lines Matching refs:hapd
59 static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
64 static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd, in hostapd_ctrl_iface_attach() argument
76 dst->next = hapd->ctrl_dst; in hostapd_ctrl_iface_attach()
77 hapd->ctrl_dst = dst; in hostapd_ctrl_iface_attach()
85 static int hostapd_ctrl_iface_detach(struct hostapd_data *hapd, in hostapd_ctrl_iface_detach() argument
91 dst = hapd->ctrl_dst; in hostapd_ctrl_iface_detach()
102 hapd->ctrl_dst = dst->next; in hostapd_ctrl_iface_detach()
115 static int hostapd_ctrl_iface_level(struct hostapd_data *hapd, in hostapd_ctrl_iface_level() argument
124 dst = hapd->ctrl_dst; in hostapd_ctrl_iface_level()
143 static int hostapd_ctrl_iface_new_sta(struct hostapd_data *hapd, in hostapd_ctrl_iface_new_sta() argument
154 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_new_sta()
160 sta = ap_sta_add(hapd, addr); in hostapd_ctrl_iface_new_sta()
164 hostapd_new_assoc_sta(hapd, sta, 0); in hostapd_ctrl_iface_new_sta()
171 static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, in hostapd_ctrl_iface_sa_query() argument
183 ieee802_11_send_sa_query_req(hapd, addr, trans_id); in hostapd_ctrl_iface_sa_query()
192 static int hostapd_ctrl_iface_wps_pin(struct hostapd_data *hapd, char *txt) in hostapd_ctrl_iface_wps_pin() argument
217 return hostapd_wps_add_pin(hapd, addr, txt, pin, timeout); in hostapd_ctrl_iface_wps_pin()
222 struct hostapd_data *hapd, char *cmd, char *buf, size_t buflen) in hostapd_ctrl_iface_wps_check_pin() argument
267 static int hostapd_ctrl_iface_wps_nfc_tag_read(struct hostapd_data *hapd, in hostapd_ctrl_iface_wps_nfc_tag_read() argument
287 ret = hostapd_wps_nfc_tag_read(hapd, buf); in hostapd_ctrl_iface_wps_nfc_tag_read()
294 static int hostapd_ctrl_iface_wps_nfc_config_token(struct hostapd_data *hapd, in hostapd_ctrl_iface_wps_nfc_config_token() argument
309 buf = hostapd_wps_nfc_config_token(hapd, ndef); in hostapd_ctrl_iface_wps_nfc_config_token()
324 static int hostapd_ctrl_iface_wps_nfc_token_gen(struct hostapd_data *hapd, in hostapd_ctrl_iface_wps_nfc_token_gen() argument
331 buf = hostapd_wps_nfc_token_gen(hapd, ndef); in hostapd_ctrl_iface_wps_nfc_token_gen()
346 static int hostapd_ctrl_iface_wps_nfc_token(struct hostapd_data *hapd, in hostapd_ctrl_iface_wps_nfc_token() argument
351 return hostapd_ctrl_iface_wps_nfc_token_gen(hapd, reply, in hostapd_ctrl_iface_wps_nfc_token()
355 return hostapd_ctrl_iface_wps_nfc_token_gen(hapd, reply, in hostapd_ctrl_iface_wps_nfc_token()
359 return hostapd_wps_nfc_token_enable(hapd); in hostapd_ctrl_iface_wps_nfc_token()
362 hostapd_wps_nfc_token_disable(hapd); in hostapd_ctrl_iface_wps_nfc_token()
370 static int hostapd_ctrl_iface_nfc_get_handover_sel(struct hostapd_data *hapd, in hostapd_ctrl_iface_nfc_get_handover_sel() argument
392 buf = hostapd_wps_nfc_hs_cr(hapd, ndef); in hostapd_ctrl_iface_nfc_get_handover_sel()
409 static int hostapd_ctrl_iface_nfc_report_handover(struct hostapd_data *hapd, in hostapd_ctrl_iface_nfc_report_handover() argument
466 ret = hostapd_wps_nfc_report_handover(hapd, req, sel); in hostapd_ctrl_iface_nfc_report_handover()
481 static int hostapd_ctrl_iface_wps_ap_pin(struct hostapd_data *hapd, char *txt, in hostapd_ctrl_iface_wps_ap_pin() argument
493 hostapd_wps_ap_pin_disable(hapd); in hostapd_ctrl_iface_wps_ap_pin()
500 pin_txt = hostapd_wps_ap_pin_random(hapd, timeout); in hostapd_ctrl_iface_wps_ap_pin()
507 pin_txt = hostapd_wps_ap_pin_get(hapd); in hostapd_ctrl_iface_wps_ap_pin()
525 if (hostapd_wps_ap_pin_set(hapd, pin, timeout) < 0) in hostapd_ctrl_iface_wps_ap_pin()
534 static int hostapd_ctrl_iface_wps_config(struct hostapd_data *hapd, char *txt) in hostapd_ctrl_iface_wps_config() argument
557 return hostapd_wps_config_ap(hapd, ssid, auth, encr, key); in hostapd_ctrl_iface_wps_config()
578 static int hostapd_ctrl_iface_wps_get_status(struct hostapd_data *hapd, in hostapd_ctrl_iface_wps_get_status() argument
588 pbc_status_str(hapd->wps_stats.pbc_status)); in hostapd_ctrl_iface_wps_get_status()
595 (hapd->wps_stats.status == WPS_STATUS_SUCCESS ? in hostapd_ctrl_iface_wps_get_status()
597 (hapd->wps_stats.status == WPS_STATUS_FAILURE ? in hostapd_ctrl_iface_wps_get_status()
605 if(hapd->wps_stats.status == WPS_STATUS_FAILURE && in hostapd_ctrl_iface_wps_get_status()
606 hapd->wps_stats.failure_reason > 0) { in hostapd_ctrl_iface_wps_get_status()
609 wps_ei_str(hapd->wps_stats.failure_reason)); in hostapd_ctrl_iface_wps_get_status()
616 if (hapd->wps_stats.status) { in hostapd_ctrl_iface_wps_get_status()
618 MAC2STR(hapd->wps_stats.peer_addr)); in hostapd_ctrl_iface_wps_get_status()
632 static int hostapd_ctrl_iface_hs20_wnm_notif(struct hostapd_data *hapd, in hostapd_ctrl_iface_hs20_wnm_notif() argument
651 return hs20_send_wnm_notification(hapd, addr, 1, url); in hostapd_ctrl_iface_hs20_wnm_notif()
655 static int hostapd_ctrl_iface_hs20_deauth_req(struct hostapd_data *hapd, in hostapd_ctrl_iface_hs20_deauth_req() argument
699 ret = hs20_send_wnm_notification_deauth_req(hapd, addr, req); in hostapd_ctrl_iface_hs20_deauth_req()
709 static int hostapd_ctrl_iface_set_qos_map_set(struct hostapd_data *hapd, in hostapd_ctrl_iface_set_qos_map_set() argument
740 ret = hostapd_drv_set_qos_map(hapd, qos_map_set, count); in hostapd_ctrl_iface_set_qos_map_set()
746 os_memcpy(hapd->conf->qos_map_set, qos_map_set, count); in hostapd_ctrl_iface_set_qos_map_set()
747 hapd->conf->qos_map_set_len = count; in hostapd_ctrl_iface_set_qos_map_set()
753 static int hostapd_ctrl_iface_send_qos_map_conf(struct hostapd_data *hapd, in hostapd_ctrl_iface_send_qos_map_conf() argument
759 u8 *qos_map_set = hapd->conf->qos_map_set; in hostapd_ctrl_iface_send_qos_map_conf()
760 u8 qos_map_set_len = hapd->conf->qos_map_set_len; in hostapd_ctrl_iface_send_qos_map_conf()
771 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_send_qos_map_conf()
797 ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, in hostapd_ctrl_iface_send_qos_map_conf()
809 static int hostapd_ctrl_iface_disassoc_imminent(struct hostapd_data *hapd, in hostapd_ctrl_iface_disassoc_imminent() argument
822 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_disassoc_imminent()
830 return wnm_send_disassoc_imminent(hapd, sta, disassoc_timer); in hostapd_ctrl_iface_disassoc_imminent()
834 static int hostapd_ctrl_iface_ess_disassoc(struct hostapd_data *hapd, in hostapd_ctrl_iface_ess_disassoc() argument
845 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_ess_disassoc()
866 return wnm_send_ess_disassoc_imminent(hapd, sta, url, disassoc_timer); in hostapd_ctrl_iface_ess_disassoc()
870 static int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd, in hostapd_ctrl_iface_bss_tm_req() argument
889 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_bss_tm_req()
1048 ret = wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, in hostapd_ctrl_iface_bss_tm_req()
1059 static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd, in hostapd_ctrl_iface_get_config() argument
1070 MAC2STR(hapd->own_addr), in hostapd_ctrl_iface_get_config()
1071 wpa_ssid_txt(hapd->conf->ssid.ssid, in hostapd_ctrl_iface_get_config()
1072 hapd->conf->ssid.ssid_len)); in hostapd_ctrl_iface_get_config()
1079 hapd->conf->wps_state == 0 ? "disabled" : in hostapd_ctrl_iface_get_config()
1080 (hapd->conf->wps_state == 1 ? "not configured" : in hostapd_ctrl_iface_get_config()
1086 if (hapd->conf->wps_state && hapd->conf->wpa && in hostapd_ctrl_iface_get_config()
1087 hapd->conf->ssid.wpa_passphrase) { in hostapd_ctrl_iface_get_config()
1089 hapd->conf->ssid.wpa_passphrase); in hostapd_ctrl_iface_get_config()
1095 if (hapd->conf->wps_state && hapd->conf->wpa && in hostapd_ctrl_iface_get_config()
1096 hapd->conf->ssid.wpa_psk && in hostapd_ctrl_iface_get_config()
1097 hapd->conf->ssid.wpa_psk->group) { in hostapd_ctrl_iface_get_config()
1100 hapd->conf->ssid.wpa_psk->psk, PMK_LEN); in hostapd_ctrl_iface_get_config()
1108 if (hapd->conf->wpa && hapd->conf->wpa_key_mgmt) { in hostapd_ctrl_iface_get_config()
1114 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK) { in hostapd_ctrl_iface_get_config()
1120 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X) { in hostapd_ctrl_iface_get_config()
1127 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_PSK) { in hostapd_ctrl_iface_get_config()
1133 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_IEEE8021X) { in hostapd_ctrl_iface_get_config()
1140 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_SAE) { in hostapd_ctrl_iface_get_config()
1149 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK_SHA256) { in hostapd_ctrl_iface_get_config()
1155 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X_SHA256) { in hostapd_ctrl_iface_get_config()
1163 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_SAE) { in hostapd_ctrl_iface_get_config()
1170 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X_SUITE_B) { in hostapd_ctrl_iface_get_config()
1176 if (hapd->conf->wpa_key_mgmt & in hostapd_ctrl_iface_get_config()
1191 if (hapd->conf->wpa) { in hostapd_ctrl_iface_get_config()
1193 wpa_cipher_txt(hapd->conf->wpa_group)); in hostapd_ctrl_iface_get_config()
1199 if ((hapd->conf->wpa & WPA_PROTO_RSN) && hapd->conf->rsn_pairwise) { in hostapd_ctrl_iface_get_config()
1205 ret = wpa_write_ciphers(pos, end, hapd->conf->rsn_pairwise, in hostapd_ctrl_iface_get_config()
1217 if ((hapd->conf->wpa & WPA_PROTO_WPA) && hapd->conf->wpa_pairwise) { in hostapd_ctrl_iface_get_config()
1223 ret = wpa_write_ciphers(pos, end, hapd->conf->wpa_pairwise, in hostapd_ctrl_iface_get_config()
1239 static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_set() argument
1265 hostapd_wps_update_ie(hapd); in hostapd_ctrl_iface_set()
1282 hapd->gas_frag_limit = val; in hostapd_ctrl_iface_set()
1286 hapd->ext_mgmt_frame_handling = atoi(value); in hostapd_ctrl_iface_set()
1288 hapd->ext_eapol_frame_io = atoi(value); in hostapd_ctrl_iface_set()
1294 ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value); in hostapd_ctrl_iface_set()
1299 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_ctrl_iface_set()
1301 hapd->conf->deny_mac, in hostapd_ctrl_iface_set()
1302 hapd->conf->num_deny_mac, sta->addr, in hostapd_ctrl_iface_set()
1306 hapd, sta, sta->addr, in hostapd_ctrl_iface_set()
1309 } else if (hapd->conf->macaddr_acl == DENY_UNLESS_ACCEPTED && in hostapd_ctrl_iface_set()
1311 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_ctrl_iface_set()
1313 hapd->conf->accept_mac, in hostapd_ctrl_iface_set()
1314 hapd->conf->num_accept_mac, in hostapd_ctrl_iface_set()
1318 hapd, sta, sta->addr, in hostapd_ctrl_iface_set()
1328 static int hostapd_ctrl_iface_get(struct hostapd_data *hapd, char *cmd, in hostapd_ctrl_iface_get() argument
1383 static int hostapd_ctrl_iface_radar(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_radar() argument
1436 wpa_supplicant_event(hapd, event, &data); in hostapd_ctrl_iface_radar()
1442 static int hostapd_ctrl_iface_mgmt_tx(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_mgmt_tx() argument
1464 res = hostapd_drv_send_mlme(hapd, buf, len, 0); in hostapd_ctrl_iface_mgmt_tx()
1470 static int hostapd_ctrl_iface_eapol_rx(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_eapol_rx() argument
1501 ieee802_1x_receive(hapd, src, buf, len); in hostapd_ctrl_iface_eapol_rx()
1530 struct hostapd_data *hapd = ctx; in hostapd_data_test_rx() local
1553 wpa_msg(hapd->msg_ctx, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR, in hostapd_data_test_rx()
1558 static int hostapd_ctrl_iface_data_test_config(struct hostapd_data *hapd, in hostapd_ctrl_iface_data_test_config() argument
1566 if (hapd->l2_test) { in hostapd_ctrl_iface_data_test_config()
1567 l2_packet_deinit(hapd->l2_test); in hostapd_ctrl_iface_data_test_config()
1568 hapd->l2_test = NULL; in hostapd_ctrl_iface_data_test_config()
1569 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, in hostapd_ctrl_iface_data_test_config()
1575 if (hapd->l2_test) in hostapd_ctrl_iface_data_test_config()
1582 ifname = hapd->conf->iface; in hostapd_ctrl_iface_data_test_config()
1584 hapd->l2_test = l2_packet_init(ifname, hapd->own_addr, in hostapd_ctrl_iface_data_test_config()
1586 hapd, 1); in hostapd_ctrl_iface_data_test_config()
1587 if (hapd->l2_test == NULL) in hostapd_ctrl_iface_data_test_config()
1590 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: Enabled"); in hostapd_ctrl_iface_data_test_config()
1596 static int hostapd_ctrl_iface_data_test_tx(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_data_test_tx() argument
1609 if (hapd->l2_test == NULL) in hostapd_ctrl_iface_data_test_tx()
1650 if (l2_packet_send(hapd->l2_test, dst, ETHERTYPE_IP, buf, in hostapd_ctrl_iface_data_test_tx()
1654 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: TX dst=" MACSTR in hostapd_ctrl_iface_data_test_tx()
1661 static int hostapd_ctrl_iface_data_test_frame(struct hostapd_data *hapd, in hostapd_ctrl_iface_data_test_frame() argument
1670 const char *ifname = hapd->conf->iface; in hostapd_ctrl_iface_data_test_frame()
1696 l2 = l2_packet_init(ifname, hapd->own_addr, ethertype, in hostapd_ctrl_iface_data_test_frame()
1697 hostapd_data_test_rx, hapd, 1); in hostapd_ctrl_iface_data_test_frame()
1702 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: TX frame res=%d", res); in hostapd_ctrl_iface_data_test_frame()
1712 static int hostapd_ctrl_test_alloc_fail(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_test_alloc_fail() argument
1736 static int hostapd_ctrl_get_alloc_fail(struct hostapd_data *hapd, in hostapd_ctrl_get_alloc_fail() argument
1781 static int hostapd_ctrl_iface_mib(struct hostapd_data *hapd, char *reply, in hostapd_ctrl_iface_mib() argument
1786 return radius_server_get_mib(hapd->radius_srv, reply, in hostapd_ctrl_iface_mib()
1794 static int hostapd_ctrl_iface_vendor(struct hostapd_data *hapd, char *cmd, in hostapd_ctrl_iface_vendor() argument
1837 ret = hostapd_drv_vendor_cmd(hapd, vendor_id, subcmd, data, data_len, in hostapd_ctrl_iface_vendor()
1854 struct hostapd_data *hapd = eloop_ctx; in hostapd_ctrl_iface_receive() local
1896 reply_len = hostapd_ctrl_iface_status(hapd, reply, in hostapd_ctrl_iface_receive()
1899 reply_len = hostapd_drv_status(hapd, reply, reply_size); in hostapd_ctrl_iface_receive()
1901 reply_len = ieee802_11_get_mib(hapd, reply, reply_size); in hostapd_ctrl_iface_receive()
1903 res = wpa_get_mib(hapd->wpa_auth, reply + reply_len, in hostapd_ctrl_iface_receive()
1911 res = ieee802_1x_get_mib(hapd, reply + reply_len, in hostapd_ctrl_iface_receive()
1920 res = radius_client_get_mib(hapd->radius, in hostapd_ctrl_iface_receive()
1930 reply_len = hostapd_ctrl_iface_mib(hapd, reply, reply_size, in hostapd_ctrl_iface_receive()
1933 reply_len = hostapd_ctrl_iface_sta_first(hapd, reply, in hostapd_ctrl_iface_receive()
1936 reply_len = hostapd_ctrl_iface_sta(hapd, buf + 4, reply, in hostapd_ctrl_iface_receive()
1939 reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, in hostapd_ctrl_iface_receive()
1942 if (hostapd_ctrl_iface_attach(hapd, &from, fromlen)) in hostapd_ctrl_iface_receive()
1945 if (hostapd_ctrl_iface_detach(hapd, &from, fromlen)) in hostapd_ctrl_iface_receive()
1948 if (hostapd_ctrl_iface_level(hapd, &from, fromlen, in hostapd_ctrl_iface_receive()
1952 if (hostapd_ctrl_iface_new_sta(hapd, buf + 8)) in hostapd_ctrl_iface_receive()
1955 if (hostapd_ctrl_iface_deauthenticate(hapd, buf + 15)) in hostapd_ctrl_iface_receive()
1958 if (hostapd_ctrl_iface_disassociate(hapd, buf + 13)) in hostapd_ctrl_iface_receive()
1961 if (hostapd_ctrl_iface_stop_ap(hapd)) in hostapd_ctrl_iface_receive()
1966 if (hostapd_ctrl_iface_sa_query(hapd, buf + 9)) in hostapd_ctrl_iface_receive()
1972 if (hostapd_ctrl_iface_wps_pin(hapd, buf + 8)) in hostapd_ctrl_iface_receive()
1976 hapd, buf + 14, reply, reply_size); in hostapd_ctrl_iface_receive()
1978 if (hostapd_wps_button_pushed(hapd, NULL)) in hostapd_ctrl_iface_receive()
1981 if (hostapd_wps_cancel(hapd)) in hostapd_ctrl_iface_receive()
1984 reply_len = hostapd_ctrl_iface_wps_ap_pin(hapd, buf + 11, in hostapd_ctrl_iface_receive()
1987 if (hostapd_ctrl_iface_wps_config(hapd, buf + 11) < 0) in hostapd_ctrl_iface_receive()
1990 reply_len = hostapd_ctrl_iface_wps_get_status(hapd, reply, in hostapd_ctrl_iface_receive()
1994 if (hostapd_ctrl_iface_wps_nfc_tag_read(hapd, buf + 17)) in hostapd_ctrl_iface_receive()
1998 hapd, buf + 21, reply, reply_size); in hostapd_ctrl_iface_receive()
2001 hapd, buf + 14, reply, reply_size); in hostapd_ctrl_iface_receive()
2004 hapd, buf + 21, reply, reply_size); in hostapd_ctrl_iface_receive()
2006 if (hostapd_ctrl_iface_nfc_report_handover(hapd, buf + 20)) in hostapd_ctrl_iface_receive()
2012 if (hostapd_ctrl_iface_set_qos_map_set(hapd, buf + 16)) in hostapd_ctrl_iface_receive()
2015 if (hostapd_ctrl_iface_send_qos_map_conf(hapd, buf + 18)) in hostapd_ctrl_iface_receive()
2020 if (hostapd_ctrl_iface_hs20_wnm_notif(hapd, buf + 15)) in hostapd_ctrl_iface_receive()
2023 if (hostapd_ctrl_iface_hs20_deauth_req(hapd, buf + 16)) in hostapd_ctrl_iface_receive()
2028 if (hostapd_ctrl_iface_disassoc_imminent(hapd, buf + 18)) in hostapd_ctrl_iface_receive()
2031 if (hostapd_ctrl_iface_ess_disassoc(hapd, buf + 13)) in hostapd_ctrl_iface_receive()
2034 if (hostapd_ctrl_iface_bss_tm_req(hapd, buf + 11)) in hostapd_ctrl_iface_receive()
2038 reply_len = hostapd_ctrl_iface_get_config(hapd, reply, in hostapd_ctrl_iface_receive()
2041 if (hostapd_ctrl_iface_set(hapd, buf + 4)) in hostapd_ctrl_iface_receive()
2044 reply_len = hostapd_ctrl_iface_get(hapd, buf + 4, reply, in hostapd_ctrl_iface_receive()
2047 if (hostapd_ctrl_iface_enable(hapd->iface)) in hostapd_ctrl_iface_receive()
2050 if (hostapd_ctrl_iface_reload(hapd->iface)) in hostapd_ctrl_iface_receive()
2053 if (hostapd_ctrl_iface_disable(hapd->iface)) in hostapd_ctrl_iface_receive()
2056 if (ieee802_11_set_beacon(hapd)) in hostapd_ctrl_iface_receive()
2060 if (hostapd_ctrl_iface_radar(hapd, buf + 6)) in hostapd_ctrl_iface_receive()
2063 if (hostapd_ctrl_iface_mgmt_tx(hapd, buf + 8)) in hostapd_ctrl_iface_receive()
2066 if (hostapd_ctrl_iface_eapol_rx(hapd, buf + 9) < 0) in hostapd_ctrl_iface_receive()
2069 if (hostapd_ctrl_iface_data_test_config(hapd, buf + 17) < 0) in hostapd_ctrl_iface_receive()
2072 if (hostapd_ctrl_iface_data_test_tx(hapd, buf + 13) < 0) in hostapd_ctrl_iface_receive()
2075 if (hostapd_ctrl_iface_data_test_frame(hapd, buf + 16) < 0) in hostapd_ctrl_iface_receive()
2078 if (hostapd_ctrl_test_alloc_fail(hapd, buf + 16) < 0) in hostapd_ctrl_iface_receive()
2081 reply_len = hostapd_ctrl_get_alloc_fail(hapd, reply, in hostapd_ctrl_iface_receive()
2085 if (hostapd_ctrl_iface_chan_switch(hapd->iface, buf + 12)) in hostapd_ctrl_iface_receive()
2088 reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, in hostapd_ctrl_iface_receive()
2091 ieee802_1x_erp_flush(hapd); in hostapd_ctrl_iface_receive()
2093 radius_server_erp_flush(hapd->radius_srv); in hostapd_ctrl_iface_receive()
2113 static char * hostapd_ctrl_iface_path(struct hostapd_data *hapd) in hostapd_ctrl_iface_path() argument
2118 if (hapd->conf->ctrl_interface == NULL) in hostapd_ctrl_iface_path()
2121 len = os_strlen(hapd->conf->ctrl_interface) + in hostapd_ctrl_iface_path()
2122 os_strlen(hapd->conf->iface) + 2; in hostapd_ctrl_iface_path()
2128 hapd->conf->ctrl_interface, hapd->conf->iface); in hostapd_ctrl_iface_path()
2138 struct hostapd_data *hapd = ctx; in hostapd_ctrl_iface_msg_cb() local
2139 if (hapd == NULL) in hostapd_ctrl_iface_msg_cb()
2141 hostapd_ctrl_iface_send(hapd, level, type, txt, len); in hostapd_ctrl_iface_msg_cb()
2145 int hostapd_ctrl_iface_init(struct hostapd_data *hapd) in hostapd_ctrl_iface_init() argument
2151 if (hapd->ctrl_sock > -1) { in hostapd_ctrl_iface_init()
2156 if (hapd->conf->ctrl_interface == NULL) in hostapd_ctrl_iface_init()
2159 if (mkdir(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) { in hostapd_ctrl_iface_init()
2170 if (hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
2171 chown(hapd->conf->ctrl_interface, -1, in hostapd_ctrl_iface_init()
2172 hapd->conf->ctrl_interface_gid) < 0) { in hostapd_ctrl_iface_init()
2178 if (!hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
2179 hapd->iface->interfaces->ctrl_iface_group && in hostapd_ctrl_iface_init()
2180 chown(hapd->conf->ctrl_interface, -1, in hostapd_ctrl_iface_init()
2181 hapd->iface->interfaces->ctrl_iface_group) < 0) { in hostapd_ctrl_iface_init()
2195 if (chmod(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) { in hostapd_ctrl_iface_init()
2202 if (os_strlen(hapd->conf->ctrl_interface) + 1 + in hostapd_ctrl_iface_init()
2203 os_strlen(hapd->conf->iface) >= sizeof(addr.sun_path)) in hostapd_ctrl_iface_init()
2217 fname = hostapd_ctrl_iface_path(hapd); in hostapd_ctrl_iface_init()
2254 if (hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
2255 chown(fname, -1, hapd->conf->ctrl_interface_gid) < 0) { in hostapd_ctrl_iface_init()
2261 if (!hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
2262 hapd->iface->interfaces->ctrl_iface_group && in hostapd_ctrl_iface_init()
2263 chown(fname, -1, hapd->iface->interfaces->ctrl_iface_group) < 0) { in hostapd_ctrl_iface_init()
2276 hapd->ctrl_sock = s; in hostapd_ctrl_iface_init()
2277 if (eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd, in hostapd_ctrl_iface_init()
2279 hostapd_ctrl_iface_deinit(hapd); in hostapd_ctrl_iface_init()
2282 hapd->msg_ctx = hapd; in hostapd_ctrl_iface_init()
2298 void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd) in hostapd_ctrl_iface_deinit() argument
2302 if (hapd->ctrl_sock > -1) { in hostapd_ctrl_iface_deinit()
2304 eloop_unregister_read_sock(hapd->ctrl_sock); in hostapd_ctrl_iface_deinit()
2305 close(hapd->ctrl_sock); in hostapd_ctrl_iface_deinit()
2306 hapd->ctrl_sock = -1; in hostapd_ctrl_iface_deinit()
2307 fname = hostapd_ctrl_iface_path(hapd); in hostapd_ctrl_iface_deinit()
2312 if (hapd->conf->ctrl_interface && in hostapd_ctrl_iface_deinit()
2313 rmdir(hapd->conf->ctrl_interface) < 0) { in hostapd_ctrl_iface_deinit()
2321 hapd->conf->ctrl_interface, in hostapd_ctrl_iface_deinit()
2327 dst = hapd->ctrl_dst; in hostapd_ctrl_iface_deinit()
2328 hapd->ctrl_dst = NULL; in hostapd_ctrl_iface_deinit()
2336 l2_packet_deinit(hapd->l2_test); in hostapd_ctrl_iface_deinit()
2337 hapd->l2_test = NULL; in hostapd_ctrl_iface_deinit()
2683 static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level, in hostapd_ctrl_iface_send() argument
2695 s = hapd->ctrl_sock; in hostapd_ctrl_iface_send()
2696 dst = hapd->ctrl_dst; in hostapd_ctrl_iface_send()
2698 s = hapd->iface->interfaces->global_ctrl_sock; in hostapd_ctrl_iface_send()
2699 dst = hapd->iface->interfaces->global_ctrl_dst; in hostapd_ctrl_iface_send()
2732 hapd, &dst->addr, in hostapd_ctrl_iface_send()
2736 hapd->iface->interfaces, in hostapd_ctrl_iface_send()