Lines Matching +full:ftm +full:- +full:src
2 * hostapd / UNIX domain socket -based control interface
3 * Copyright (c) 2004-2018, Jouni Malinen <j@w1.fi>
93 return ctrl_iface_attach(&hapd->ctrl_dst, from, fromlen, input); in hostapd_ctrl_iface_attach()
101 return ctrl_iface_detach(&hapd->ctrl_dst, from, fromlen); in hostapd_ctrl_iface_detach()
110 return ctrl_iface_level(&hapd->ctrl_dst, from, fromlen, level); in hostapd_ctrl_iface_level()
123 return -1; in hostapd_ctrl_iface_new_sta()
133 return -1; in hostapd_ctrl_iface_new_sta()
151 return -1; in hostapd_ctrl_iface_sa_query()
170 return -1; in hostapd_ctrl_iface_wps_pin()
206 return -1; in hostapd_ctrl_iface_wps_check_pin()
211 return -1; in hostapd_ctrl_iface_wps_check_pin()
220 ret = os_snprintf(buf, buflen, "FAIL-CHECKSUM\n"); in hostapd_ctrl_iface_wps_check_pin()
222 return -1; in hostapd_ctrl_iface_wps_check_pin()
229 return -1; in hostapd_ctrl_iface_wps_check_pin()
245 return -1; in hostapd_ctrl_iface_wps_nfc_tag_read()
250 return -1; in hostapd_ctrl_iface_wps_nfc_tag_read()
253 return -1; in hostapd_ctrl_iface_wps_nfc_tag_read()
276 return -1; in hostapd_ctrl_iface_wps_nfc_config_token()
280 return -1; in hostapd_ctrl_iface_wps_nfc_config_token()
302 return -1; in hostapd_ctrl_iface_wps_nfc_token_gen()
335 return -1; in hostapd_ctrl_iface_wps_nfc_token()
350 return -1; in hostapd_ctrl_iface_nfc_get_handover_sel()
358 return -1; in hostapd_ctrl_iface_nfc_get_handover_sel()
360 if (os_strcmp(pos, "WPS-CR") == 0) in hostapd_ctrl_iface_nfc_get_handover_sel()
365 return -1; in hostapd_ctrl_iface_nfc_get_handover_sel()
389 return -1; in hostapd_ctrl_iface_nfc_report_handover()
395 return -1; in hostapd_ctrl_iface_nfc_report_handover()
400 return -1; in hostapd_ctrl_iface_nfc_report_handover()
405 return -1; in hostapd_ctrl_iface_nfc_report_handover()
410 return -1; in hostapd_ctrl_iface_nfc_report_handover()
413 return -1; in hostapd_ctrl_iface_nfc_report_handover()
419 return -1; in hostapd_ctrl_iface_nfc_report_handover()
426 return -1; in hostapd_ctrl_iface_nfc_report_handover()
431 return -1; in hostapd_ctrl_iface_nfc_report_handover()
439 ret = -1; in hostapd_ctrl_iface_nfc_report_handover()
471 return -1; in hostapd_ctrl_iface_wps_ap_pin()
478 return -1; in hostapd_ctrl_iface_wps_ap_pin()
485 return -1; in hostapd_ctrl_iface_wps_ap_pin()
493 return -1; in hostapd_ctrl_iface_wps_ap_pin()
495 return -1; in hostapd_ctrl_iface_wps_ap_pin()
499 return -1; in hostapd_ctrl_iface_wps_ap_pin()
511 return -1; in hostapd_ctrl_iface_wps_config()
538 return "Timed-out"; in pbc_status_str()
556 ret = os_snprintf(pos, end - pos, "PBC Status: %s\n", in hostapd_ctrl_iface_wps_get_status()
557 pbc_status_str(hapd->wps_stats.pbc_status)); in hostapd_ctrl_iface_wps_get_status()
559 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_wps_get_status()
560 return pos - buf; in hostapd_ctrl_iface_wps_get_status()
563 ret = os_snprintf(pos, end - pos, "Last WPS result: %s\n", in hostapd_ctrl_iface_wps_get_status()
564 (hapd->wps_stats.status == WPS_STATUS_SUCCESS ? in hostapd_ctrl_iface_wps_get_status()
566 (hapd->wps_stats.status == WPS_STATUS_FAILURE ? in hostapd_ctrl_iface_wps_get_status()
569 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_wps_get_status()
570 return pos - buf; in hostapd_ctrl_iface_wps_get_status()
573 /* If status == Failure - Add possible Reasons */ in hostapd_ctrl_iface_wps_get_status()
574 if(hapd->wps_stats.status == WPS_STATUS_FAILURE && in hostapd_ctrl_iface_wps_get_status()
575 hapd->wps_stats.failure_reason > 0) { in hostapd_ctrl_iface_wps_get_status()
576 ret = os_snprintf(pos, end - pos, in hostapd_ctrl_iface_wps_get_status()
578 wps_ei_str(hapd->wps_stats.failure_reason)); in hostapd_ctrl_iface_wps_get_status()
580 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_wps_get_status()
581 return pos - buf; in hostapd_ctrl_iface_wps_get_status()
585 if (hapd->wps_stats.status) { in hostapd_ctrl_iface_wps_get_status()
586 ret = os_snprintf(pos, end - pos, "Peer Address: " MACSTR "\n", in hostapd_ctrl_iface_wps_get_status()
587 MAC2STR(hapd->wps_stats.peer_addr)); in hostapd_ctrl_iface_wps_get_status()
589 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_wps_get_status()
590 return pos - buf; in hostapd_ctrl_iface_wps_get_status()
594 return pos - buf; in hostapd_ctrl_iface_wps_get_status()
608 return -1; in hostapd_ctrl_iface_hs20_wnm_notif()
614 return -1; in hostapd_ctrl_iface_hs20_wnm_notif()
633 /* <STA MAC Addr> <Code(0/1)> <Re-auth-Delay(sec)> [URL] */ in hostapd_ctrl_iface_hs20_deauth_req()
635 return -1; in hostapd_ctrl_iface_hs20_deauth_req()
639 return -1; in hostapd_ctrl_iface_hs20_deauth_req()
645 return -1; in hostapd_ctrl_iface_hs20_deauth_req()
658 return -1; in hostapd_ctrl_iface_hs20_deauth_req()
665 wpa_printf(MSG_DEBUG, "HS 2.0: Send WNM-Notification to " MACSTR in hostapd_ctrl_iface_hs20_deauth_req()
688 return -1; in hostapd_ctrl_iface_set_qos_map_set()
694 return -1; in hostapd_ctrl_iface_set_qos_map_set()
706 return -1; in hostapd_ctrl_iface_set_qos_map_set()
712 return -1; in hostapd_ctrl_iface_set_qos_map_set()
715 os_memcpy(hapd->conf->qos_map_set, qos_map_set, count); in hostapd_ctrl_iface_set_qos_map_set()
716 hapd->conf->qos_map_set_len = count; in hostapd_ctrl_iface_set_qos_map_set()
728 u8 *qos_map_set = hapd->conf->qos_map_set; in hostapd_ctrl_iface_send_qos_map_conf()
729 u8 qos_map_set_len = hapd->conf->qos_map_set_len; in hostapd_ctrl_iface_send_qos_map_conf()
734 return -1; in hostapd_ctrl_iface_send_qos_map_conf()
738 return -1; in hostapd_ctrl_iface_send_qos_map_conf()
745 return -1; in hostapd_ctrl_iface_send_qos_map_conf()
748 if (!sta->qos_map_enabled) { in hostapd_ctrl_iface_send_qos_map_conf()
751 return -1; in hostapd_ctrl_iface_send_qos_map_conf()
756 return -1; in hostapd_ctrl_iface_send_qos_map_conf()
766 ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, in hostapd_ctrl_iface_send_qos_map_conf()
788 return -1; in hostapd_ctrl_iface_coloc_intf_req()
796 return -1; in hostapd_ctrl_iface_coloc_intf_req()
801 return -1; in hostapd_ctrl_iface_coloc_intf_req()
806 return -1; in hostapd_ctrl_iface_coloc_intf_req()
825 WPA_ASSERT(hapd->conf->wpa_key_mgmt); in hostapd_ctrl_iface_get_key_mgmt()
827 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK) { in hostapd_ctrl_iface_get_key_mgmt()
828 ret = os_snprintf(pos, end - pos, "WPA-PSK "); in hostapd_ctrl_iface_get_key_mgmt()
829 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
830 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
833 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X) { in hostapd_ctrl_iface_get_key_mgmt()
834 ret = os_snprintf(pos, end - pos, "WPA-EAP "); in hostapd_ctrl_iface_get_key_mgmt()
835 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
836 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
840 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_PSK) { in hostapd_ctrl_iface_get_key_mgmt()
841 ret = os_snprintf(pos, end - pos, "FT-PSK "); in hostapd_ctrl_iface_get_key_mgmt()
842 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
843 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
846 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_IEEE8021X) { in hostapd_ctrl_iface_get_key_mgmt()
847 ret = os_snprintf(pos, end - pos, "FT-EAP "); in hostapd_ctrl_iface_get_key_mgmt()
848 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
849 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
853 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_IEEE8021X_SHA384) { in hostapd_ctrl_iface_get_key_mgmt()
854 ret = os_snprintf(pos, end - pos, "FT-EAP-SHA384 "); in hostapd_ctrl_iface_get_key_mgmt()
855 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
856 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
861 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_SAE) { in hostapd_ctrl_iface_get_key_mgmt()
862 ret = os_snprintf(pos, end - pos, "FT-SAE "); in hostapd_ctrl_iface_get_key_mgmt()
863 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
864 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
867 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_SAE_EXT_KEY) { in hostapd_ctrl_iface_get_key_mgmt()
868 ret = os_snprintf(pos, end - pos, "FT-SAE-EXT-KEY "); in hostapd_ctrl_iface_get_key_mgmt()
869 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
870 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
875 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_FILS_SHA256) { in hostapd_ctrl_iface_get_key_mgmt()
876 ret = os_snprintf(pos, end - pos, "FT-FILS-SHA256 "); in hostapd_ctrl_iface_get_key_mgmt()
877 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
878 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
881 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_FILS_SHA384) { in hostapd_ctrl_iface_get_key_mgmt()
882 ret = os_snprintf(pos, end - pos, "FT-FILS-SHA384 "); in hostapd_ctrl_iface_get_key_mgmt()
883 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
884 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
889 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK_SHA256) { in hostapd_ctrl_iface_get_key_mgmt()
890 ret = os_snprintf(pos, end - pos, "WPA-PSK-SHA256 "); in hostapd_ctrl_iface_get_key_mgmt()
891 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
892 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
895 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X_SHA256) { in hostapd_ctrl_iface_get_key_mgmt()
896 ret = os_snprintf(pos, end - pos, "WPA-EAP-SHA256 "); in hostapd_ctrl_iface_get_key_mgmt()
897 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
898 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
902 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_SAE) { in hostapd_ctrl_iface_get_key_mgmt()
903 ret = os_snprintf(pos, end - pos, "SAE "); in hostapd_ctrl_iface_get_key_mgmt()
904 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
905 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
908 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_SAE_EXT_KEY) { in hostapd_ctrl_iface_get_key_mgmt()
909 ret = os_snprintf(pos, end - pos, "SAE-EXT-KEY "); in hostapd_ctrl_iface_get_key_mgmt()
910 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
911 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
915 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X_SUITE_B) { in hostapd_ctrl_iface_get_key_mgmt()
916 ret = os_snprintf(pos, end - pos, "WPA-EAP-SUITE-B "); in hostapd_ctrl_iface_get_key_mgmt()
917 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
918 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
921 if (hapd->conf->wpa_key_mgmt & in hostapd_ctrl_iface_get_key_mgmt()
923 ret = os_snprintf(pos, end - pos, in hostapd_ctrl_iface_get_key_mgmt()
924 "WPA-EAP-SUITE-B-192 "); in hostapd_ctrl_iface_get_key_mgmt()
925 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
926 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
930 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FILS_SHA256) { in hostapd_ctrl_iface_get_key_mgmt()
931 ret = os_snprintf(pos, end - pos, "FILS-SHA256 "); in hostapd_ctrl_iface_get_key_mgmt()
932 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
933 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
936 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FILS_SHA384) { in hostapd_ctrl_iface_get_key_mgmt()
937 ret = os_snprintf(pos, end - pos, "FILS-SHA384 "); in hostapd_ctrl_iface_get_key_mgmt()
938 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
939 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
945 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) { in hostapd_ctrl_iface_get_key_mgmt()
946 ret = os_snprintf(pos, end - pos, "OWE "); in hostapd_ctrl_iface_get_key_mgmt()
947 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
948 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
954 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP) { in hostapd_ctrl_iface_get_key_mgmt()
955 ret = os_snprintf(pos, end - pos, "DPP "); in hostapd_ctrl_iface_get_key_mgmt()
956 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
957 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
962 if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X_SHA384) { in hostapd_ctrl_iface_get_key_mgmt()
963 ret = os_snprintf(pos, end - pos, "WPA-EAP-SHA384 "); in hostapd_ctrl_iface_get_key_mgmt()
964 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_key_mgmt()
965 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
970 if (pos > buf && *(pos - 1) == ' ') { in hostapd_ctrl_iface_get_key_mgmt()
971 *(pos - 1) = '\0'; in hostapd_ctrl_iface_get_key_mgmt()
972 pos--; in hostapd_ctrl_iface_get_key_mgmt()
975 return pos - buf; in hostapd_ctrl_iface_get_key_mgmt()
988 ret = os_snprintf(pos, end - pos, "bssid=" MACSTR "\n" in hostapd_ctrl_iface_get_config()
990 MAC2STR(hapd->own_addr), in hostapd_ctrl_iface_get_config()
991 wpa_ssid_txt(hapd->conf->ssid.ssid, in hostapd_ctrl_iface_get_config()
992 hapd->conf->ssid.ssid_len)); in hostapd_ctrl_iface_get_config()
993 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
994 return pos - buf; in hostapd_ctrl_iface_get_config()
997 if ((hapd->conf->config_id)) { in hostapd_ctrl_iface_get_config()
998 ret = os_snprintf(pos, end - pos, "config_id=%s\n", in hostapd_ctrl_iface_get_config()
999 hapd->conf->config_id); in hostapd_ctrl_iface_get_config()
1000 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1001 return pos - buf; in hostapd_ctrl_iface_get_config()
1006 ret = os_snprintf(pos, end - pos, "wps_state=%s\n", in hostapd_ctrl_iface_get_config()
1007 hapd->conf->wps_state == 0 ? "disabled" : in hostapd_ctrl_iface_get_config()
1008 (hapd->conf->wps_state == 1 ? "not configured" : in hostapd_ctrl_iface_get_config()
1010 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1011 return pos - buf; in hostapd_ctrl_iface_get_config()
1014 if (hapd->conf->wps_state && hapd->conf->wpa && in hostapd_ctrl_iface_get_config()
1015 hapd->conf->ssid.wpa_passphrase) { in hostapd_ctrl_iface_get_config()
1016 ret = os_snprintf(pos, end - pos, "passphrase=%s\n", in hostapd_ctrl_iface_get_config()
1017 hapd->conf->ssid.wpa_passphrase); in hostapd_ctrl_iface_get_config()
1018 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1019 return pos - buf; in hostapd_ctrl_iface_get_config()
1023 if (hapd->conf->wps_state && hapd->conf->wpa && in hostapd_ctrl_iface_get_config()
1024 hapd->conf->ssid.wpa_psk && in hostapd_ctrl_iface_get_config()
1025 hapd->conf->ssid.wpa_psk->group) { in hostapd_ctrl_iface_get_config()
1028 hapd->conf->ssid.wpa_psk->psk, PMK_LEN); in hostapd_ctrl_iface_get_config()
1029 ret = os_snprintf(pos, end - pos, "psk=%s\n", hex); in hostapd_ctrl_iface_get_config()
1030 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1031 return pos - buf; in hostapd_ctrl_iface_get_config()
1035 if (hapd->conf->multi_ap) { in hostapd_ctrl_iface_get_config()
1036 struct hostapd_ssid *ssid = &hapd->conf->multi_ap_backhaul_ssid; in hostapd_ctrl_iface_get_config()
1038 ret = os_snprintf(pos, end - pos, "multi_ap=%d\n", in hostapd_ctrl_iface_get_config()
1039 hapd->conf->multi_ap); in hostapd_ctrl_iface_get_config()
1040 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1041 return pos - buf; in hostapd_ctrl_iface_get_config()
1044 if (ssid->ssid_len) { in hostapd_ctrl_iface_get_config()
1045 ret = os_snprintf(pos, end - pos, in hostapd_ctrl_iface_get_config()
1047 wpa_ssid_txt(ssid->ssid, in hostapd_ctrl_iface_get_config()
1048 ssid->ssid_len)); in hostapd_ctrl_iface_get_config()
1049 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1050 return pos - buf; in hostapd_ctrl_iface_get_config()
1054 if (hapd->conf->wps_state && hapd->conf->wpa && in hostapd_ctrl_iface_get_config()
1055 ssid->wpa_passphrase) { in hostapd_ctrl_iface_get_config()
1056 ret = os_snprintf(pos, end - pos, in hostapd_ctrl_iface_get_config()
1058 ssid->wpa_passphrase); in hostapd_ctrl_iface_get_config()
1059 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1060 return pos - buf; in hostapd_ctrl_iface_get_config()
1064 if (hapd->conf->wps_state && hapd->conf->wpa && in hostapd_ctrl_iface_get_config()
1065 ssid->wpa_psk && in hostapd_ctrl_iface_get_config()
1066 ssid->wpa_psk->group) { in hostapd_ctrl_iface_get_config()
1069 wpa_snprintf_hex(hex, sizeof(hex), ssid->wpa_psk->psk, in hostapd_ctrl_iface_get_config()
1071 ret = os_snprintf(pos, end - pos, in hostapd_ctrl_iface_get_config()
1075 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1076 return pos - buf; in hostapd_ctrl_iface_get_config()
1082 if (hapd->conf->wpa) { in hostapd_ctrl_iface_get_config()
1083 ret = os_snprintf(pos, end - pos, "wpa=%d\n", hapd->conf->wpa); in hostapd_ctrl_iface_get_config()
1084 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1085 return pos - buf; in hostapd_ctrl_iface_get_config()
1089 if (hapd->conf->wpa && hapd->conf->wpa_key_mgmt) { in hostapd_ctrl_iface_get_config()
1090 ret = os_snprintf(pos, end - pos, "key_mgmt="); in hostapd_ctrl_iface_get_config()
1091 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1092 return pos - buf; in hostapd_ctrl_iface_get_config()
1095 pos += hostapd_ctrl_iface_get_key_mgmt(hapd, pos, end - pos); in hostapd_ctrl_iface_get_config()
1097 ret = os_snprintf(pos, end - pos, "\n"); in hostapd_ctrl_iface_get_config()
1098 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1099 return pos - buf; in hostapd_ctrl_iface_get_config()
1103 if (hapd->conf->wpa) { in hostapd_ctrl_iface_get_config()
1104 ret = os_snprintf(pos, end - pos, "group_cipher=%s\n", in hostapd_ctrl_iface_get_config()
1105 wpa_cipher_txt(hapd->conf->wpa_group)); in hostapd_ctrl_iface_get_config()
1106 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1107 return pos - buf; in hostapd_ctrl_iface_get_config()
1111 if ((hapd->conf->wpa & WPA_PROTO_RSN) && hapd->conf->rsn_pairwise) { in hostapd_ctrl_iface_get_config()
1112 ret = os_snprintf(pos, end - pos, "rsn_pairwise_cipher="); in hostapd_ctrl_iface_get_config()
1113 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1114 return pos - buf; in hostapd_ctrl_iface_get_config()
1117 ret = wpa_write_ciphers(pos, end, hapd->conf->rsn_pairwise, in hostapd_ctrl_iface_get_config()
1120 return pos - buf; in hostapd_ctrl_iface_get_config()
1123 ret = os_snprintf(pos, end - pos, "\n"); in hostapd_ctrl_iface_get_config()
1124 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1125 return pos - buf; in hostapd_ctrl_iface_get_config()
1129 if ((hapd->conf->wpa & WPA_PROTO_WPA) && hapd->conf->wpa_pairwise) { in hostapd_ctrl_iface_get_config()
1130 ret = os_snprintf(pos, end - pos, "wpa_pairwise_cipher="); in hostapd_ctrl_iface_get_config()
1131 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1132 return pos - buf; in hostapd_ctrl_iface_get_config()
1135 ret = wpa_write_ciphers(pos, end, hapd->conf->wpa_pairwise, in hostapd_ctrl_iface_get_config()
1138 return pos - buf; in hostapd_ctrl_iface_get_config()
1141 ret = os_snprintf(pos, end - pos, "\n"); in hostapd_ctrl_iface_get_config()
1142 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1143 return pos - buf; in hostapd_ctrl_iface_get_config()
1147 if (hapd->conf->wpa && hapd->conf->wpa_deny_ptk0_rekey) { in hostapd_ctrl_iface_get_config()
1148 ret = os_snprintf(pos, end - pos, "wpa_deny_ptk0_rekey=%d\n", in hostapd_ctrl_iface_get_config()
1149 hapd->conf->wpa_deny_ptk0_rekey); in hostapd_ctrl_iface_get_config()
1150 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1151 return pos - buf; in hostapd_ctrl_iface_get_config()
1155 if ((hapd->conf->wpa & WPA_PROTO_RSN) && hapd->conf->extended_key_id) { in hostapd_ctrl_iface_get_config()
1156 ret = os_snprintf(pos, end - pos, "extended_key_id=%d\n", in hostapd_ctrl_iface_get_config()
1157 hapd->conf->extended_key_id); in hostapd_ctrl_iface_get_config()
1158 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_config()
1159 return pos - buf; in hostapd_ctrl_iface_get_config()
1163 return pos - buf; in hostapd_ctrl_iface_get_config()
1187 return -1; in hostapd_ctrl_iface_set_band()
1208 return -1; in hostapd_ctrl_iface_set()
1218 ret = -1; in hostapd_ctrl_iface_set()
1223 wpa_printf(MSG_DEBUG, "WPS: Testing - force WPS " in hostapd_ctrl_iface_set()
1231 wpa_printf(MSG_DEBUG, "WPS: Testing - stub_cred=%d", in hostapd_ctrl_iface_set()
1235 wpa_printf(MSG_DEBUG, "WPS: Testing - wps_corrupt_pkhash=%d", in hostapd_ctrl_iface_set()
1240 hapd->ext_mgmt_frame_handling = atoi(value); in hostapd_ctrl_iface_set()
1242 hapd->ext_eapol_frame_io = atoi(value); in hostapd_ctrl_iface_set()
1244 hapd->force_backlog_bytes = atoi(value); in hostapd_ctrl_iface_set()
1247 os_free(hapd->dpp_config_obj_override); in hostapd_ctrl_iface_set()
1248 hapd->dpp_config_obj_override = os_strdup(value); in hostapd_ctrl_iface_set()
1250 os_free(hapd->dpp_discovery_override); in hostapd_ctrl_iface_set()
1251 hapd->dpp_discovery_override = os_strdup(value); in hostapd_ctrl_iface_set()
1253 os_free(hapd->dpp_groups_override); in hostapd_ctrl_iface_set()
1254 hapd->dpp_groups_override = os_strdup(value); in hostapd_ctrl_iface_set()
1257 hapd->dpp_ignore_netaccesskey_mismatch = atoi(value); in hostapd_ctrl_iface_set()
1268 if (!hapd->conf->mbo_enabled) in hostapd_ctrl_iface_set()
1269 return -1; in hostapd_ctrl_iface_set()
1273 return -1; in hostapd_ctrl_iface_set()
1275 hapd->mbo_assoc_disallow = val; in hostapd_ctrl_iface_set()
1276 ieee802_11_update_beacons(hapd->iface); in hostapd_ctrl_iface_set()
1285 os_free(hapd->dpp_configurator_params); in hostapd_ctrl_iface_set()
1286 hapd->dpp_configurator_params = os_strdup(value); in hostapd_ctrl_iface_set()
1288 dpp_controller_set_params(hapd->iface->interfaces->dpp, value); in hostapd_ctrl_iface_set()
1291 hapd->dpp_init_max_tries = atoi(value); in hostapd_ctrl_iface_set()
1293 hapd->dpp_init_retry_time = atoi(value); in hostapd_ctrl_iface_set()
1295 hapd->dpp_resp_wait_time = atoi(value); in hostapd_ctrl_iface_set()
1297 hapd->dpp_resp_max_tries = atoi(value); in hostapd_ctrl_iface_set()
1299 hapd->dpp_resp_retry_time = atoi(value); in hostapd_ctrl_iface_set()
1304 ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value); in hostapd_ctrl_iface_set()
1316 hapd->parameter_set_count++; in hostapd_ctrl_iface_set()
1317 if (ieee802_11_update_beacons(hapd->iface)) in hostapd_ctrl_iface_set()
1323 if (hapd->started) in hostapd_ctrl_iface_set()
1324 hostapd_setup_sae_pt(hapd->conf); in hostapd_ctrl_iface_set()
1326 wpa_auth_set_transition_disable(hapd->wpa_auth, in hostapd_ctrl_iface_set()
1327 hapd->conf->transition_disable); in hostapd_ctrl_iface_set()
1332 wpa_auth_set_ft_rsnxe_used(hapd->wpa_auth, in hostapd_ctrl_iface_set()
1333 hapd->conf->ft_rsnxe_used); in hostapd_ctrl_iface_set()
1336 hapd->wpa_auth, WPA_AUTH_OCV_OVERRIDE_EAPOL_M3, in hostapd_ctrl_iface_set()
1340 hapd->wpa_auth, WPA_AUTH_OCV_OVERRIDE_EAPOL_G1, in hostapd_ctrl_iface_set()
1344 hapd->wpa_auth, WPA_AUTH_OCV_OVERRIDE_FT_ASSOC, in hostapd_ctrl_iface_set()
1348 hapd->wpa_auth, in hostapd_ctrl_iface_set()
1367 return -1; in hostapd_ctrl_iface_get()
1372 return -1; in hostapd_ctrl_iface_get()
1376 return -1; in hostapd_ctrl_iface_get()
1384 return -1; in hostapd_ctrl_iface_enable()
1394 return -1; in hostapd_ctrl_iface_reload()
1404 return -1; in hostapd_ctrl_iface_reload_bss()
1414 return -1; in hostapd_ctrl_iface_disable()
1432 pmk = wpa_auth_get_pmk(sta->wpa_sm, &pmk_len); in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1434 for (psk = hapd->conf->ssid.wpa_psk; pmk && psk; psk = psk->next) { in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1436 os_memcmp(psk->psk, pmk, pmk_len) == 0; in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1437 sta_match = psk->group == 0 && in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1438 ether_addr_equal(sta->addr, psk->addr); in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1439 bss_match = psk->group == 1; in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1446 " PSK/passphrase no longer valid - disconnect", in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1447 MAC2STR(sta->addr)); in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1449 hostapd_drv_sta_deauth(hapd, sta->addr, reason); in hostapd_ctrl_iface_kick_mismatch_psk_sta_iter()
1458 struct hostapd_bss_config *conf = hapd->conf; in hostapd_ctrl_iface_reload_wpa_psk()
1461 hostapd_config_clear_wpa_psk(&conf->ssid.wpa_psk); in hostapd_ctrl_iface_reload_wpa_psk()
1465 wpa_printf(MSG_ERROR, "Reloading WPA-PSK passwords failed: %d", in hostapd_ctrl_iface_reload_wpa_psk()
1467 return -1; in hostapd_ctrl_iface_reload_wpa_psk()
1486 struct hostapd_bss_config *conf = hapd->conf; in hostapd_ctrl_iface_get_rxkhs()
1491 for (r0kh = conf->r0kh_list; r0kh; r0kh=r0kh->next) { in hostapd_ctrl_iface_get_rxkhs()
1492 start_pos = pos - buf; in hostapd_ctrl_iface_get_rxkhs()
1493 ret = os_snprintf(pos, end - pos, "r0kh=" MACSTR " ", in hostapd_ctrl_iface_get_rxkhs()
1494 MAC2STR(r0kh->addr)); in hostapd_ctrl_iface_get_rxkhs()
1495 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_rxkhs()
1498 if (r0kh->id_len + 1 >= (size_t) (end - pos)) in hostapd_ctrl_iface_get_rxkhs()
1500 os_memcpy(pos, r0kh->id, r0kh->id_len); in hostapd_ctrl_iface_get_rxkhs()
1501 pos += r0kh->id_len; in hostapd_ctrl_iface_get_rxkhs()
1503 pos += wpa_snprintf_hex(pos, end - pos, r0kh->key, in hostapd_ctrl_iface_get_rxkhs()
1504 sizeof(r0kh->key)); in hostapd_ctrl_iface_get_rxkhs()
1505 ret = os_snprintf(pos, end - pos, "\n"); in hostapd_ctrl_iface_get_rxkhs()
1506 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_rxkhs()
1511 for (r1kh = conf->r1kh_list; r1kh; r1kh=r1kh->next) { in hostapd_ctrl_iface_get_rxkhs()
1512 start_pos = pos - buf; in hostapd_ctrl_iface_get_rxkhs()
1513 ret = os_snprintf(pos, end - pos, "r1kh=" MACSTR " " MACSTR " ", in hostapd_ctrl_iface_get_rxkhs()
1514 MAC2STR(r1kh->addr), MAC2STR(r1kh->id)); in hostapd_ctrl_iface_get_rxkhs()
1515 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_rxkhs()
1518 pos += wpa_snprintf_hex(pos, end - pos, r1kh->key, in hostapd_ctrl_iface_get_rxkhs()
1519 sizeof(r1kh->key)); in hostapd_ctrl_iface_get_rxkhs()
1520 ret = os_snprintf(pos, end - pos, "\n"); in hostapd_ctrl_iface_get_rxkhs()
1521 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_get_rxkhs()
1526 return pos - buf; in hostapd_ctrl_iface_get_rxkhs()
1532 struct hostapd_bss_config *conf = hapd->conf; in hostapd_ctrl_iface_reload_rxkhs()
1537 err = hostapd_config_read_rxkh_file(conf, conf->rxkh_file); in hostapd_ctrl_iface_reload_rxkhs()
1541 return -1; in hostapd_ctrl_iface_reload_rxkhs()
1564 return -1; in hostapd_ctrl_iface_radar()
1569 else if (os_strcmp(cmd, "CAC-FINISHED") == 0) in hostapd_ctrl_iface_radar()
1571 else if (os_strcmp(cmd, "CAC-ABORTED") == 0) in hostapd_ctrl_iface_radar()
1573 else if (os_strcmp(cmd, "NOP-FINISHED") == 0) in hostapd_ctrl_iface_radar()
1578 return -1; in hostapd_ctrl_iface_radar()
1621 return -1; in hostapd_ctrl_iface_mgmt_tx()
1626 return -1; in hostapd_ctrl_iface_mgmt_tx()
1630 return -1; in hostapd_ctrl_iface_mgmt_tx()
1648 if (!hapd->ext_mgmt_frame_handling) in hostapd_ctrl_iface_mgmt_tx_status_process()
1649 return -1; in hostapd_ctrl_iface_mgmt_tx_status_process()
1670 return -1; in hostapd_ctrl_iface_mgmt_tx_status_process()
1675 return -1; in hostapd_ctrl_iface_mgmt_tx_status_process()
1681 return -1; in hostapd_ctrl_iface_mgmt_tx_status_process()
1690 hapd->ext_mgmt_frame_handling = 0; in hostapd_ctrl_iface_mgmt_tx_status_process()
1692 hapd->ext_mgmt_frame_handling = 1; in hostapd_ctrl_iface_mgmt_tx_status_process()
1709 if (!hapd->ext_mgmt_frame_handling) in hostapd_ctrl_iface_mgmt_rx_process()
1710 return -1; in hostapd_ctrl_iface_mgmt_rx_process()
1737 return -1; in hostapd_ctrl_iface_mgmt_rx_process()
1742 return -1; in hostapd_ctrl_iface_mgmt_rx_process()
1747 return -1; in hostapd_ctrl_iface_mgmt_rx_process()
1751 return -1; in hostapd_ctrl_iface_mgmt_rx_process()
1760 hapd->ext_mgmt_frame_handling = 0; in hostapd_ctrl_iface_mgmt_rx_process()
1762 hapd->ext_mgmt_frame_handling = 1; in hostapd_ctrl_iface_mgmt_rx_process()
1773 u8 src[ETH_ALEN], *buf; in hostapd_ctrl_iface_eapol_rx() local
1780 used = hwaddr_aton2(pos, src); in hostapd_ctrl_iface_eapol_rx()
1782 return -1; in hostapd_ctrl_iface_eapol_rx()
1789 return -1; in hostapd_ctrl_iface_eapol_rx()
1794 return -1; in hostapd_ctrl_iface_eapol_rx()
1798 return -1; in hostapd_ctrl_iface_eapol_rx()
1801 ieee802_1x_receive(hapd, src, buf, len, FRAME_ENCRYPTION_UNKNOWN); in hostapd_ctrl_iface_eapol_rx()
1822 return -1; in hostapd_ctrl_iface_eapol_tx()
1829 len = pos2 - pos; in hostapd_ctrl_iface_eapol_tx()
1835 return -1; in hostapd_ctrl_iface_eapol_tx()
1841 return -1; in hostapd_ctrl_iface_eapol_tx()
1844 prev = hapd->ext_eapol_frame_io; in hostapd_ctrl_iface_eapol_tx()
1845 hapd->ext_eapol_frame_io = 0; in hostapd_ctrl_iface_eapol_tx()
1847 hapd->ext_eapol_frame_io = prev; in hostapd_ctrl_iface_eapol_tx()
1871 #define HWSIM_IP_LEN (HWSIM_PACKETLEN - sizeof(struct ether_header))
1885 "test data: RX - ignore unexpected length %d", in hostapd_data_test_rx()
1897 "test data: RX - ignore unexpected IP header"); in hostapd_data_test_rx()
1901 for (i = 0; i < ntohs(ip.ip_len) - sizeof(ip); i++) { in hostapd_data_test_rx()
1904 "test data: RX - ignore mismatching payload"); in hostapd_data_test_rx()
1913 wpa_msg(hapd->msg_ctx, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR "%s", in hostapd_data_test_rx()
1914 MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost), extra); in hostapd_data_test_rx()
1924 const u8 *addr = hapd->own_addr; in hostapd_ctrl_iface_data_test_config()
1927 if (hapd->l2_test) { in hostapd_ctrl_iface_data_test_config()
1928 l2_packet_deinit(hapd->l2_test); in hostapd_ctrl_iface_data_test_config()
1929 hapd->l2_test = NULL; in hostapd_ctrl_iface_data_test_config()
1930 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, in hostapd_ctrl_iface_data_test_config()
1936 if (hapd->l2_test) in hostapd_ctrl_iface_data_test_config()
1943 ifname = hapd->conf->iface; in hostapd_ctrl_iface_data_test_config()
1946 if (hapd->conf->mld_ap) in hostapd_ctrl_iface_data_test_config()
1947 addr = hapd->mld->mld_addr; in hostapd_ctrl_iface_data_test_config()
1949 hapd->l2_test = l2_packet_init(ifname, addr, in hostapd_ctrl_iface_data_test_config()
1952 if (hapd->l2_test == NULL) in hostapd_ctrl_iface_data_test_config()
1953 return -1; in hostapd_ctrl_iface_data_test_config()
1955 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: Enabled"); in hostapd_ctrl_iface_data_test_config()
1963 u8 dst[ETH_ALEN], src[ETH_ALEN]; in hostapd_ctrl_iface_data_test_tx() local
1975 if (hapd->l2_test == NULL) in hostapd_ctrl_iface_data_test_tx()
1976 return -1; in hostapd_ctrl_iface_data_test_tx()
1978 /* format: <dst> <src> <tos> [len=<length>] */ in hostapd_ctrl_iface_data_test_tx()
1983 return -1; in hostapd_ctrl_iface_data_test_tx()
1987 used = hwaddr_aton2(pos, src); in hostapd_ctrl_iface_data_test_tx()
1989 return -1; in hostapd_ctrl_iface_data_test_tx()
1994 return -1; in hostapd_ctrl_iface_data_test_tx()
2001 return -1; in hostapd_ctrl_iface_data_test_tx()
2006 os_memcpy(eth->ether_dhost, dst, ETH_ALEN); in hostapd_ctrl_iface_data_test_tx()
2007 os_memcpy(eth->ether_shost, src, ETH_ALEN); in hostapd_ctrl_iface_data_test_tx()
2008 eth->ether_type = htons(ETHERTYPE_IP); in hostapd_ctrl_iface_data_test_tx()
2011 ip->ip_hl = 5; in hostapd_ctrl_iface_data_test_tx()
2012 ip->ip_v = 4; in hostapd_ctrl_iface_data_test_tx()
2013 ip->ip_ttl = 64; in hostapd_ctrl_iface_data_test_tx()
2014 ip->ip_tos = tos; in hostapd_ctrl_iface_data_test_tx()
2015 ip->ip_len = htons(send_len); in hostapd_ctrl_iface_data_test_tx()
2016 ip->ip_p = 1; in hostapd_ctrl_iface_data_test_tx()
2017 ip->ip_src.s_addr = htonl(192U << 24 | 168 << 16 | 1 << 8 | 1); in hostapd_ctrl_iface_data_test_tx()
2018 ip->ip_dst.s_addr = htonl(192U << 24 | 168 << 16 | 1 << 8 | 2); in hostapd_ctrl_iface_data_test_tx()
2019 ip->ip_sum = ipv4_hdr_checksum(ip, sizeof(*ip)); in hostapd_ctrl_iface_data_test_tx()
2021 for (i = 0; i < send_len - sizeof(*ip); i++) in hostapd_ctrl_iface_data_test_tx()
2024 if (l2_packet_send(hapd->l2_test, dst, ETHERTYPE_IP, &buf[2], in hostapd_ctrl_iface_data_test_tx()
2026 return -1; in hostapd_ctrl_iface_data_test_tx()
2028 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: TX dst=" MACSTR in hostapd_ctrl_iface_data_test_tx()
2029 " src=" MACSTR " tos=0x%x", MAC2STR(dst), MAC2STR(src), tos); in hostapd_ctrl_iface_data_test_tx()
2043 int res = -1; in hostapd_ctrl_iface_data_test_frame()
2044 const char *ifname = hapd->conf->iface; in hostapd_ctrl_iface_data_test_frame()
2051 return -1; in hostapd_ctrl_iface_data_test_frame()
2057 return -1; in hostapd_ctrl_iface_data_test_frame()
2062 return -1; in hostapd_ctrl_iface_data_test_frame()
2068 ethertype = ntohs(eth->ether_type); in hostapd_ctrl_iface_data_test_frame()
2070 l2 = l2_packet_init(ifname, hapd->own_addr, ethertype, in hostapd_ctrl_iface_data_test_frame()
2075 res = l2_packet_send(l2, eth->ether_dhost, ethertype, buf, len); in hostapd_ctrl_iface_data_test_frame()
2076 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "test data: TX frame res=%d", res); in hostapd_ctrl_iface_data_test_frame()
2082 return res < 0 ? -1 : 0; in hostapd_ctrl_iface_data_test_frame()
2095 return -1; in hostapd_ctrl_reset_pn()
2098 if (hapd->last_bigtk_alg == WPA_ALG_NONE) in hostapd_ctrl_reset_pn()
2099 return -1; in hostapd_ctrl_reset_pn()
2105 if (hostapd_drv_set_key(hapd->conf->iface, hapd, in hostapd_ctrl_reset_pn()
2106 hapd->last_bigtk_alg, in hostapd_ctrl_reset_pn()
2108 hapd->last_bigtk_key_idx, 0, 1, NULL, 0, in hostapd_ctrl_reset_pn()
2109 zero, hapd->last_bigtk_len, in hostapd_ctrl_reset_pn()
2111 return -1; in hostapd_ctrl_reset_pn()
2114 return hostapd_drv_set_key(hapd->conf->iface, hapd, in hostapd_ctrl_reset_pn()
2115 hapd->last_bigtk_alg, in hostapd_ctrl_reset_pn()
2117 hapd->last_bigtk_key_idx, 0, 1, NULL, in hostapd_ctrl_reset_pn()
2118 0, hapd->last_bigtk, in hostapd_ctrl_reset_pn()
2119 hapd->last_bigtk_len, in hostapd_ctrl_reset_pn()
2124 if (hapd->last_igtk_alg == WPA_ALG_NONE) in hostapd_ctrl_reset_pn()
2125 return -1; in hostapd_ctrl_reset_pn()
2131 if (hostapd_drv_set_key(hapd->conf->iface, hapd, in hostapd_ctrl_reset_pn()
2132 hapd->last_igtk_alg, in hostapd_ctrl_reset_pn()
2134 hapd->last_igtk_key_idx, 0, 1, NULL, 0, in hostapd_ctrl_reset_pn()
2135 zero, hapd->last_igtk_len, in hostapd_ctrl_reset_pn()
2137 return -1; in hostapd_ctrl_reset_pn()
2140 return hostapd_drv_set_key(hapd->conf->iface, hapd, in hostapd_ctrl_reset_pn()
2141 hapd->last_igtk_alg, in hostapd_ctrl_reset_pn()
2143 hapd->last_igtk_key_idx, 0, 1, NULL, in hostapd_ctrl_reset_pn()
2144 0, hapd->last_igtk, in hostapd_ctrl_reset_pn()
2145 hapd->last_igtk_len, in hostapd_ctrl_reset_pn()
2150 if (hapd->last_gtk_alg == WPA_ALG_NONE) in hostapd_ctrl_reset_pn()
2151 return -1; in hostapd_ctrl_reset_pn()
2157 if (hostapd_drv_set_key(hapd->conf->iface, hapd, in hostapd_ctrl_reset_pn()
2158 hapd->last_gtk_alg, in hostapd_ctrl_reset_pn()
2160 hapd->last_gtk_key_idx, 0, 1, NULL, 0, in hostapd_ctrl_reset_pn()
2161 zero, hapd->last_gtk_len, in hostapd_ctrl_reset_pn()
2163 return -1; in hostapd_ctrl_reset_pn()
2166 return hostapd_drv_set_key(hapd->conf->iface, hapd, in hostapd_ctrl_reset_pn()
2167 hapd->last_gtk_alg, in hostapd_ctrl_reset_pn()
2169 hapd->last_gtk_key_idx, 0, 1, NULL, in hostapd_ctrl_reset_pn()
2170 0, hapd->last_gtk, in hostapd_ctrl_reset_pn()
2171 hapd->last_gtk_len, in hostapd_ctrl_reset_pn()
2177 return -1; in hostapd_ctrl_reset_pn()
2179 if (sta->last_tk_alg == WPA_ALG_NONE) in hostapd_ctrl_reset_pn()
2180 return -1; in hostapd_ctrl_reset_pn()
2183 MAC2STR(sta->addr)); in hostapd_ctrl_reset_pn()
2187 if (hostapd_drv_set_key(hapd->conf->iface, hapd, sta->last_tk_alg, in hostapd_ctrl_reset_pn()
2188 sta->addr, sta->last_tk_key_idx, 0, 1, NULL, 0, in hostapd_ctrl_reset_pn()
2189 zero, sta->last_tk_len, in hostapd_ctrl_reset_pn()
2191 return -1; in hostapd_ctrl_reset_pn()
2194 return hostapd_drv_set_key(hapd->conf->iface, hapd, sta->last_tk_alg, in hostapd_ctrl_reset_pn()
2195 sta->addr, sta->last_tk_key_idx, 0, 1, NULL, in hostapd_ctrl_reset_pn()
2196 0, sta->last_tk, sta->last_tk_len, in hostapd_ctrl_reset_pn()
2216 return -1; in hostapd_ctrl_set_key()
2219 return -1; in hostapd_ctrl_set_key()
2222 return -1; in hostapd_ctrl_set_key()
2227 return -1; in hostapd_ctrl_set_key()
2232 return -1; in hostapd_ctrl_set_key()
2235 return -1; in hostapd_ctrl_set_key()
2238 return -1; in hostapd_ctrl_set_key()
2241 return -1; in hostapd_ctrl_set_key()
2242 key_len = (os_strchr(pos, ' ') - pos) / 2; in hostapd_ctrl_set_key()
2244 return -1; in hostapd_ctrl_set_key()
2247 return -1; in hostapd_ctrl_set_key()
2253 return -1; in hostapd_ctrl_set_key()
2256 return hostapd_drv_set_key(hapd->conf->iface, hapd, alg, addr, idx, 0, in hostapd_ctrl_set_key()
2267 MAC2STR(sta->addr)); in restore_tk()
2271 hostapd_drv_set_key(hapd->conf->iface, hapd, sta->last_tk_alg, in restore_tk()
2272 sta->addr, sta->last_tk_key_idx, 0, 1, NULL, 0, in restore_tk()
2273 sta->last_tk, sta->last_tk_len, in restore_tk()
2285 return -1; in hostapd_ctrl_resend_m1()
2288 if (!sta || !sta->wpa_sm) in hostapd_ctrl_resend_m1()
2289 return -1; in hostapd_ctrl_resend_m1()
2291 if (plain && sta->last_tk_alg == WPA_ALG_NONE) in hostapd_ctrl_resend_m1()
2295 MAC2STR(sta->addr)); in hostapd_ctrl_resend_m1()
2296 hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_NONE, in hostapd_ctrl_resend_m1()
2297 sta->addr, sta->last_tk_key_idx, 0, 0, NULL, in hostapd_ctrl_resend_m1()
2301 wpa_printf(MSG_INFO, "TESTING: Send M1 to " MACSTR, MAC2STR(sta->addr)); in hostapd_ctrl_resend_m1()
2302 return wpa_auth_resend_m1(sta->wpa_sm, in hostapd_ctrl_resend_m1()
2303 os_strstr(cmd, "change-anonce") != NULL, in hostapd_ctrl_resend_m1()
2315 return -1; in hostapd_ctrl_resend_m3()
2318 if (!sta || !sta->wpa_sm) in hostapd_ctrl_resend_m3()
2319 return -1; in hostapd_ctrl_resend_m3()
2321 if (plain && sta->last_tk_alg == WPA_ALG_NONE) in hostapd_ctrl_resend_m3()
2325 MAC2STR(sta->addr)); in hostapd_ctrl_resend_m3()
2326 hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_NONE, in hostapd_ctrl_resend_m3()
2327 sta->addr, sta->last_tk_key_idx, 0, 0, NULL, in hostapd_ctrl_resend_m3()
2331 wpa_printf(MSG_INFO, "TESTING: Send M3 to " MACSTR, MAC2STR(sta->addr)); in hostapd_ctrl_resend_m3()
2332 return wpa_auth_resend_m3(sta->wpa_sm, in hostapd_ctrl_resend_m3()
2345 return -1; in hostapd_ctrl_resend_group_m1()
2348 if (!sta || !sta->wpa_sm) in hostapd_ctrl_resend_group_m1()
2349 return -1; in hostapd_ctrl_resend_group_m1()
2351 if (plain && sta->last_tk_alg == WPA_ALG_NONE) in hostapd_ctrl_resend_group_m1()
2355 MAC2STR(sta->addr)); in hostapd_ctrl_resend_group_m1()
2356 hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_NONE, in hostapd_ctrl_resend_group_m1()
2357 sta->addr, sta->last_tk_key_idx, 0, 0, NULL, in hostapd_ctrl_resend_group_m1()
2363 MACSTR, MAC2STR(sta->addr)); in hostapd_ctrl_resend_group_m1()
2364 return wpa_auth_resend_group_m1(sta->wpa_sm, in hostapd_ctrl_resend_group_m1()
2375 return -1; in hostapd_ctrl_rekey_ptk()
2378 if (!sta || !sta->wpa_sm) in hostapd_ctrl_rekey_ptk()
2379 return -1; in hostapd_ctrl_rekey_ptk()
2381 return wpa_auth_rekey_ptk(hapd->wpa_auth, sta->wpa_sm); in hostapd_ctrl_rekey_ptk()
2390 pmksa = wpa_auth_pmksa_get(hapd->wpa_auth, addr, NULL); in hostapd_ctrl_get_pmksa_pmk()
2392 return -1; in hostapd_ctrl_get_pmksa_pmk()
2394 return wpa_snprintf_hex(buf, buflen, pmksa->pmk, pmksa->pmk_len); in hostapd_ctrl_get_pmksa_pmk()
2407 return -1; in hostapd_ctrl_get_pmk()
2410 if (!sta || !sta->wpa_sm) { in hostapd_ctrl_get_pmk()
2415 pmk = wpa_auth_get_pmk(sta->wpa_sm, &pmk_len); in hostapd_ctrl_get_pmk()
2437 return -1; in hostapd_ctrl_register_frame()
2441 match_len = end - pos; in hostapd_ctrl_register_frame()
2447 return -1; in hostapd_ctrl_register_frame()
2462 if (is_6ghz_freq(params->freq)) { in hostapd_ctrl_check_freq_params()
2467 params->he_enabled = 1; in hostapd_ctrl_check_freq_params()
2469 if (params->center_freq1) { in hostapd_ctrl_check_freq_params()
2470 if (params->freq == 5935) in hostapd_ctrl_check_freq_params()
2471 idx = (params->center_freq1 - 5925) / 5; in hostapd_ctrl_check_freq_params()
2473 idx = (params->center_freq1 - 5950) / 5; in hostapd_ctrl_check_freq_params()
2477 bw_idx[bw] != params->bandwidth) in hostapd_ctrl_check_freq_params()
2478 return -1; in hostapd_ctrl_check_freq_params()
2480 } else { /* Non-6 GHz channel */ in hostapd_ctrl_check_freq_params()
2483 if (params->he_enabled || params->eht_enabled) { in hostapd_ctrl_check_freq_params()
2484 params->he_enabled = 1; in hostapd_ctrl_check_freq_params()
2487 * band as defined in IEEE Std 802.11ax-2021, 4.3.15a. in hostapd_ctrl_check_freq_params()
2490 if (IS_5GHZ(params->freq)) in hostapd_ctrl_check_freq_params()
2491 params->vht_enabled = 1; in hostapd_ctrl_check_freq_params()
2493 params->ht_enabled = 1; in hostapd_ctrl_check_freq_params()
2497 switch (params->bandwidth) { in hostapd_ctrl_check_freq_params()
2500 /* fall-through */ in hostapd_ctrl_check_freq_params()
2502 if (params->center_freq1 && in hostapd_ctrl_check_freq_params()
2503 params->center_freq1 != params->freq) in hostapd_ctrl_check_freq_params()
2504 return -1; in hostapd_ctrl_check_freq_params()
2506 if (params->center_freq2 || params->sec_channel_offset) in hostapd_ctrl_check_freq_params()
2507 return -1; in hostapd_ctrl_check_freq_params()
2510 return -1; in hostapd_ctrl_check_freq_params()
2513 if (params->center_freq2 || !params->sec_channel_offset) in hostapd_ctrl_check_freq_params()
2514 return -1; in hostapd_ctrl_check_freq_params()
2517 return -1; in hostapd_ctrl_check_freq_params()
2519 if (!params->center_freq1) in hostapd_ctrl_check_freq_params()
2521 switch (params->sec_channel_offset) { in hostapd_ctrl_check_freq_params()
2523 if (params->freq + 10 != params->center_freq1) in hostapd_ctrl_check_freq_params()
2524 return -1; in hostapd_ctrl_check_freq_params()
2526 case -1: in hostapd_ctrl_check_freq_params()
2527 if (params->freq - 10 != params->center_freq1) in hostapd_ctrl_check_freq_params()
2528 return -1; in hostapd_ctrl_check_freq_params()
2531 return -1; in hostapd_ctrl_check_freq_params()
2535 if (!params->center_freq1 || !params->sec_channel_offset) in hostapd_ctrl_check_freq_params()
2538 switch (params->sec_channel_offset) { in hostapd_ctrl_check_freq_params()
2540 if (params->freq - 10 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2541 params->freq + 30 != params->center_freq1) in hostapd_ctrl_check_freq_params()
2544 case -1: in hostapd_ctrl_check_freq_params()
2545 if (params->freq + 10 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2546 params->freq - 30 != params->center_freq1) in hostapd_ctrl_check_freq_params()
2547 return -1; in hostapd_ctrl_check_freq_params()
2550 return -1; in hostapd_ctrl_check_freq_params()
2553 if (params->center_freq2 && punct_bitmap) in hostapd_ctrl_check_freq_params()
2554 return -1; in hostapd_ctrl_check_freq_params()
2557 if (params->center_freq2 && in hostapd_ctrl_check_freq_params()
2558 params->center_freq1 - params->center_freq2 <= 80 && in hostapd_ctrl_check_freq_params()
2559 params->center_freq2 - params->center_freq1 <= 80) in hostapd_ctrl_check_freq_params()
2563 if (!params->center_freq1 || params->center_freq2 || in hostapd_ctrl_check_freq_params()
2564 !params->sec_channel_offset) in hostapd_ctrl_check_freq_params()
2565 return -1; in hostapd_ctrl_check_freq_params()
2567 switch (params->sec_channel_offset) { in hostapd_ctrl_check_freq_params()
2569 if (params->freq + 70 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2570 params->freq + 30 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2571 params->freq - 10 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2572 params->freq - 50 != params->center_freq1) in hostapd_ctrl_check_freq_params()
2573 return -1; in hostapd_ctrl_check_freq_params()
2575 case -1: in hostapd_ctrl_check_freq_params()
2576 if (params->freq + 50 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2577 params->freq + 10 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2578 params->freq - 30 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2579 params->freq - 70 != params->center_freq1) in hostapd_ctrl_check_freq_params()
2580 return -1; in hostapd_ctrl_check_freq_params()
2583 return -1; in hostapd_ctrl_check_freq_params()
2587 if (!params->center_freq1 || params->center_freq2 || in hostapd_ctrl_check_freq_params()
2588 !params->sec_channel_offset) in hostapd_ctrl_check_freq_params()
2589 return -1; in hostapd_ctrl_check_freq_params()
2591 switch (params->sec_channel_offset) { in hostapd_ctrl_check_freq_params()
2593 if (params->freq + 150 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2594 params->freq + 110 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2595 params->freq + 70 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2596 params->freq + 30 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2597 params->freq - 10 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2598 params->freq - 50 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2599 params->freq - 90 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2600 params->freq - 130 != params->center_freq1) in hostapd_ctrl_check_freq_params()
2601 return -1; in hostapd_ctrl_check_freq_params()
2603 case -1: in hostapd_ctrl_check_freq_params()
2604 if (params->freq + 130 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2605 params->freq + 90 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2606 params->freq + 50 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2607 params->freq + 10 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2608 params->freq - 30 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2609 params->freq - 70 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2610 params->freq - 110 != params->center_freq1 && in hostapd_ctrl_check_freq_params()
2611 params->freq - 150 != params->center_freq1) in hostapd_ctrl_check_freq_params()
2612 return -1; in hostapd_ctrl_check_freq_params()
2617 return -1; in hostapd_ctrl_check_freq_params()
2623 if (!params->eht_enabled) { in hostapd_ctrl_check_freq_params()
2626 return -1; in hostapd_ctrl_check_freq_params()
2629 if (params->freq >= 2412 && params->freq <= 2484) { in hostapd_ctrl_check_freq_params()
2632 return -1; in hostapd_ctrl_check_freq_params()
2635 start_freq = params->center_freq1 - (params->bandwidth / 2); in hostapd_ctrl_check_freq_params()
2636 if (!is_punct_bitmap_valid(params->bandwidth, in hostapd_ctrl_check_freq_params()
2637 (params->freq - start_freq) / 20, in hostapd_ctrl_check_freq_params()
2640 return -1; in hostapd_ctrl_check_freq_params()
2665 settings.link_id = -1; in hostapd_ctrl_iface_chan_switch()
2667 if (iface->num_bss && iface->bss[0]->conf->mld_ap) in hostapd_ctrl_iface_chan_switch()
2668 settings.link_id = iface->bss[0]->mld_link_id; in hostapd_ctrl_iface_chan_switch()
2719 return -1; in hostapd_ctrl_iface_chan_switch()
2733 iface->is_ch_switch_dfs = true; in hostapd_ctrl_iface_chan_switch()
2738 for (i = 0; i < iface->num_bss; i++) { in hostapd_ctrl_iface_chan_switch()
2741 hostapd_chan_switch_config(iface->bss[i], in hostapd_ctrl_iface_chan_switch()
2744 err = hostapd_switch_channel(iface->bss[i], &settings); in hostapd_ctrl_iface_chan_switch()
2751 return (iface->num_bss == num_err) ? ret : 0; in hostapd_ctrl_iface_chan_switch()
2753 return -1; in hostapd_ctrl_iface_chan_switch()
2764 struct hostapd_data *hapd = iface->bss[0]; in hostapd_ctrl_iface_color_change()
2774 return -1; in hostapd_ctrl_iface_color_change()
2777 /* Color value is expected to be [1-63]. If 0 comes, assumption is this in hostapd_ctrl_iface_color_change()
2781 if (iface->conf->he_op.he_bss_color_disabled) { in hostapd_ctrl_iface_color_change()
2784 return -1; in hostapd_ctrl_iface_color_change()
2787 iface->conf->he_op.he_bss_color_disabled = 1; in hostapd_ctrl_iface_color_change()
2789 for (i = 0; i < iface->num_bss; i++) in hostapd_ctrl_iface_color_change()
2790 ieee802_11_set_beacon(iface->bss[i]); in hostapd_ctrl_iface_color_change()
2795 if (color == iface->conf->he_op.he_bss_color) { in hostapd_ctrl_iface_color_change()
2796 if (!iface->conf->he_op.he_bss_color_disabled) { in hostapd_ctrl_iface_color_change()
2799 return -1; in hostapd_ctrl_iface_color_change()
2802 iface->conf->he_op.he_bss_color_disabled = 0; in hostapd_ctrl_iface_color_change()
2804 for (i = 0; i < iface->num_bss; i++) in hostapd_ctrl_iface_color_change()
2805 ieee802_11_set_beacon(iface->bss[i]); in hostapd_ctrl_iface_color_change()
2810 if (hapd->cca_in_progress) { in hostapd_ctrl_iface_color_change()
2813 return -1; in hostapd_ctrl_iface_color_change()
2816 iface->conf->he_op.he_bss_color_disabled = 0; in hostapd_ctrl_iface_color_change()
2818 for (i = 0; i < iface->num_bss; i++) { in hostapd_ctrl_iface_color_change()
2819 struct hostapd_data *bss = iface->bss[i]; in hostapd_ctrl_iface_color_change()
2823 bss->cca_color = color; in hostapd_ctrl_iface_color_change()
2824 bss->cca_count = 10; in hostapd_ctrl_iface_color_change()
2845 return -1; in hostapd_ctrl_iface_color_change()
2862 if (sta->ht_capabilities && (sta->flags & WLAN_STA_HT)) { in hostapd_maxnss()
2863 mcs_set = sta->ht_capabilities->supported_mcs_set; in hostapd_maxnss()
2867 if (sta->vht_capabilities && (sta->flags & WLAN_STA_VHT)) { in hostapd_maxnss()
2869 sta->vht_capabilities->vht_supported_mcs_set.rx_map); in hostapd_maxnss()
2884 for (i = 7; i >= 0; i--) { in hostapd_maxnss()
2909 ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, in hostapd_ctrl_iface_notify_cw_htaction()
2930 ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, in hostapd_ctrl_iface_notify_cw_vhtaction()
2948 if (is_6ghz_freq(hapd->iface->freq)) { in hostapd_ctrl_iface_notify_cw_change()
2950 return -1; in hostapd_ctrl_iface_notify_cw_change()
2954 hw_mode = hapd->iface->current_mode->mode; in hostapd_ctrl_iface_notify_cw_change()
2960 return -1; in hostapd_ctrl_iface_notify_cw_change()
2978 return -1; in hostapd_ctrl_iface_notify_cw_change()
2981 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_ctrl_iface_notify_cw_change()
2982 if ((sta->flags & WLAN_STA_VHT) && sta->vht_capabilities) { in hostapd_ctrl_iface_notify_cw_change()
2983 nss = hostapd_maxnss(hapd, sta) - 1; in hostapd_ctrl_iface_notify_cw_change()
2984 hostapd_ctrl_iface_notify_cw_vhtaction(hapd, sta->addr, in hostapd_ctrl_iface_notify_cw_change()
2990 if ((sta->flags & (WLAN_STA_HT | WLAN_STA_VHT)) == in hostapd_ctrl_iface_notify_cw_change()
2991 WLAN_STA_HT && sta->ht_capabilities) in hostapd_ctrl_iface_notify_cw_change()
2992 hostapd_ctrl_iface_notify_cw_htaction(hapd, sta->addr, in hostapd_ctrl_iface_notify_cw_change()
3005 return radius_server_get_mib(hapd->radius_srv, reply, in hostapd_ctrl_iface_mib()
3009 return -1; in hostapd_ctrl_iface_mib()
3030 return -EINVAL; in hostapd_ctrl_iface_vendor()
3036 return -EINVAL; in hostapd_ctrl_iface_vendor()
3039 data_len = temp ? (size_t) (temp - pos) : os_strlen(pos); in hostapd_ctrl_iface_vendor()
3046 return -ENOBUFS; in hostapd_ctrl_iface_vendor()
3052 return -EINVAL; in hostapd_ctrl_iface_vendor()
3061 reply = wpabuf_alloc((buflen - 1) / 2); in hostapd_ctrl_iface_vendor()
3064 return -ENOBUFS; in hostapd_ctrl_iface_vendor()
3088 return -1; in hostapd_ctrl_iface_eapol_reauth()
3091 if (!sta || !sta->eapol_sm) in hostapd_ctrl_iface_eapol_reauth()
3092 return -1; in hostapd_ctrl_iface_eapol_reauth()
3094 eapol_auth_reauthenticate(sta->eapol_sm); in hostapd_ctrl_iface_eapol_reauth()
3106 return -1; in hostapd_ctrl_iface_eapol_set()
3111 return -1; in hostapd_ctrl_iface_eapol_set()
3115 if (!sta || !sta->eapol_sm) in hostapd_ctrl_iface_eapol_set()
3116 return -1; in hostapd_ctrl_iface_eapol_set()
3118 return eapol_auth_set_conf(sta->eapol_sm, param, pos); in hostapd_ctrl_iface_eapol_set()
3132 ret = os_snprintf(pos, end - pos, "Current level: %s\n" in hostapd_ctrl_iface_log_level()
3136 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_log_level()
3156 return -1; in hostapd_ctrl_iface_log_level()
3172 struct hostapd_iface *iface = hapd->iface; in hostapd_ctrl_iface_track_sta_list()
3177 if (!iface->num_sta_seen) in hostapd_ctrl_iface_track_sta_list()
3186 dl_list_for_each_reverse(info, &iface->sta_seen, in hostapd_ctrl_iface_track_sta_list()
3191 os_reltime_sub(&now, &info->last_seen, &age); in hostapd_ctrl_iface_track_sta_list()
3192 ret = os_snprintf(pos, end - pos, MACSTR " %u %d\n", in hostapd_ctrl_iface_track_sta_list()
3193 MAC2STR(info->addr), (unsigned int) age.sec, in hostapd_ctrl_iface_track_sta_list()
3194 info->ssi_signal); in hostapd_ctrl_iface_track_sta_list()
3195 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_iface_track_sta_list()
3200 return pos - buf; in hostapd_ctrl_iface_track_sta_list()
3212 return -1; in hostapd_ctrl_iface_req_lci()
3230 "CTRL: REQ_RANGE - Bad destination address"); in hostapd_ctrl_iface_req_range()
3231 return -1; in hostapd_ctrl_iface_req_range()
3236 return -1; in hostapd_ctrl_iface_req_range()
3240 return -1; in hostapd_ctrl_iface_req_range()
3244 return -1; in hostapd_ctrl_iface_req_range()
3248 return -1; in hostapd_ctrl_iface_req_range()
3255 return -1; in hostapd_ctrl_iface_req_range()
3261 return -1; in hostapd_ctrl_iface_req_range()
3269 "CTRL: REQ_RANGE - No FTM responder address"); in hostapd_ctrl_iface_req_range()
3270 return -1; in hostapd_ctrl_iface_req_range()
3289 return -1; in hostapd_ctrl_iface_req_beacon()
3292 return -1; in hostapd_ctrl_iface_req_beacon()
3298 return -1; in hostapd_ctrl_iface_req_beacon()
3303 return -1; in hostapd_ctrl_iface_req_beacon()
3308 return -1; in hostapd_ctrl_iface_req_beacon()
3328 return -1; in hostapd_ctrl_iface_req_link_measurement()
3341 if (!(hapd->conf->radio_measurements[0] & in hostapd_ctrl_iface_show_neighbor()
3345 return -1; in hostapd_ctrl_iface_show_neighbor()
3360 int ret = -1; in hostapd_ctrl_iface_set_neighbor()
3362 if (!(hapd->conf->radio_measurements[0] & in hostapd_ctrl_iface_set_neighbor()
3366 return -1; in hostapd_ctrl_iface_set_neighbor()
3371 return -1; in hostapd_ctrl_iface_set_neighbor()
3378 return -1; in hostapd_ctrl_iface_set_neighbor()
3382 return -1; in hostapd_ctrl_iface_set_neighbor()
3388 return -1; in hostapd_ctrl_iface_set_neighbor()
3399 return -1; in hostapd_ctrl_iface_set_neighbor()
3473 return -1; in hostapd_ctrl_iface_remove_neighbor()
3482 return -1; in hostapd_ctrl_iface_remove_neighbor()
3497 (long long unsigned) iface->drv_flags); in hostapd_ctrl_driver_flags()
3499 return -1; in hostapd_ctrl_driver_flags()
3505 if (iface->drv_flags & (1LLU << i)) { in hostapd_ctrl_driver_flags()
3506 ret = os_snprintf(pos, end - pos, "%s\n", in hostapd_ctrl_driver_flags()
3508 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_driver_flags()
3509 return -1; in hostapd_ctrl_driver_flags()
3514 return pos - buf; in hostapd_ctrl_driver_flags()
3525 (long long unsigned) iface->drv_flags2); in hostapd_ctrl_driver_flags2()
3527 return -1; in hostapd_ctrl_driver_flags2()
3533 if (iface->drv_flags2 & (1LLU << i)) { in hostapd_ctrl_driver_flags2()
3534 ret = os_snprintf(pos, end - pos, "%s\n", in hostapd_ctrl_driver_flags2()
3536 if (os_snprintf_error(end - pos, ret)) in hostapd_ctrl_driver_flags2()
3537 return -1; in hostapd_ctrl_driver_flags2()
3542 return pos - buf; in hostapd_ctrl_driver_flags2()
3564 return -1; in hostapd_ctrl_iface_get_capability()
3572 return -1; in hostapd_ctrl_iface_get_capability()
3586 ret = -1; in hostapd_ctrl_iface_driver_cmd()
3599 if (!iface || !iface->bss[0]->conf->mld_ap) { in hostapd_ctrl_iface_enable_mld()
3602 return -1; in hostapd_ctrl_iface_enable_mld()
3605 for (i = 0; i < iface->interfaces->count; ++i) { in hostapd_ctrl_iface_enable_mld()
3606 struct hostapd_iface *h_iface = iface->interfaces->iface[i]; in hostapd_ctrl_iface_enable_mld()
3607 struct hostapd_data *h_hapd = h_iface->bss[0]; in hostapd_ctrl_iface_enable_mld()
3609 if (!hostapd_is_ml_partner(h_hapd, iface->bss[0])) in hostapd_ctrl_iface_enable_mld()
3614 return -1; in hostapd_ctrl_iface_enable_mld()
3625 for (i = 0; i < iface->num_bss; i++) in hostapd_disable_iface_bss()
3626 hostapd_bss_deinit_no_free(iface->bss[i]); in hostapd_disable_iface_bss()
3634 if (!iface || !iface->bss[0]->conf->mld_ap) { in hostapd_ctrl_iface_disable_mld()
3637 return -1; in hostapd_ctrl_iface_disable_mld()
3643 for (i = 0; i < iface->interfaces->count; ++i) { in hostapd_ctrl_iface_disable_mld()
3644 struct hostapd_iface *h_iface = iface->interfaces->iface[i]; in hostapd_ctrl_iface_disable_mld()
3645 struct hostapd_data *h_hapd = h_iface->bss[0]; in hostapd_ctrl_iface_disable_mld()
3647 if (!hostapd_is_ml_partner(h_hapd, iface->bss[0])) in hostapd_ctrl_iface_disable_mld()
3654 for (i = 0; i < iface->interfaces->count; ++i) { in hostapd_ctrl_iface_disable_mld()
3655 struct hostapd_iface *h_iface = iface->interfaces->iface[i]; in hostapd_ctrl_iface_disable_mld()
3656 struct hostapd_data *h_hapd = h_iface->bss[0]; in hostapd_ctrl_iface_disable_mld()
3658 if (!hostapd_is_ml_partner(h_hapd, iface->bss[0])) in hostapd_ctrl_iface_disable_mld()
3663 return -1; in hostapd_ctrl_iface_disable_mld()
3685 ret = -1; in hostapd_ctrl_iface_link_remove()
3706 int ret = -1; in hostapd_ctrl_nan_publish()
3783 return -1; in hostapd_ctrl_nan_cancel_publish()
3789 return -1; in hostapd_ctrl_nan_cancel_publish()
3803 int ret = -1; in hostapd_ctrl_nan_update_publish()
3843 int ret = -1; in hostapd_ctrl_nan_subscribe()
3907 return -1; in hostapd_ctrl_nan_cancel_subscribe()
3913 return -1; in hostapd_ctrl_nan_cancel_subscribe()
3928 int ret = -1; in hostapd_ctrl_nan_transmit()
3941 return -1; in hostapd_ctrl_nan_transmit()
3998 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4006 } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { in hostapd_ctrl_iface_receive_process()
4011 res = wpa_get_mib(hapd->wpa_auth, reply + reply_len, in hostapd_ctrl_iface_receive_process()
4012 reply_size - reply_len); in hostapd_ctrl_iface_receive_process()
4014 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4020 reply_size - reply_len); in hostapd_ctrl_iface_receive_process()
4022 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4028 res = radius_client_get_mib(hapd->radius, in hostapd_ctrl_iface_receive_process()
4030 reply_size - reply_len); in hostapd_ctrl_iface_receive_process()
4032 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4040 } else if (os_strcmp(buf, "STA-FIRST") == 0) { in hostapd_ctrl_iface_receive_process()
4046 } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { in hostapd_ctrl_iface_receive_process()
4051 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4054 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4057 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4061 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4064 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4067 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4070 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4078 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4081 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4085 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4090 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4096 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4099 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4105 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4112 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4124 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4130 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4133 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4138 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4141 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4146 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4149 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4152 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4155 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4162 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4167 if (hostapd_ctrl_iface_enable(hapd->iface)) in hostapd_ctrl_iface_receive_process()
4168 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4171 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4178 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4182 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4184 if (hostapd_reload_config(hapd->iface)) in hostapd_ctrl_iface_receive_process()
4185 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4187 if (hostapd_ctrl_iface_reload(hapd->iface)) in hostapd_ctrl_iface_receive_process()
4188 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4190 if (hostapd_ctrl_iface_disable(hapd->iface)) in hostapd_ctrl_iface_receive_process()
4191 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4194 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4198 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4201 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4205 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4208 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4211 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4214 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4217 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4220 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4223 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4226 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4231 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4236 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4239 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4242 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4245 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4248 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4251 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4253 if (wpa_auth_rekey_gtk(hapd->wpa_auth) < 0) in hostapd_ctrl_iface_receive_process()
4254 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4260 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4263 if (hostapd_ctrl_iface_chan_switch(hapd->iface, buf + 12)) in hostapd_ctrl_iface_receive_process()
4264 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4267 if (hostapd_ctrl_iface_color_change(hapd->iface, buf + 13)) in hostapd_ctrl_iface_receive_process()
4268 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4272 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4279 radius_server_erp_flush(hapd->radius_srv); in hostapd_ctrl_iface_receive_process()
4283 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4286 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4302 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4305 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4311 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4314 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4317 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4325 reply_len = hostapd_ctrl_driver_flags(hapd->iface, reply, in hostapd_ctrl_iface_receive_process()
4328 reply_len = hostapd_ctrl_driver_flags2(hapd->iface, reply, in hostapd_ctrl_iface_receive_process()
4335 &hapd->conf->accept_mac, in hostapd_ctrl_iface_receive_process()
4336 &hapd->conf->num_accept_mac, buf + 19) || in hostapd_ctrl_iface_receive_process()
4338 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4341 &hapd->conf->accept_mac, in hostapd_ctrl_iface_receive_process()
4342 &hapd->conf->num_accept_mac, buf + 19) || in hostapd_ctrl_iface_receive_process()
4345 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4348 hapd->conf->accept_mac, in hostapd_ctrl_iface_receive_process()
4349 hapd->conf->num_accept_mac, reply, reply_size); in hostapd_ctrl_iface_receive_process()
4352 &hapd->conf->accept_mac, in hostapd_ctrl_iface_receive_process()
4353 &hapd->conf->num_accept_mac); in hostapd_ctrl_iface_receive_process()
4356 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4358 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4363 &hapd->conf->deny_mac, in hostapd_ctrl_iface_receive_process()
4364 &hapd->conf->num_deny_mac, buf + 17) || in hostapd_ctrl_iface_receive_process()
4367 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4370 &hapd->conf->deny_mac, in hostapd_ctrl_iface_receive_process()
4371 &hapd->conf->num_deny_mac, buf + 17) || in hostapd_ctrl_iface_receive_process()
4373 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4376 hapd->conf->deny_mac, in hostapd_ctrl_iface_receive_process()
4377 hapd->conf->num_deny_mac, reply, reply_size); in hostapd_ctrl_iface_receive_process()
4380 &hapd->conf->deny_mac, in hostapd_ctrl_iface_receive_process()
4381 &hapd->conf->num_deny_mac); in hostapd_ctrl_iface_receive_process()
4383 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4385 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4391 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4395 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4400 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4404 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4409 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4413 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4418 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4422 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4425 res = dpp_bootstrap_gen(hapd->iface->interfaces->dpp, buf + 18); in hostapd_ctrl_iface_receive_process()
4427 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4431 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4434 if (dpp_bootstrap_remove(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
4436 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4440 uri = dpp_bootstrap_get_uri(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
4443 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4447 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4450 reply_len = dpp_bootstrap_info(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
4454 if (dpp_bootstrap_set(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
4457 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4460 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4463 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4468 res = dpp_configurator_add(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
4471 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4475 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4478 if (dpp_configurator_set(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
4480 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4482 if (dpp_configurator_remove(hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
4484 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4487 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4490 hapd->iface->interfaces->dpp, in hostapd_ctrl_iface_receive_process()
4496 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4500 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4504 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4508 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4511 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4513 dpp_controller_stop(hapd->iface->interfaces->dpp); in hostapd_ctrl_iface_receive_process()
4516 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4521 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4528 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4531 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4540 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4543 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4549 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4552 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4556 if (radius_server_dac_request(hapd->radius_srv, buf + 12) < 0) in hostapd_ctrl_iface_receive_process()
4557 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4564 reply_len = ptksa_cache_list(hapd->ptksa, reply, reply_size); in hostapd_ctrl_iface_receive_process()
4573 if (hostapd_ctrl_iface_enable_mld(hapd->iface)) in hostapd_ctrl_iface_receive_process()
4574 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4576 if (hostapd_ctrl_iface_disable_mld(hapd->iface)) in hostapd_ctrl_iface_receive_process()
4577 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4582 reply_len = -1; in hostapd_ctrl_iface_receive_process()
4615 res = recvfrom(sock, buf, sizeof(buf) - 1, 0, in hostapd_ctrl_iface_receive()
4638 hapd->ctrl_iface_cookie, in hostapd_ctrl_iface_receive()
4647 "CTRL: No cookie in the request - drop request"); in hostapd_ctrl_iface_receive()
4652 if (os_memcmp(hapd->ctrl_iface_cookie, lcookie, in hostapd_ctrl_iface_receive()
4655 "CTRL: Invalid cookie in the request - drop request"); in hostapd_ctrl_iface_receive()
4691 if (hapd->conf->ctrl_interface == NULL) in hostapd_ctrl_iface_path()
4694 len = os_strlen(hapd->conf->ctrl_interface) + in hostapd_ctrl_iface_path()
4695 os_strlen(hapd->conf->iface) + 2; in hostapd_ctrl_iface_path()
4701 hapd->conf->ctrl_interface, hapd->conf->iface); in hostapd_ctrl_iface_path()
4702 buf[len - 1] = '\0'; in hostapd_ctrl_iface_path()
4729 if (hapd->ctrl_sock > -1) { in hostapd_ctrl_iface_init()
4734 if (hapd->conf->ctrl_interface == NULL) in hostapd_ctrl_iface_init()
4737 pos = os_strstr(hapd->conf->ctrl_interface, "udp:"); in hostapd_ctrl_iface_init()
4747 dl_list_init(&hapd->ctrl_dst); in hostapd_ctrl_iface_init()
4748 hapd->ctrl_sock = -1; in hostapd_ctrl_iface_init()
4749 os_get_random(hapd->ctrl_iface_cookie, CTRL_IFACE_COOKIE_LEN); in hostapd_ctrl_iface_init()
4771 hapd->ctrl_sock = socket(res->ai_family, res->ai_socktype, in hostapd_ctrl_iface_init()
4772 res->ai_protocol); in hostapd_ctrl_iface_init()
4773 if (hapd->ctrl_sock < 0) { in hostapd_ctrl_iface_init()
4778 if (bind(hapd->ctrl_sock, res->ai_addr, res->ai_addrlen) < 0) { in hostapd_ctrl_iface_init()
4779 port--; in hostapd_ctrl_iface_init()
4780 if ((HOSTAPD_CTRL_IFACE_PORT - port) < in hostapd_ctrl_iface_init()
4792 os_free(hapd->conf->ctrl_interface); in hostapd_ctrl_iface_init()
4793 hapd->conf->ctrl_interface = tmp; in hostapd_ctrl_iface_init()
4797 if (eloop_register_read_sock(hapd->ctrl_sock, in hostapd_ctrl_iface_init()
4801 return -1; in hostapd_ctrl_iface_init()
4804 hapd->msg_ctx = hapd; in hostapd_ctrl_iface_init()
4810 if (hapd->ctrl_sock >= 0) in hostapd_ctrl_iface_init()
4811 close(hapd->ctrl_sock); in hostapd_ctrl_iface_init()
4812 return -1; in hostapd_ctrl_iface_init()
4815 int s = -1; in hostapd_ctrl_iface_init()
4818 if (hapd->ctrl_sock > -1) { in hostapd_ctrl_iface_init()
4823 dl_list_init(&hapd->ctrl_dst); in hostapd_ctrl_iface_init()
4825 if (hapd->conf->ctrl_interface == NULL) in hostapd_ctrl_iface_init()
4828 if (mkdir(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) { in hostapd_ctrl_iface_init()
4839 if (hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
4840 lchown(hapd->conf->ctrl_interface, -1, in hostapd_ctrl_iface_init()
4841 hapd->conf->ctrl_interface_gid) < 0) { in hostapd_ctrl_iface_init()
4844 return -1; in hostapd_ctrl_iface_init()
4847 if (!hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
4848 hapd->iface->interfaces->ctrl_iface_group && in hostapd_ctrl_iface_init()
4849 lchown(hapd->conf->ctrl_interface, -1, in hostapd_ctrl_iface_init()
4850 hapd->iface->interfaces->ctrl_iface_group) < 0) { in hostapd_ctrl_iface_init()
4853 return -1; in hostapd_ctrl_iface_init()
4859 * directory without group access. This breaks things since Wi-Fi in hostapd_ctrl_iface_init()
4864 if (chmod(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) { in hostapd_ctrl_iface_init()
4871 if (os_strlen(hapd->conf->ctrl_interface) + 1 + in hostapd_ctrl_iface_init()
4872 os_strlen(hapd->conf->iface) >= sizeof(addr.sun_path)) in hostapd_ctrl_iface_init()
4895 " allow connections - assuming it was left" in hostapd_ctrl_iface_init()
4906 "hostapd-ctrl-iface: bind(PF_UNIX): %s", in hostapd_ctrl_iface_init()
4914 "be in use - cannot override it"); in hostapd_ctrl_iface_init()
4923 if (hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
4924 lchown(fname, -1, hapd->conf->ctrl_interface_gid) < 0) { in hostapd_ctrl_iface_init()
4930 if (!hapd->conf->ctrl_interface_gid_set && in hostapd_ctrl_iface_init()
4931 hapd->iface->interfaces->ctrl_iface_group && in hostapd_ctrl_iface_init()
4932 lchown(fname, -1, hapd->iface->interfaces->ctrl_iface_group) < 0) { in hostapd_ctrl_iface_init()
4945 hapd->ctrl_sock = s; in hostapd_ctrl_iface_init()
4949 return -1; in hostapd_ctrl_iface_init()
4951 hapd->msg_ctx = hapd; in hostapd_ctrl_iface_init()
4963 return -1; in hostapd_ctrl_iface_init()
4972 if (hapd->ctrl_sock > -1) { in hostapd_ctrl_iface_deinit()
4977 eloop_unregister_read_sock(hapd->ctrl_sock); in hostapd_ctrl_iface_deinit()
4978 close(hapd->ctrl_sock); in hostapd_ctrl_iface_deinit()
4979 hapd->ctrl_sock = -1; in hostapd_ctrl_iface_deinit()
4986 if (hapd->conf->ctrl_interface && in hostapd_ctrl_iface_deinit()
4987 rmdir(hapd->conf->ctrl_interface) < 0) { in hostapd_ctrl_iface_deinit()
4990 "directory not empty - leaving it " in hostapd_ctrl_iface_deinit()
4995 hapd->conf->ctrl_interface, in hostapd_ctrl_iface_deinit()
5002 dl_list_for_each_safe(dst, prev, &hapd->ctrl_dst, struct wpa_ctrl_dst, in hostapd_ctrl_iface_deinit()
5007 l2_packet_deinit(hapd->l2_test); in hostapd_ctrl_iface_deinit()
5008 hapd->l2_test = NULL; in hostapd_ctrl_iface_deinit()
5018 return -1; in hostapd_ctrl_iface_add()
5029 return -1; in hostapd_ctrl_iface_remove()
5039 return ctrl_iface_attach(&interfaces->global_ctrl_dst, from, fromlen, in hostapd_global_ctrl_iface_attach()
5048 return ctrl_iface_detach(&interfaces->global_ctrl_dst, from, fromlen); in hostapd_global_ctrl_iface_detach()
5074 dpp_global_clear(interfaces->dpp); in hostapd_ctrl_iface_flush()
5076 interfaces->dpp_pb_bi = NULL; in hostapd_ctrl_iface_flush()
5083 info = &interfaces->dpp_pb[i]; in hostapd_ctrl_iface_flush()
5084 info->rx_time.sec = 0; in hostapd_ctrl_iface_flush()
5085 info->rx_time.usec = 0; in hostapd_ctrl_iface_flush()
5107 if (hapd->iface->fst) { in hostapd_global_ctrl_iface_fst_attach()
5109 return -1; in hostapd_global_ctrl_iface_fst_attach()
5112 hapd->iface->fst = fst_attach(ifname, hapd->own_addr, in hostapd_global_ctrl_iface_fst_attach()
5114 if (hapd->iface->fst) in hostapd_global_ctrl_iface_fst_attach()
5119 return -EINVAL; in hostapd_global_ctrl_iface_fst_attach()
5134 hapd->iface->fst = NULL; in hostapd_global_ctrl_iface_fst_detach()
5135 hapd->iface->fst_ies = NULL; in hostapd_global_ctrl_iface_fst_detach()
5141 return -EINVAL; in hostapd_global_ctrl_iface_fst_detach()
5153 for (i = 0; i < interfaces->count; i++) { in hostapd_interfaces_get_hapd()
5154 struct hostapd_iface *iface = interfaces->iface[i]; in hostapd_interfaces_get_hapd()
5156 for (j = 0; j < iface->num_bss; j++) { in hostapd_interfaces_get_hapd()
5159 hapd = iface->bss[j]; in hostapd_interfaces_get_hapd()
5160 if (os_strcmp(ifname, hapd->conf->iface) == 0) in hostapd_interfaces_get_hapd()
5186 src_hapd->conf->wpa); in hostapd_ctrl_iface_dup_param()
5188 src_hapd->conf->wpa_key_mgmt) { in hostapd_ctrl_iface_dup_param()
5194 src_hapd->conf->wpa_pairwise) { in hostapd_ctrl_iface_dup_param()
5197 src_hapd->conf->wpa_pairwise, " "); in hostapd_ctrl_iface_dup_param()
5201 src_hapd->conf->rsn_pairwise) { in hostapd_ctrl_iface_dup_param()
5204 src_hapd->conf->rsn_pairwise, " "); in hostapd_ctrl_iface_dup_param()
5208 src_hapd->conf->ssid.wpa_passphrase) { in hostapd_ctrl_iface_dup_param()
5210 src_hapd->conf->ssid.wpa_passphrase); in hostapd_ctrl_iface_dup_param()
5212 src_hapd->conf->ssid.wpa_psk_set) { in hostapd_ctrl_iface_dup_param()
5214 src_hapd->conf->ssid.wpa_psk->psk, PMK_LEN); in hostapd_ctrl_iface_dup_param()
5220 res = hostapd_set_iface(dst_hapd->iconf, dst_hapd->conf, param, value); in hostapd_ctrl_iface_dup_param()
5228 return -1; in hostapd_ctrl_iface_dup_param()
5249 for (i = 0; i < interfaces->count; i++) { in hostapd_global_ctrl_iface_interfaces()
5250 iface = interfaces->iface[i]; in hostapd_global_ctrl_iface_interfaces()
5252 for (j = 0; j < iface->num_bss; j++) { in hostapd_global_ctrl_iface_interfaces()
5255 conf = iface->conf->bss[j]; in hostapd_global_ctrl_iface_interfaces()
5257 res = os_snprintf(pos, end - pos, in hostapd_global_ctrl_iface_interfaces()
5259 conf->iface, in hostapd_global_ctrl_iface_interfaces()
5260 conf->ctrl_interface ? in hostapd_global_ctrl_iface_interfaces()
5261 conf->ctrl_interface : "N/A"); in hostapd_global_ctrl_iface_interfaces()
5263 res = os_snprintf(pos, end - pos, "%s\n", in hostapd_global_ctrl_iface_interfaces()
5264 conf->iface); in hostapd_global_ctrl_iface_interfaces()
5265 if (os_snprintf_error(end - pos, res)) { in hostapd_global_ctrl_iface_interfaces()
5267 return pos - reply; in hostapd_global_ctrl_iface_interfaces()
5273 return pos - reply; in hostapd_global_ctrl_iface_interfaces()
5284 /* cmd: "<src ifname> <dst ifname> <variable name> */ in hostapd_global_ctrl_iface_dup_network()
5288 wpa_printf(MSG_ERROR, "DUP: no src ifname found in cmd: '%s'", in hostapd_global_ctrl_iface_dup_network()
5290 return -1; in hostapd_global_ctrl_iface_dup_network()
5296 wpa_printf(MSG_ERROR, "DUP: no src ifname found: '%s'", in hostapd_global_ctrl_iface_dup_network()
5298 return -1; in hostapd_global_ctrl_iface_dup_network()
5306 return -1; in hostapd_global_ctrl_iface_dup_network()
5314 return -1; in hostapd_global_ctrl_iface_dup_network()
5335 res = os_snprintf(reply, reply_size, "FAIL-NO-IFNAME-MATCH\n"); in hostapd_global_ctrl_iface_ifname()
5337 return -1; in hostapd_global_ctrl_iface_ifname()
5361 res = recvfrom(sock, buffer, sizeof(buffer) - 1, 0, in hostapd_global_ctrl_iface_receive()
5388 interfaces->ctrl_iface_cookie, in hostapd_global_ctrl_iface_receive()
5397 "CTRL: No cookie in the request - drop request"); in hostapd_global_ctrl_iface_receive()
5402 if (os_memcmp(interfaces->ctrl_iface_cookie, lcookie, in hostapd_global_ctrl_iface_receive()
5405 "CTRL: Invalid cookie in the request - drop request"); in hostapd_global_ctrl_iface_receive()
5432 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5437 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5440 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5444 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5448 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5452 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5456 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5459 } else if (os_strncmp(buf, "FST-ATTACH ", 11) == 0) { in hostapd_global_ctrl_iface_receive()
5463 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5464 } else if (os_strncmp(buf, "FST-DETACH ", 11) == 0) { in hostapd_global_ctrl_iface_receive()
5468 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5469 } else if (os_strncmp(buf, "FST-MANAGER ", 12) == 0) { in hostapd_global_ctrl_iface_receive()
5477 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5486 reply_len = -1; in hostapd_global_ctrl_iface_receive()
5510 if (interface->global_iface_path == NULL) in hostapd_global_ctrl_iface_path()
5513 len = os_strlen(interface->global_iface_path) + in hostapd_global_ctrl_iface_path()
5514 os_strlen(interface->global_iface_name) + 2; in hostapd_global_ctrl_iface_path()
5519 os_snprintf(buf, len, "%s/%s", interface->global_iface_path, in hostapd_global_ctrl_iface_path()
5520 interface->global_iface_name); in hostapd_global_ctrl_iface_path()
5521 buf[len - 1] = '\0'; in hostapd_global_ctrl_iface_path()
5536 if (interface->global_ctrl_sock > -1) { in hostapd_global_ctrl_iface_init()
5541 if (interface->global_iface_path == NULL) in hostapd_global_ctrl_iface_init()
5544 pos = os_strstr(interface->global_iface_path, "udp:"); in hostapd_global_ctrl_iface_init()
5554 os_get_random(interface->ctrl_iface_cookie, CTRL_IFACE_COOKIE_LEN); in hostapd_global_ctrl_iface_init()
5576 interface->global_ctrl_sock = socket(res->ai_family, res->ai_socktype, in hostapd_global_ctrl_iface_init()
5577 res->ai_protocol); in hostapd_global_ctrl_iface_init()
5578 if (interface->global_ctrl_sock < 0) { in hostapd_global_ctrl_iface_init()
5583 if (bind(interface->global_ctrl_sock, res->ai_addr, res->ai_addrlen) < in hostapd_global_ctrl_iface_init()
5586 if ((port - HOSTAPD_GLOBAL_CTRL_IFACE_PORT) < in hostapd_global_ctrl_iface_init()
5597 if (eloop_register_read_sock(interface->global_ctrl_sock, in hostapd_global_ctrl_iface_init()
5601 return -1; in hostapd_global_ctrl_iface_init()
5609 if (interface->global_ctrl_sock >= 0) in hostapd_global_ctrl_iface_init()
5610 close(interface->global_ctrl_sock); in hostapd_global_ctrl_iface_init()
5611 return -1; in hostapd_global_ctrl_iface_init()
5614 int s = -1; in hostapd_global_ctrl_iface_init()
5617 if (interface->global_iface_path == NULL) { in hostapd_global_ctrl_iface_init()
5622 if (mkdir(interface->global_iface_path, S_IRWXU | S_IRWXG) < 0) { in hostapd_global_ctrl_iface_init()
5631 } else if (interface->ctrl_iface_group && in hostapd_global_ctrl_iface_init()
5632 lchown(interface->global_iface_path, -1, in hostapd_global_ctrl_iface_init()
5633 interface->ctrl_iface_group) < 0) { in hostapd_global_ctrl_iface_init()
5639 if (os_strlen(interface->global_iface_path) + 1 + in hostapd_global_ctrl_iface_init()
5640 os_strlen(interface->global_iface_name) >= sizeof(addr.sun_path)) in hostapd_global_ctrl_iface_init()
5663 " allow connections - assuming it was left" in hostapd_global_ctrl_iface_init()
5681 "be in use - cannot override it"); in hostapd_global_ctrl_iface_init()
5690 if (interface->ctrl_iface_group && in hostapd_global_ctrl_iface_init()
5691 lchown(fname, -1, interface->ctrl_iface_group) < 0) { in hostapd_global_ctrl_iface_init()
5704 interface->global_ctrl_sock = s; in hostapd_global_ctrl_iface_init()
5719 return -1; in hostapd_global_ctrl_iface_init()
5731 if (interfaces->global_ctrl_sock > -1) { in hostapd_global_ctrl_iface_deinit()
5732 eloop_unregister_read_sock(interfaces->global_ctrl_sock); in hostapd_global_ctrl_iface_deinit()
5733 close(interfaces->global_ctrl_sock); in hostapd_global_ctrl_iface_deinit()
5734 interfaces->global_ctrl_sock = -1; in hostapd_global_ctrl_iface_deinit()
5742 if (interfaces->global_iface_path && in hostapd_global_ctrl_iface_deinit()
5743 rmdir(interfaces->global_iface_path) < 0) { in hostapd_global_ctrl_iface_deinit()
5746 "directory not empty - leaving it " in hostapd_global_ctrl_iface_deinit()
5751 interfaces->global_iface_path, in hostapd_global_ctrl_iface_deinit()
5758 os_free(interfaces->global_iface_path); in hostapd_global_ctrl_iface_deinit()
5759 interfaces->global_iface_path = NULL; in hostapd_global_ctrl_iface_deinit()
5761 dl_list_for_each_safe(dst, prev, &interfaces->global_ctrl_dst, in hostapd_global_ctrl_iface_deinit()
5774 return !!(dst->events & WPA_EVENT_RX_PROBE_REQUEST); in hostapd_ctrl_check_event_enabled()
5819 if ((level >= dst->debug_level) && in hostapd_ctrl_iface_send_internal()
5822 &dst->addr, dst->addrlen); in hostapd_ctrl_iface_send_internal()
5823 msg.msg_name = &dst->addr; in hostapd_ctrl_iface_send_internal()
5824 msg.msg_namelen = dst->addrlen; in hostapd_ctrl_iface_send_internal()
5828 "%d - %s", in hostapd_ctrl_iface_send_internal()
5830 dst->errors++; in hostapd_ctrl_iface_send_internal()
5831 if (dst->errors > 10 || _errno == ENOENT) { in hostapd_ctrl_iface_send_internal()
5833 &dst->addr, in hostapd_ctrl_iface_send_internal()
5834 dst->addrlen); in hostapd_ctrl_iface_send_internal()
5837 dst->errors = 0; in hostapd_ctrl_iface_send_internal()
5850 hapd->iface->interfaces->global_ctrl_sock, in hostapd_ctrl_iface_send()
5851 &hapd->iface->interfaces->global_ctrl_dst, in hostapd_ctrl_iface_send()
5853 NULL : hapd->conf->iface, in hostapd_ctrl_iface_send()
5859 hapd->ctrl_sock, &hapd->ctrl_dst, in hostapd_ctrl_iface_send()