• Home
  • Raw
  • Download

Lines Matching refs:hapd

77 static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
82 static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd, in hostapd_ctrl_iface_attach() argument
86 return ctrl_iface_attach(&hapd->ctrl_dst, from, fromlen, input); in hostapd_ctrl_iface_attach()
90 static int hostapd_ctrl_iface_detach(struct hostapd_data *hapd, in hostapd_ctrl_iface_detach() argument
94 return ctrl_iface_detach(&hapd->ctrl_dst, from, fromlen); in hostapd_ctrl_iface_detach()
98 static int hostapd_ctrl_iface_level(struct hostapd_data *hapd, in hostapd_ctrl_iface_level() argument
103 return ctrl_iface_level(&hapd->ctrl_dst, from, fromlen, level); in hostapd_ctrl_iface_level()
107 static int hostapd_ctrl_iface_new_sta(struct hostapd_data *hapd, in hostapd_ctrl_iface_new_sta() argument
118 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_new_sta()
124 sta = ap_sta_add(hapd, addr); in hostapd_ctrl_iface_new_sta()
128 hostapd_new_assoc_sta(hapd, sta, 0); in hostapd_ctrl_iface_new_sta()
135 static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, in hostapd_ctrl_iface_sa_query() argument
147 ieee802_11_send_sa_query_req(hapd, addr, trans_id); in hostapd_ctrl_iface_sa_query()
156 static int hostapd_ctrl_iface_wps_pin(struct hostapd_data *hapd, char *txt) in hostapd_ctrl_iface_wps_pin() argument
181 return hostapd_wps_add_pin(hapd, addr, txt, pin, timeout); in hostapd_ctrl_iface_wps_pin()
186 struct hostapd_data *hapd, char *cmd, char *buf, size_t buflen) in hostapd_ctrl_iface_wps_check_pin() argument
231 static int hostapd_ctrl_iface_wps_nfc_tag_read(struct hostapd_data *hapd, in hostapd_ctrl_iface_wps_nfc_tag_read() argument
251 ret = hostapd_wps_nfc_tag_read(hapd, buf); in hostapd_ctrl_iface_wps_nfc_tag_read()
258 static int hostapd_ctrl_iface_wps_nfc_config_token(struct hostapd_data *hapd, in hostapd_ctrl_iface_wps_nfc_config_token() argument
273 buf = hostapd_wps_nfc_config_token(hapd, ndef); in hostapd_ctrl_iface_wps_nfc_config_token()
288 static int hostapd_ctrl_iface_wps_nfc_token_gen(struct hostapd_data *hapd, in hostapd_ctrl_iface_wps_nfc_token_gen() argument
295 buf = hostapd_wps_nfc_token_gen(hapd, ndef); in hostapd_ctrl_iface_wps_nfc_token_gen()
310 static int hostapd_ctrl_iface_wps_nfc_token(struct hostapd_data *hapd, in hostapd_ctrl_iface_wps_nfc_token() argument
315 return hostapd_ctrl_iface_wps_nfc_token_gen(hapd, reply, in hostapd_ctrl_iface_wps_nfc_token()
319 return hostapd_ctrl_iface_wps_nfc_token_gen(hapd, reply, in hostapd_ctrl_iface_wps_nfc_token()
323 return hostapd_wps_nfc_token_enable(hapd); in hostapd_ctrl_iface_wps_nfc_token()
326 hostapd_wps_nfc_token_disable(hapd); in hostapd_ctrl_iface_wps_nfc_token()
334 static int hostapd_ctrl_iface_nfc_get_handover_sel(struct hostapd_data *hapd, in hostapd_ctrl_iface_nfc_get_handover_sel() argument
356 buf = hostapd_wps_nfc_hs_cr(hapd, ndef); in hostapd_ctrl_iface_nfc_get_handover_sel()
373 static int hostapd_ctrl_iface_nfc_report_handover(struct hostapd_data *hapd, in hostapd_ctrl_iface_nfc_report_handover() argument
430 ret = hostapd_wps_nfc_report_handover(hapd, req, sel); in hostapd_ctrl_iface_nfc_report_handover()
445 static int hostapd_ctrl_iface_wps_ap_pin(struct hostapd_data *hapd, char *txt, in hostapd_ctrl_iface_wps_ap_pin() argument
457 hostapd_wps_ap_pin_disable(hapd); in hostapd_ctrl_iface_wps_ap_pin()
464 pin_txt = hostapd_wps_ap_pin_random(hapd, timeout); in hostapd_ctrl_iface_wps_ap_pin()
471 pin_txt = hostapd_wps_ap_pin_get(hapd); in hostapd_ctrl_iface_wps_ap_pin()
489 if (hostapd_wps_ap_pin_set(hapd, pin, timeout) < 0) in hostapd_ctrl_iface_wps_ap_pin()
498 static int hostapd_ctrl_iface_wps_config(struct hostapd_data *hapd, char *txt) in hostapd_ctrl_iface_wps_config() argument
521 return hostapd_wps_config_ap(hapd, ssid, auth, encr, key); in hostapd_ctrl_iface_wps_config()
542 static int hostapd_ctrl_iface_wps_get_status(struct hostapd_data *hapd, in hostapd_ctrl_iface_wps_get_status() argument
552 pbc_status_str(hapd->wps_stats.pbc_status)); in hostapd_ctrl_iface_wps_get_status()
559 (hapd->wps_stats.status == WPS_STATUS_SUCCESS ? in hostapd_ctrl_iface_wps_get_status()
561 (hapd->wps_stats.status == WPS_STATUS_FAILURE ? in hostapd_ctrl_iface_wps_get_status()
569 if(hapd->wps_stats.status == WPS_STATUS_FAILURE && in hostapd_ctrl_iface_wps_get_status()
570 hapd->wps_stats.failure_reason > 0) { in hostapd_ctrl_iface_wps_get_status()
573 wps_ei_str(hapd->wps_stats.failure_reason)); in hostapd_ctrl_iface_wps_get_status()
580 if (hapd->wps_stats.status) { in hostapd_ctrl_iface_wps_get_status()
582 MAC2STR(hapd->wps_stats.peer_addr)); in hostapd_ctrl_iface_wps_get_status()
596 static int hostapd_ctrl_iface_hs20_wnm_notif(struct hostapd_data *hapd, in hostapd_ctrl_iface_hs20_wnm_notif() argument
615 return hs20_send_wnm_notification(hapd, addr, 1, url); in hostapd_ctrl_iface_hs20_wnm_notif()
619 static int hostapd_ctrl_iface_hs20_deauth_req(struct hostapd_data *hapd, in hostapd_ctrl_iface_hs20_deauth_req() argument
663 ret = hs20_send_wnm_notification_deauth_req(hapd, addr, req); in hostapd_ctrl_iface_hs20_deauth_req()
673 static int hostapd_ctrl_iface_set_qos_map_set(struct hostapd_data *hapd, in hostapd_ctrl_iface_set_qos_map_set() argument
704 ret = hostapd_drv_set_qos_map(hapd, qos_map_set, count); in hostapd_ctrl_iface_set_qos_map_set()
710 os_memcpy(hapd->conf->qos_map_set, qos_map_set, count); in hostapd_ctrl_iface_set_qos_map_set()
711 hapd->conf->qos_map_set_len = count; in hostapd_ctrl_iface_set_qos_map_set()
717 static int hostapd_ctrl_iface_send_qos_map_conf(struct hostapd_data *hapd, in hostapd_ctrl_iface_send_qos_map_conf() argument
723 u8 *qos_map_set = hapd->conf->qos_map_set; in hostapd_ctrl_iface_send_qos_map_conf()
724 u8 qos_map_set_len = hapd->conf->qos_map_set_len; in hostapd_ctrl_iface_send_qos_map_conf()
735 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_send_qos_map_conf()
761 ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, in hostapd_ctrl_iface_send_qos_map_conf()
773 static int hostapd_ctrl_iface_disassoc_imminent(struct hostapd_data *hapd, in hostapd_ctrl_iface_disassoc_imminent() argument
786 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_disassoc_imminent()
794 return wnm_send_disassoc_imminent(hapd, sta, disassoc_timer); in hostapd_ctrl_iface_disassoc_imminent()
798 static int hostapd_ctrl_iface_ess_disassoc(struct hostapd_data *hapd, in hostapd_ctrl_iface_ess_disassoc() argument
809 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_ess_disassoc()
830 return wnm_send_ess_disassoc_imminent(hapd, sta, url, disassoc_timer); in hostapd_ctrl_iface_ess_disassoc()
834 static int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd, in hostapd_ctrl_iface_bss_tm_req() argument
855 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_bss_tm_req()
984 ret = wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, in hostapd_ctrl_iface_bss_tm_req()
996 static int hostapd_ctrl_iface_coloc_intf_req(struct hostapd_data *hapd, in hostapd_ctrl_iface_coloc_intf_req() argument
1009 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_coloc_intf_req()
1028 return wnm_send_coloc_intf_req(hapd, sta, auto_report, timeout); in hostapd_ctrl_iface_coloc_intf_req()
1034 static int hostapd_ctrl_iface_get_key_mgmt(struct hostapd_data *hapd, in hostapd_ctrl_iface_get_key_mgmt() argument
1043 WPA_ASSERT(hapd->conf->wpa_key_mgmt); in hostapd_ctrl_iface_get_key_mgmt()
1045 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK) { in hostapd_ctrl_iface_get_key_mgmt()
1051 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X) { in hostapd_ctrl_iface_get_key_mgmt()
1058 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_PSK) { in hostapd_ctrl_iface_get_key_mgmt()
1064 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_IEEE8021X) { in hostapd_ctrl_iface_get_key_mgmt()
1071 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_IEEE8021X_SHA384) { in hostapd_ctrl_iface_get_key_mgmt()
1079 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_SAE) { in hostapd_ctrl_iface_get_key_mgmt()
1087 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_FILS_SHA256) { in hostapd_ctrl_iface_get_key_mgmt()
1093 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_FILS_SHA384) { in hostapd_ctrl_iface_get_key_mgmt()
1102 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK_SHA256) { in hostapd_ctrl_iface_get_key_mgmt()
1108 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X_SHA256) { in hostapd_ctrl_iface_get_key_mgmt()
1116 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_SAE) { in hostapd_ctrl_iface_get_key_mgmt()
1123 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X_SUITE_B) { in hostapd_ctrl_iface_get_key_mgmt()
1129 if (hapd->conf->wpa_key_mgmt & in hostapd_ctrl_iface_get_key_mgmt()
1138 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FILS_SHA256) { in hostapd_ctrl_iface_get_key_mgmt()
1144 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FILS_SHA384) { in hostapd_ctrl_iface_get_key_mgmt()
1153 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) { in hostapd_ctrl_iface_get_key_mgmt()
1162 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP) { in hostapd_ctrl_iface_get_key_mgmt()
1179 static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd, in hostapd_ctrl_iface_get_config() argument
1190 MAC2STR(hapd->own_addr), in hostapd_ctrl_iface_get_config()
1191 wpa_ssid_txt(hapd->conf->ssid.ssid, in hostapd_ctrl_iface_get_config()
1192 hapd->conf->ssid.ssid_len)); in hostapd_ctrl_iface_get_config()
1199 hapd->conf->wps_state == 0 ? "disabled" : in hostapd_ctrl_iface_get_config()
1200 (hapd->conf->wps_state == 1 ? "not configured" : in hostapd_ctrl_iface_get_config()
1206 if (hapd->conf->wps_state && hapd->conf->wpa && in hostapd_ctrl_iface_get_config()
1207 hapd->conf->ssid.wpa_passphrase) { in hostapd_ctrl_iface_get_config()
1209 hapd->conf->ssid.wpa_passphrase); in hostapd_ctrl_iface_get_config()
1215 if (hapd->conf->wps_state && hapd->conf->wpa && in hostapd_ctrl_iface_get_config()
1216 hapd->conf->ssid.wpa_psk && in hostapd_ctrl_iface_get_config()
1217 hapd->conf->ssid.wpa_psk->group) { in hostapd_ctrl_iface_get_config()
1220 hapd->conf->ssid.wpa_psk->psk, PMK_LEN); in hostapd_ctrl_iface_get_config()
1228 if (hapd->conf->wpa) { in hostapd_ctrl_iface_get_config()
1229 ret = os_snprintf(pos, end - pos, "wpa=%d\n", hapd->conf->wpa); in hostapd_ctrl_iface_get_config()
1235 if (hapd->conf->wpa && hapd->conf->wpa_key_mgmt) { in hostapd_ctrl_iface_get_config()
1241 pos += hostapd_ctrl_iface_get_key_mgmt(hapd, pos, end - pos); in hostapd_ctrl_iface_get_config()
1249 if (hapd->conf->wpa) { in hostapd_ctrl_iface_get_config()
1251 wpa_cipher_txt(hapd->conf->wpa_group)); in hostapd_ctrl_iface_get_config()
1257 if ((hapd->conf->wpa & WPA_PROTO_RSN) && hapd->conf->rsn_pairwise) { in hostapd_ctrl_iface_get_config()
1263 ret = wpa_write_ciphers(pos, end, hapd->conf->rsn_pairwise, in hostapd_ctrl_iface_get_config()
1275 if ((hapd->conf->wpa & WPA_PROTO_WPA) && hapd->conf->wpa_pairwise) { in hostapd_ctrl_iface_get_config()
1281 ret = wpa_write_ciphers(pos, end, hapd->conf->wpa_pairwise, in hostapd_ctrl_iface_get_config()
1297 static void hostapd_disassoc_accept_mac(struct hostapd_data *hapd) in hostapd_disassoc_accept_mac() argument
1302 if (hapd->conf->macaddr_acl != DENY_UNLESS_ACCEPTED) in hostapd_disassoc_accept_mac()
1305 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_disassoc_accept_mac()
1306 if (!hostapd_maclist_found(hapd->conf->accept_mac, in hostapd_disassoc_accept_mac()
1307 hapd->conf->num_accept_mac, in hostapd_disassoc_accept_mac()
1311 ap_sta_disconnect(hapd, sta, sta->addr, in hostapd_disassoc_accept_mac()
1317 static void hostapd_disassoc_deny_mac(struct hostapd_data *hapd) in hostapd_disassoc_deny_mac() argument
1322 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_disassoc_deny_mac()
1323 if (hostapd_maclist_found(hapd->conf->deny_mac, in hostapd_disassoc_deny_mac()
1324 hapd->conf->num_deny_mac, sta->addr, in hostapd_disassoc_deny_mac()
1328 ap_sta_disconnect(hapd, sta, sta->addr, in hostapd_disassoc_deny_mac()
1333 static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_set() argument
1359 hostapd_wps_update_ie(hapd); in hostapd_ctrl_iface_set()
1372 hapd->ext_mgmt_frame_handling = atoi(value); in hostapd_ctrl_iface_set()
1374 hapd->ext_eapol_frame_io = atoi(value); in hostapd_ctrl_iface_set()
1377 os_free(hapd->dpp_config_obj_override); in hostapd_ctrl_iface_set()
1378 hapd->dpp_config_obj_override = os_strdup(value); in hostapd_ctrl_iface_set()
1380 os_free(hapd->dpp_discovery_override); in hostapd_ctrl_iface_set()
1381 hapd->dpp_discovery_override = os_strdup(value); in hostapd_ctrl_iface_set()
1383 os_free(hapd->dpp_groups_override); in hostapd_ctrl_iface_set()
1384 hapd->dpp_groups_override = os_strdup(value); in hostapd_ctrl_iface_set()
1387 hapd->dpp_ignore_netaccesskey_mismatch = atoi(value); in hostapd_ctrl_iface_set()
1396 if (!hapd->conf->mbo_enabled) in hostapd_ctrl_iface_set()
1403 hapd->mbo_assoc_disallow = val; in hostapd_ctrl_iface_set()
1404 ieee802_11_update_beacons(hapd->iface); in hostapd_ctrl_iface_set()
1413 os_free(hapd->dpp_configurator_params); in hostapd_ctrl_iface_set()
1414 hapd->dpp_configurator_params = os_strdup(value); in hostapd_ctrl_iface_set()
1417 ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value); in hostapd_ctrl_iface_set()
1422 hostapd_disassoc_deny_mac(hapd); in hostapd_ctrl_iface_set()
1424 hostapd_disassoc_accept_mac(hapd); in hostapd_ctrl_iface_set()
1427 hapd->parameter_set_count++; in hostapd_ctrl_iface_set()
1428 if (ieee802_11_update_beacons(hapd->iface)) in hostapd_ctrl_iface_set()
1438 static int hostapd_ctrl_iface_get(struct hostapd_data *hapd, char *cmd, in hostapd_ctrl_iface_get() argument
1492 hostapd_ctrl_iface_kick_mismatch_psk_sta_iter(struct hostapd_data *hapd, in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter() argument
1505 for (psk = hapd->conf->ssid.wpa_psk; pmk && psk; psk = psk->next) { in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1520 hostapd_drv_sta_deauth(hapd, sta->addr, reason); in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1521 ap_sta_deauthenticate(hapd, sta, reason); in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1527 static int hostapd_ctrl_iface_reload_wpa_psk(struct hostapd_data *hapd) in hostapd_ctrl_iface_reload_wpa_psk() argument
1529 struct hostapd_bss_config *conf = hapd->conf; in hostapd_ctrl_iface_reload_wpa_psk()
1541 ap_for_each_sta(hapd, hostapd_ctrl_iface_kick_mismatch_psk_sta_iter, in hostapd_ctrl_iface_reload_wpa_psk()
1550 static int hostapd_ctrl_iface_radar(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_radar() argument
1603 wpa_supplicant_event(hapd, event, &data); in hostapd_ctrl_iface_radar()
1609 static int hostapd_ctrl_iface_mgmt_tx(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_mgmt_tx() argument
1631 res = hostapd_drv_send_mlme(hapd, buf, len, 0); in hostapd_ctrl_iface_mgmt_tx()
1637 static int hostapd_ctrl_iface_mgmt_tx_status_process(struct hostapd_data *hapd, in hostapd_ctrl_iface_mgmt_tx_status_process() argument
1646 if (!hapd->ext_mgmt_frame_handling) in hostapd_ctrl_iface_mgmt_tx_status_process()
1688 hapd->ext_mgmt_frame_handling = 0; in hostapd_ctrl_iface_mgmt_tx_status_process()
1689 wpa_supplicant_event(hapd, EVENT_TX_STATUS, &event); in hostapd_ctrl_iface_mgmt_tx_status_process()
1690 hapd->ext_mgmt_frame_handling = 1; in hostapd_ctrl_iface_mgmt_tx_status_process()
1698 static int hostapd_ctrl_iface_mgmt_rx_process(struct hostapd_data *hapd, in hostapd_ctrl_iface_mgmt_rx_process() argument
1707 if (!hapd->ext_mgmt_frame_handling) in hostapd_ctrl_iface_mgmt_rx_process()
1758 hapd->ext_mgmt_frame_handling = 0; in hostapd_ctrl_iface_mgmt_rx_process()
1759 wpa_supplicant_event(hapd, EVENT_RX_MGMT, &event); in hostapd_ctrl_iface_mgmt_rx_process()
1760 hapd->ext_mgmt_frame_handling = 1; in hostapd_ctrl_iface_mgmt_rx_process()
1768 static int hostapd_ctrl_iface_eapol_rx(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_eapol_rx() argument
1799 ieee802_1x_receive(hapd, src, buf, len); in hostapd_ctrl_iface_eapol_rx()
1828 struct hostapd_data *hapd = ctx; in hostapd_data_test_rx() local
1851 wpa_msg(hapd->msg_ctx, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR, in hostapd_data_test_rx()
1856 static int hostapd_ctrl_iface_data_test_config(struct hostapd_data *hapd, in hostapd_ctrl_iface_data_test_config() argument
1864 if (hapd->l2_test) { in hostapd_ctrl_iface_data_test_config()
1865 l2_packet_deinit(hapd->l2_test); in hostapd_ctrl_iface_data_test_config()
1866 hapd->l2_test = NULL; in hostapd_ctrl_iface_data_test_config()
1867 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, in hostapd_ctrl_iface_data_test_config()
1873 if (hapd->l2_test) in hostapd_ctrl_iface_data_test_config()
1880 ifname = hapd->conf->iface; in hostapd_ctrl_iface_data_test_config()
1882 hapd->l2_test = l2_packet_init(ifname, hapd->own_addr, in hostapd_ctrl_iface_data_test_config()
1884 hapd, 1); in hostapd_ctrl_iface_data_test_config()
1885 if (hapd->l2_test == NULL) in hostapd_ctrl_iface_data_test_config()
1888 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: Enabled"); in hostapd_ctrl_iface_data_test_config()
1894 static int hostapd_ctrl_iface_data_test_tx(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_data_test_tx() argument
1907 if (hapd->l2_test == NULL) in hostapd_ctrl_iface_data_test_tx()
1948 if (l2_packet_send(hapd->l2_test, dst, ETHERTYPE_IP, &buf[2], in hostapd_ctrl_iface_data_test_tx()
1952 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: TX dst=" MACSTR in hostapd_ctrl_iface_data_test_tx()
1959 static int hostapd_ctrl_iface_data_test_frame(struct hostapd_data *hapd, in hostapd_ctrl_iface_data_test_frame() argument
1968 const char *ifname = hapd->conf->iface; in hostapd_ctrl_iface_data_test_frame()
1994 l2 = l2_packet_init(ifname, hapd->own_addr, ethertype, in hostapd_ctrl_iface_data_test_frame()
1995 hostapd_data_test_rx, hapd, 1); in hostapd_ctrl_iface_data_test_frame()
2000 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: TX frame res=%d", res); in hostapd_ctrl_iface_data_test_frame()
2010 static int hostapd_ctrl_test_alloc_fail(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_test_alloc_fail() argument
2032 static int hostapd_ctrl_get_alloc_fail(struct hostapd_data *hapd, in hostapd_ctrl_get_alloc_fail() argument
2044 static int hostapd_ctrl_test_fail(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_test_fail() argument
2066 static int hostapd_ctrl_get_fail(struct hostapd_data *hapd, in hostapd_ctrl_get_fail() argument
2078 static int hostapd_ctrl_reset_pn(struct hostapd_data *hapd, const char *cmd) in hostapd_ctrl_reset_pn() argument
2091 if (hapd->last_igtk_alg == WPA_ALG_NONE) in hostapd_ctrl_reset_pn()
2098 if (hostapd_drv_set_key(hapd->conf->iface, hapd, in hostapd_ctrl_reset_pn()
2099 hapd->last_igtk_alg, in hostapd_ctrl_reset_pn()
2101 hapd->last_igtk_key_idx, 1, NULL, 0, in hostapd_ctrl_reset_pn()
2102 zero, hapd->last_igtk_len) < 0) in hostapd_ctrl_reset_pn()
2106 return hostapd_drv_set_key(hapd->conf->iface, hapd, in hostapd_ctrl_reset_pn()
2107 hapd->last_igtk_alg, in hostapd_ctrl_reset_pn()
2109 hapd->last_igtk_key_idx, 1, NULL, 0, in hostapd_ctrl_reset_pn()
2110 hapd->last_igtk, in hostapd_ctrl_reset_pn()
2111 hapd->last_igtk_len); in hostapd_ctrl_reset_pn()
2116 if (hapd->last_gtk_alg == WPA_ALG_NONE) in hostapd_ctrl_reset_pn()
2123 if (hostapd_drv_set_key(hapd->conf->iface, hapd, in hostapd_ctrl_reset_pn()
2124 hapd->last_gtk_alg, in hostapd_ctrl_reset_pn()
2126 hapd->last_gtk_key_idx, 1, NULL, 0, in hostapd_ctrl_reset_pn()
2127 zero, hapd->last_gtk_len) < 0) in hostapd_ctrl_reset_pn()
2131 return hostapd_drv_set_key(hapd->conf->iface, hapd, in hostapd_ctrl_reset_pn()
2132 hapd->last_gtk_alg, in hostapd_ctrl_reset_pn()
2134 hapd->last_gtk_key_idx, 1, NULL, 0, in hostapd_ctrl_reset_pn()
2135 hapd->last_gtk, hapd->last_gtk_len); in hostapd_ctrl_reset_pn()
2138 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_reset_pn()
2150 if (hostapd_drv_set_key(hapd->conf->iface, hapd, sta->last_tk_alg, in hostapd_ctrl_reset_pn()
2156 return hostapd_drv_set_key(hapd->conf->iface, hapd, sta->last_tk_alg, in hostapd_ctrl_reset_pn()
2162 static int hostapd_ctrl_set_key(struct hostapd_data *hapd, const char *cmd) in hostapd_ctrl_set_key() argument
2205 return hostapd_drv_set_key(hapd->conf->iface, hapd, alg, addr, idx, in hostapd_ctrl_set_key()
2212 struct hostapd_data *hapd = ctx1; in restore_tk() local
2220 hostapd_drv_set_key(hapd->conf->iface, hapd, sta->last_tk_alg, in restore_tk()
2226 static int hostapd_ctrl_resend_m1(struct hostapd_data *hapd, const char *cmd) in hostapd_ctrl_resend_m1() argument
2235 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_resend_m1()
2244 hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_NONE, in hostapd_ctrl_resend_m1()
2252 plain ? restore_tk : NULL, hapd, sta); in hostapd_ctrl_resend_m1()
2256 static int hostapd_ctrl_resend_m3(struct hostapd_data *hapd, const char *cmd) in hostapd_ctrl_resend_m3() argument
2265 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_resend_m3()
2274 hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_NONE, in hostapd_ctrl_resend_m3()
2281 plain ? restore_tk : NULL, hapd, sta); in hostapd_ctrl_resend_m3()
2285 static int hostapd_ctrl_resend_group_m1(struct hostapd_data *hapd, in hostapd_ctrl_resend_group_m1() argument
2295 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_resend_group_m1()
2304 hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_NONE, in hostapd_ctrl_resend_group_m1()
2313 plain ? restore_tk : NULL, hapd, sta); in hostapd_ctrl_resend_group_m1()
2352 static int hostapd_ctrl_iface_mib(struct hostapd_data *hapd, char *reply, in hostapd_ctrl_iface_mib() argument
2357 return radius_server_get_mib(hapd->radius_srv, reply, in hostapd_ctrl_iface_mib()
2365 static int hostapd_ctrl_iface_vendor(struct hostapd_data *hapd, char *cmd, in hostapd_ctrl_iface_vendor() argument
2408 ret = hostapd_drv_vendor_cmd(hapd, vendor_id, subcmd, data, data_len, in hostapd_ctrl_iface_vendor()
2422 static int hostapd_ctrl_iface_eapol_reauth(struct hostapd_data *hapd, in hostapd_ctrl_iface_eapol_reauth() argument
2431 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_eapol_reauth()
2440 static int hostapd_ctrl_iface_eapol_set(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_eapol_set() argument
2455 sta = ap_get_sta(hapd, addr); in hostapd_ctrl_iface_eapol_set()
2463 static int hostapd_ctrl_iface_log_level(struct hostapd_data *hapd, char *cmd, in hostapd_ctrl_iface_log_level() argument
2510 static int hostapd_ctrl_iface_track_sta_list(struct hostapd_data *hapd, in hostapd_ctrl_iface_track_sta_list() argument
2513 struct hostapd_iface *iface = hapd->iface; in hostapd_ctrl_iface_track_sta_list()
2546 static int hostapd_ctrl_iface_req_lci(struct hostapd_data *hapd, in hostapd_ctrl_iface_req_lci() argument
2556 return hostapd_send_lci_req(hapd, addr); in hostapd_ctrl_iface_req_lci()
2560 static int hostapd_ctrl_iface_req_range(struct hostapd_data *hapd, char *cmd) in hostapd_ctrl_iface_req_range() argument
2614 return hostapd_send_range_req(hapd, addr, random_interval, min_ap, in hostapd_ctrl_iface_req_range()
2619 static int hostapd_ctrl_iface_req_beacon(struct hostapd_data *hapd, in hostapd_ctrl_iface_req_beacon() argument
2651 ret = hostapd_send_beacon_req(hapd, addr, req_mode, req); in hostapd_ctrl_iface_req_beacon()
2659 static int hostapd_ctrl_iface_set_neighbor(struct hostapd_data *hapd, char *buf) in hostapd_ctrl_iface_set_neighbor() argument
2668 if (!(hapd->conf->radio_measurements[0] & in hostapd_ctrl_iface_set_neighbor()
2750 ret = hostapd_neighbor_set(hapd, bssid, &ssid, nr, lci, civic, in hostapd_ctrl_iface_set_neighbor()
2761 static int hostapd_ctrl_iface_remove_neighbor(struct hostapd_data *hapd, in hostapd_ctrl_iface_remove_neighbor() argument
2780 return hostapd_neighbor_remove(hapd, bssid, &ssid); in hostapd_ctrl_iface_remove_neighbor()
2886 static int hostapd_ctrl_iface_get_capability(struct hostapd_data *hapd, in hostapd_ctrl_iface_get_capability() argument
2914 static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, in hostapd_ctrl_iface_receive_process() argument
2934 reply_len = hostapd_ctrl_iface_status(hapd, reply, in hostapd_ctrl_iface_receive_process()
2937 reply_len = hostapd_drv_status(hapd, reply, reply_size); in hostapd_ctrl_iface_receive_process()
2939 reply_len = ieee802_11_get_mib(hapd, reply, reply_size); in hostapd_ctrl_iface_receive_process()
2941 res = wpa_get_mib(hapd->wpa_auth, reply + reply_len, in hostapd_ctrl_iface_receive_process()
2949 res = ieee802_1x_get_mib(hapd, reply + reply_len, in hostapd_ctrl_iface_receive_process()
2958 res = radius_client_get_mib(hapd->radius, in hostapd_ctrl_iface_receive_process()
2968 reply_len = hostapd_ctrl_iface_mib(hapd, reply, reply_size, in hostapd_ctrl_iface_receive_process()
2971 reply_len = hostapd_ctrl_iface_sta_first(hapd, reply, in hostapd_ctrl_iface_receive_process()
2974 reply_len = hostapd_ctrl_iface_sta(hapd, buf + 4, reply, in hostapd_ctrl_iface_receive_process()
2977 reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, in hostapd_ctrl_iface_receive_process()
2980 if (hostapd_ctrl_iface_attach(hapd, from, fromlen, NULL)) in hostapd_ctrl_iface_receive_process()
2983 if (hostapd_ctrl_iface_attach(hapd, from, fromlen, buf + 7)) in hostapd_ctrl_iface_receive_process()
2986 if (hostapd_ctrl_iface_detach(hapd, from, fromlen)) in hostapd_ctrl_iface_receive_process()
2989 if (hostapd_ctrl_iface_level(hapd, from, fromlen, in hostapd_ctrl_iface_receive_process()
2993 if (hostapd_ctrl_iface_new_sta(hapd, buf + 8)) in hostapd_ctrl_iface_receive_process()
2996 if (hostapd_ctrl_iface_deauthenticate(hapd, buf + 15)) in hostapd_ctrl_iface_receive_process()
2999 if (hostapd_ctrl_iface_disassociate(hapd, buf + 13)) in hostapd_ctrl_iface_receive_process()
3003 reply_len = hostapd_ctrl_iface_signature(hapd, buf + 10, in hostapd_ctrl_iface_receive_process()
3007 if (hostapd_ctrl_iface_poll_sta(hapd, buf + 9)) in hostapd_ctrl_iface_receive_process()
3010 if (hostapd_ctrl_iface_stop_ap(hapd)) in hostapd_ctrl_iface_receive_process()
3015 if (hostapd_ctrl_iface_sa_query(hapd, buf + 9)) in hostapd_ctrl_iface_receive_process()
3021 if (hostapd_ctrl_iface_wps_pin(hapd, buf + 8)) in hostapd_ctrl_iface_receive_process()
3025 hapd, buf + 14, reply, reply_size); in hostapd_ctrl_iface_receive_process()
3027 if (hostapd_wps_button_pushed(hapd, NULL)) in hostapd_ctrl_iface_receive_process()
3030 if (hostapd_wps_cancel(hapd)) in hostapd_ctrl_iface_receive_process()
3033 reply_len = hostapd_ctrl_iface_wps_ap_pin(hapd, buf + 11, in hostapd_ctrl_iface_receive_process()
3036 if (hostapd_ctrl_iface_wps_config(hapd, buf + 11) < 0) in hostapd_ctrl_iface_receive_process()
3039 reply_len = hostapd_ctrl_iface_wps_get_status(hapd, reply, in hostapd_ctrl_iface_receive_process()
3043 if (hostapd_ctrl_iface_wps_nfc_tag_read(hapd, buf + 17)) in hostapd_ctrl_iface_receive_process()
3047 hapd, buf + 21, reply, reply_size); in hostapd_ctrl_iface_receive_process()
3050 hapd, buf + 14, reply, reply_size); in hostapd_ctrl_iface_receive_process()
3053 hapd, buf + 21, reply, reply_size); in hostapd_ctrl_iface_receive_process()
3055 if (hostapd_ctrl_iface_nfc_report_handover(hapd, buf + 20)) in hostapd_ctrl_iface_receive_process()
3061 if (hostapd_ctrl_iface_set_qos_map_set(hapd, buf + 16)) in hostapd_ctrl_iface_receive_process()
3064 if (hostapd_ctrl_iface_send_qos_map_conf(hapd, buf + 18)) in hostapd_ctrl_iface_receive_process()
3069 if (hostapd_ctrl_iface_hs20_wnm_notif(hapd, buf + 15)) in hostapd_ctrl_iface_receive_process()
3072 if (hostapd_ctrl_iface_hs20_deauth_req(hapd, buf + 16)) in hostapd_ctrl_iface_receive_process()
3077 if (hostapd_ctrl_iface_disassoc_imminent(hapd, buf + 18)) in hostapd_ctrl_iface_receive_process()
3080 if (hostapd_ctrl_iface_ess_disassoc(hapd, buf + 13)) in hostapd_ctrl_iface_receive_process()
3083 if (hostapd_ctrl_iface_bss_tm_req(hapd, buf + 11)) in hostapd_ctrl_iface_receive_process()
3086 if (hostapd_ctrl_iface_coloc_intf_req(hapd, buf + 15)) in hostapd_ctrl_iface_receive_process()
3090 reply_len = hostapd_ctrl_iface_get_config(hapd, reply, in hostapd_ctrl_iface_receive_process()
3093 if (hostapd_ctrl_iface_set(hapd, buf + 4)) in hostapd_ctrl_iface_receive_process()
3096 reply_len = hostapd_ctrl_iface_get(hapd, buf + 4, reply, in hostapd_ctrl_iface_receive_process()
3099 if (hostapd_ctrl_iface_enable(hapd->iface)) in hostapd_ctrl_iface_receive_process()
3102 if (hostapd_ctrl_iface_reload_wpa_psk(hapd)) in hostapd_ctrl_iface_receive_process()
3105 if (hostapd_ctrl_iface_reload(hapd->iface)) in hostapd_ctrl_iface_receive_process()
3108 if (hostapd_ctrl_iface_disable(hapd->iface)) in hostapd_ctrl_iface_receive_process()
3111 if (ieee802_11_set_beacon(hapd)) in hostapd_ctrl_iface_receive_process()
3115 if (hostapd_ctrl_iface_radar(hapd, buf + 6)) in hostapd_ctrl_iface_receive_process()
3118 if (hostapd_ctrl_iface_mgmt_tx(hapd, buf + 8)) in hostapd_ctrl_iface_receive_process()
3121 if (hostapd_ctrl_iface_mgmt_tx_status_process(hapd, in hostapd_ctrl_iface_receive_process()
3125 if (hostapd_ctrl_iface_mgmt_rx_process(hapd, buf + 16) < 0) in hostapd_ctrl_iface_receive_process()
3128 if (hostapd_ctrl_iface_eapol_rx(hapd, buf + 9) < 0) in hostapd_ctrl_iface_receive_process()
3131 if (hostapd_ctrl_iface_data_test_config(hapd, buf + 17) < 0) in hostapd_ctrl_iface_receive_process()
3134 if (hostapd_ctrl_iface_data_test_tx(hapd, buf + 13) < 0) in hostapd_ctrl_iface_receive_process()
3137 if (hostapd_ctrl_iface_data_test_frame(hapd, buf + 16) < 0) in hostapd_ctrl_iface_receive_process()
3140 if (hostapd_ctrl_test_alloc_fail(hapd, buf + 16) < 0) in hostapd_ctrl_iface_receive_process()
3143 reply_len = hostapd_ctrl_get_alloc_fail(hapd, reply, in hostapd_ctrl_iface_receive_process()
3146 if (hostapd_ctrl_test_fail(hapd, buf + 10) < 0) in hostapd_ctrl_iface_receive_process()
3149 reply_len = hostapd_ctrl_get_fail(hapd, reply, reply_size); in hostapd_ctrl_iface_receive_process()
3151 if (hostapd_ctrl_reset_pn(hapd, buf + 9) < 0) in hostapd_ctrl_iface_receive_process()
3154 if (hostapd_ctrl_set_key(hapd, buf + 8) < 0) in hostapd_ctrl_iface_receive_process()
3157 if (hostapd_ctrl_resend_m1(hapd, buf + 10) < 0) in hostapd_ctrl_iface_receive_process()
3160 if (hostapd_ctrl_resend_m3(hapd, buf + 10) < 0) in hostapd_ctrl_iface_receive_process()
3163 if (hostapd_ctrl_resend_group_m1(hapd, buf + 16) < 0) in hostapd_ctrl_iface_receive_process()
3166 if (wpa_auth_rekey_gtk(hapd->wpa_auth) < 0) in hostapd_ctrl_iface_receive_process()
3170 if (hostapd_ctrl_iface_chan_switch(hapd->iface, buf + 12)) in hostapd_ctrl_iface_receive_process()
3173 reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, in hostapd_ctrl_iface_receive_process()
3176 ieee802_1x_erp_flush(hapd); in hostapd_ctrl_iface_receive_process()
3178 radius_server_erp_flush(hapd->radius_srv); in hostapd_ctrl_iface_receive_process()
3181 if (hostapd_ctrl_iface_eapol_reauth(hapd, buf + 13)) in hostapd_ctrl_iface_receive_process()
3184 if (hostapd_ctrl_iface_eapol_set(hapd, buf + 10)) in hostapd_ctrl_iface_receive_process()
3188 hapd, buf + 9, reply, reply_size); in hostapd_ctrl_iface_receive_process()
3192 hapd, reply, reply_size); in hostapd_ctrl_iface_receive_process()
3195 reply_len = hostapd_ctrl_iface_pmksa_list(hapd, reply, in hostapd_ctrl_iface_receive_process()
3198 hostapd_ctrl_iface_pmksa_flush(hapd); in hostapd_ctrl_iface_receive_process()
3200 if (hostapd_ctrl_iface_pmksa_add(hapd, buf + 10) < 0) in hostapd_ctrl_iface_receive_process()
3203 if (hostapd_ctrl_iface_set_neighbor(hapd, buf + 13)) in hostapd_ctrl_iface_receive_process()
3206 if (hostapd_ctrl_iface_remove_neighbor(hapd, buf + 16)) in hostapd_ctrl_iface_receive_process()
3209 if (hostapd_ctrl_iface_req_lci(hapd, buf + 8)) in hostapd_ctrl_iface_receive_process()
3212 if (hostapd_ctrl_iface_req_range(hapd, buf + 10)) in hostapd_ctrl_iface_receive_process()
3215 reply_len = hostapd_ctrl_iface_req_beacon(hapd, buf + 11, in hostapd_ctrl_iface_receive_process()
3218 reply_len = hostapd_ctrl_driver_flags(hapd->iface, reply, in hostapd_ctrl_iface_receive_process()
3225 &hapd->conf->accept_mac, in hostapd_ctrl_iface_receive_process()
3226 &hapd->conf->num_accept_mac, buf + 19)) in hostapd_ctrl_iface_receive_process()
3227 hostapd_disassoc_accept_mac(hapd); in hostapd_ctrl_iface_receive_process()
3232 &hapd->conf->accept_mac, in hostapd_ctrl_iface_receive_process()
3233 &hapd->conf->num_accept_mac, buf + 19); in hostapd_ctrl_iface_receive_process()
3236 hapd->conf->accept_mac, in hostapd_ctrl_iface_receive_process()
3237 hapd->conf->num_accept_mac, reply, reply_size); in hostapd_ctrl_iface_receive_process()
3240 &hapd->conf->accept_mac, in hostapd_ctrl_iface_receive_process()
3241 &hapd->conf->num_accept_mac); in hostapd_ctrl_iface_receive_process()
3246 &hapd->conf->deny_mac, in hostapd_ctrl_iface_receive_process()
3247 &hapd->conf->num_deny_mac, buf + 17)) in hostapd_ctrl_iface_receive_process()
3248 hostapd_disassoc_deny_mac(hapd); in hostapd_ctrl_iface_receive_process()
3251 &hapd->conf->deny_mac, in hostapd_ctrl_iface_receive_process()
3252 &hapd->conf->num_deny_mac, buf + 17); in hostapd_ctrl_iface_receive_process()
3255 hapd->conf->deny_mac, in hostapd_ctrl_iface_receive_process()
3256 hapd->conf->num_deny_mac, reply, reply_size); in hostapd_ctrl_iface_receive_process()
3259 &hapd->conf->deny_mac, in hostapd_ctrl_iface_receive_process()
3260 &hapd->conf->num_deny_mac); in hostapd_ctrl_iface_receive_process()
3264 res = hostapd_dpp_qr_code(hapd, buf + 12); in hostapd_ctrl_iface_receive_process()
3273 res = dpp_bootstrap_gen(hapd->iface->interfaces->dpp, buf + 18); in hostapd_ctrl_iface_receive_process()
3282 if (dpp_bootstrap_remove(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
3288 uri = dpp_bootstrap_get_uri(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
3298 reply_len = dpp_bootstrap_info(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
3302 if (hostapd_dpp_auth_init(hapd, buf + 13) < 0) in hostapd_ctrl_iface_receive_process()
3305 if (hostapd_dpp_listen(hapd, buf + 11) < 0) in hostapd_ctrl_iface_receive_process()
3308 hostapd_dpp_stop(hapd); in hostapd_ctrl_iface_receive_process()
3309 hostapd_dpp_listen_stop(hapd); in hostapd_ctrl_iface_receive_process()
3311 res = dpp_configurator_add(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
3321 if (dpp_configurator_remove(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
3325 if (hostapd_dpp_configurator_sign(hapd, buf + 21) < 0) in hostapd_ctrl_iface_receive_process()
3329 hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
3333 res = hostapd_dpp_pkex_add(hapd, buf + 12); in hostapd_ctrl_iface_receive_process()
3342 if (hostapd_dpp_pkex_remove(hapd, buf + 16) < 0) in hostapd_ctrl_iface_receive_process()
3347 if (radius_server_dac_request(hapd->radius_srv, buf + 12) < 0) in hostapd_ctrl_iface_receive_process()
3352 hapd, buf + 15, reply, reply_size); in hostapd_ctrl_iface_receive_process()
3370 struct hostapd_data *hapd = eloop_ctx; in hostapd_ctrl_iface_receive() local
3435 reply_len = hostapd_ctrl_iface_receive_process(hapd, pos, in hostapd_ctrl_iface_receive()
3452 static char * hostapd_ctrl_iface_path(struct hostapd_data *hapd) in hostapd_ctrl_iface_path() argument
3457 if (hapd->conf->ctrl_interface == NULL) in hostapd_ctrl_iface_path()
3460 len = os_strlen(hapd->conf->ctrl_interface) + in hostapd_ctrl_iface_path()
3461 os_strlen(hapd->conf->iface) + 2; in hostapd_ctrl_iface_path()
3467 hapd->conf->ctrl_interface, hapd->conf->iface); in hostapd_ctrl_iface_path()
3478 struct hostapd_data *hapd = ctx; in hostapd_ctrl_iface_msg_cb() local
3479 if (hapd == NULL) in hostapd_ctrl_iface_msg_cb()
3481 hostapd_ctrl_iface_send(hapd, level, type, txt, len); in hostapd_ctrl_iface_msg_cb()
3485 int hostapd_ctrl_iface_init(struct hostapd_data *hapd) in hostapd_ctrl_iface_init() argument
3495 if (hapd->ctrl_sock > -1) { in hostapd_ctrl_iface_init()
3500 if (hapd->conf->ctrl_interface == NULL) in hostapd_ctrl_iface_init()
3503 pos = os_strstr(hapd->conf->ctrl_interface, "udp:"); in hostapd_ctrl_iface_init()
3513 dl_list_init(&hapd->ctrl_dst); in hostapd_ctrl_iface_init()
3514 hapd->ctrl_sock = -1; in hostapd_ctrl_iface_init()
3537 hapd->ctrl_sock = socket(res->ai_family, res->ai_socktype, in hostapd_ctrl_iface_init()
3539 if (hapd->ctrl_sock < 0) { in hostapd_ctrl_iface_init()
3544 if (bind(hapd->ctrl_sock, res->ai_addr, res->ai_addrlen) < 0) { in hostapd_ctrl_iface_init()
3558 os_free(hapd->conf->ctrl_interface); in hostapd_ctrl_iface_init()
3559 hapd->conf->ctrl_interface = tmp; in hostapd_ctrl_iface_init()
3563 if (eloop_register_read_sock(hapd->ctrl_sock, in hostapd_ctrl_iface_init()
3564 hostapd_ctrl_iface_receive, hapd, NULL) < in hostapd_ctrl_iface_init()
3566 hostapd_ctrl_iface_deinit(hapd); in hostapd_ctrl_iface_init()
3570 hapd->msg_ctx = hapd; in hostapd_ctrl_iface_init()
3576 if (hapd->ctrl_sock >= 0) in hostapd_ctrl_iface_init()
3577 close(hapd->ctrl_sock); in hostapd_ctrl_iface_init()
3584 if (hapd->ctrl_sock > -1) { in hostapd_ctrl_iface_init()
3589 dl_list_init(&hapd->ctrl_dst); in hostapd_ctrl_iface_init()
3591 if (hapd->conf->ctrl_interface == NULL) in hostapd_ctrl_iface_init()
3594 if (mkdir(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) { in hostapd_ctrl_iface_init()
3605 if (hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
3606 lchown(hapd->conf->ctrl_interface, -1, in hostapd_ctrl_iface_init()
3607 hapd->conf->ctrl_interface_gid) < 0) { in hostapd_ctrl_iface_init()
3613 if (!hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
3614 hapd->iface->interfaces->ctrl_iface_group && in hostapd_ctrl_iface_init()
3615 lchown(hapd->conf->ctrl_interface, -1, in hostapd_ctrl_iface_init()
3616 hapd->iface->interfaces->ctrl_iface_group) < 0) { in hostapd_ctrl_iface_init()
3630 if (chmod(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) { in hostapd_ctrl_iface_init()
3637 if (os_strlen(hapd->conf->ctrl_interface) + 1 + in hostapd_ctrl_iface_init()
3638 os_strlen(hapd->conf->iface) >= sizeof(addr.sun_path)) in hostapd_ctrl_iface_init()
3652 fname = hostapd_ctrl_iface_path(hapd); in hostapd_ctrl_iface_init()
3689 if (hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
3690 lchown(fname, -1, hapd->conf->ctrl_interface_gid) < 0) { in hostapd_ctrl_iface_init()
3696 if (!hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
3697 hapd->iface->interfaces->ctrl_iface_group && in hostapd_ctrl_iface_init()
3698 lchown(fname, -1, hapd->iface->interfaces->ctrl_iface_group) < 0) { in hostapd_ctrl_iface_init()
3711 hapd->ctrl_sock = s; in hostapd_ctrl_iface_init()
3712 if (eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd, in hostapd_ctrl_iface_init()
3714 hostapd_ctrl_iface_deinit(hapd); in hostapd_ctrl_iface_init()
3717 hapd->msg_ctx = hapd; in hostapd_ctrl_iface_init()
3734 void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd) in hostapd_ctrl_iface_deinit() argument
3738 if (hapd->ctrl_sock > -1) { in hostapd_ctrl_iface_deinit()
3743 eloop_unregister_read_sock(hapd->ctrl_sock); in hostapd_ctrl_iface_deinit()
3744 close(hapd->ctrl_sock); in hostapd_ctrl_iface_deinit()
3745 hapd->ctrl_sock = -1; in hostapd_ctrl_iface_deinit()
3747 fname = hostapd_ctrl_iface_path(hapd); in hostapd_ctrl_iface_deinit()
3752 if (hapd->conf->ctrl_interface && in hostapd_ctrl_iface_deinit()
3753 rmdir(hapd->conf->ctrl_interface) < 0) { in hostapd_ctrl_iface_deinit()
3761 hapd->conf->ctrl_interface, in hostapd_ctrl_iface_deinit()
3768 dl_list_for_each_safe(dst, prev, &hapd->ctrl_dst, struct wpa_ctrl_dst, in hostapd_ctrl_iface_deinit()
3773 l2_packet_deinit(hapd->l2_test); in hostapd_ctrl_iface_deinit()
3774 hapd->l2_test = NULL; in hostapd_ctrl_iface_deinit()
3846 struct hostapd_data *hapd; in hostapd_global_ctrl_iface_fst_attach() local
3850 hapd = hostapd_get_iface(interfaces, ifname); in hostapd_global_ctrl_iface_fst_attach()
3851 if (hapd) { in hostapd_global_ctrl_iface_fst_attach()
3852 if (hapd->iface->fst) { in hostapd_global_ctrl_iface_fst_attach()
3856 fst_hostapd_fill_iface_obj(hapd, &iface_obj); in hostapd_global_ctrl_iface_fst_attach()
3857 hapd->iface->fst = fst_attach(ifname, hapd->own_addr, in hostapd_global_ctrl_iface_fst_attach()
3859 if (hapd->iface->fst) in hostapd_global_ctrl_iface_fst_attach()
3873 struct hostapd_data * hapd; in hostapd_global_ctrl_iface_fst_detach() local
3876 hapd = hostapd_get_iface(interfaces, ifname); in hostapd_global_ctrl_iface_fst_detach()
3877 if (hapd) { in hostapd_global_ctrl_iface_fst_detach()
3879 hapd->iface->fst = NULL; in hostapd_global_ctrl_iface_fst_detach()
3880 hapd->iface->fst_ies = NULL; in hostapd_global_ctrl_iface_fst_detach()
3902 struct hostapd_data *hapd; in hostapd_interfaces_get_hapd() local
3904 hapd = iface->bss[j]; in hostapd_interfaces_get_hapd()
3905 if (os_strcmp(ifname, hapd->conf->iface) == 0) in hostapd_interfaces_get_hapd()
3906 return hapd; in hostapd_interfaces_get_hapd()
4074 struct hostapd_data *hapd; in hostapd_global_ctrl_iface_ifname() local
4076 hapd = hostapd_interfaces_get_hapd(interfaces, ifname); in hostapd_global_ctrl_iface_ifname()
4077 if (hapd == NULL) { in hostapd_global_ctrl_iface_ifname()
4086 return hostapd_ctrl_iface_receive_process(hapd, buf, reply,reply_size, in hostapd_global_ctrl_iface_ifname()
4518 static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level, in hostapd_ctrl_iface_send() argument
4531 s = hapd->ctrl_sock; in hostapd_ctrl_iface_send()
4532 ctrl_dst = &hapd->ctrl_dst; in hostapd_ctrl_iface_send()
4534 s = hapd->iface->interfaces->global_ctrl_sock; in hostapd_ctrl_iface_send()
4535 ctrl_dst = &hapd->iface->interfaces->global_ctrl_dst; in hostapd_ctrl_iface_send()
4567 hapd, &dst->addr, in hostapd_ctrl_iface_send()
4571 hapd->iface->interfaces, in hostapd_ctrl_iface_send()