Lines Matching +full:rx +full:- +full:ping +full:- +full:pong
2 * WPA Supplicant - command line interface for wpa_supplicant daemon
3 * Copyright (c) 2004-2022, Jouni Malinen <j@w1.fi>
32 "Copyright (c) 2004-2024, Jouni Malinen <j@w1.fi> and contributors";
44 static int wpa_cli_connected = -1;
84 printf("wpa_cli [-p<path to ctrl sockets>] [-i<ifname>] [-hvBr] " in usage()
85 "[-a<action file>] \\\n" in usage()
86 " [-P<pid file>] [-g<global ctrl>] [-G<ping interval>] " in usage()
88 " [-s<wpa_client_socket_file_path>] " in usage()
90 " -h = help (show this usage text)\n" in usage()
91 " -v = shown version information\n" in usage()
92 " -a = run in daemon mode executing the action file based on " in usage()
95 " -r = try to reconnect when client socket is disconnected.\n" in usage()
96 " This is useful only when used with -a.\n" in usage()
97 " -B = run a daemon in the background\n" in usage()
130 return -1; in wpa_cli_open_connection()
141 return -1; in wpa_cli_open_connection()
147 return -1; in wpa_cli_open_connection()
155 return -1; in wpa_cli_open_connection()
162 return -1; in wpa_cli_open_connection()
167 return -1; in wpa_cli_open_connection()
174 return -1; in wpa_cli_open_connection()
195 return -1; in wpa_cli_open_connection()
235 printf("Not connected to wpa_supplicant - command dropped.\n"); in _wpa_ctrl_command()
236 return -1; in _wpa_ctrl_command()
241 buf[sizeof(buf) - 1] = '\0'; in _wpa_ctrl_command()
244 len = sizeof(buf) - 1; in _wpa_ctrl_command()
247 if (ret == -2) { in _wpa_ctrl_command()
249 return -2; in _wpa_ctrl_command()
252 return -1; in _wpa_ctrl_command()
257 if (interactive && len > 0 && buf[len - 1] != '\n') in _wpa_ctrl_command()
275 printf("Invalid %s command - at least %d argument%s " in wpa_cli_cmd()
278 return -1; in wpa_cli_cmd()
281 return -1; in wpa_cli_cmd()
295 return wpa_ctrl_command(ctrl, "STATUS-VERBOSE"); in wpa_cli_cmd_status()
297 return wpa_ctrl_command(ctrl, "STATUS-WPS"); in wpa_cli_cmd_status()
299 return wpa_ctrl_command(ctrl, "STATUS-DRIVER"); in wpa_cli_cmd_status()
302 return wpa_ctrl_command(ctrl, "STATUS-NO_EVENTS"); in wpa_cli_cmd_status()
310 return wpa_ctrl_command(ctrl, "PING"); in wpa_cli_cmd_ping()
437 return -1; in wpa_cli_cmd_set()
710 return -1; in wpa_cli_cmd_bss_flush()
732 "- BSSID: use 'any' to select any\n" in wpa_cli_cmd_wps_pin()
733 "- PIN: optional, used only with devices that have no " in wpa_cli_cmd_wps_pin()
735 return -1; in wpa_cli_cmd_wps_pin()
786 printf("Invalid 'wps_nfc_tag_read' command - one argument " in wpa_cli_cmd_wps_nfc_tag_read()
788 return -1; in wpa_cli_cmd_wps_nfc_tag_read()
794 return -1; in wpa_cli_cmd_wps_nfc_tag_read()
863 "- BSSID of the target AP\n" in wpa_cli_cmd_wps_reg()
864 "- AP PIN\n"); in wpa_cli_cmd_wps_reg()
867 "- BSSID of the target AP\n" in wpa_cli_cmd_wps_reg()
868 "- AP PIN\n" in wpa_cli_cmd_wps_reg()
869 "- new SSID\n" in wpa_cli_cmd_wps_reg()
870 "- new auth (OPEN, WPAPSK, WPA2PSK)\n" in wpa_cli_cmd_wps_reg()
871 "- new encr (NONE, WEP, TKIP, CCMP)\n" in wpa_cli_cmd_wps_reg()
872 "- new key\n"); in wpa_cli_cmd_wps_reg()
873 return -1; in wpa_cli_cmd_wps_reg()
878 return -1; in wpa_cli_cmd_wps_reg()
912 "- UUID: use 'any' to select any\n" in wpa_cli_cmd_wps_er_pin()
913 "- PIN: Enrollee PIN\n" in wpa_cli_cmd_wps_er_pin()
914 "optional: - Enrollee MAC address\n"); in wpa_cli_cmd_wps_er_pin()
915 return -1; in wpa_cli_cmd_wps_er_pin()
934 "- UUID: specify which AP to use\n" in wpa_cli_cmd_wps_er_learn()
935 "- PIN: AP PIN\n"); in wpa_cli_cmd_wps_er_learn()
936 return -1; in wpa_cli_cmd_wps_er_learn()
949 "- UUID: specify which AP to use\n" in wpa_cli_cmd_wps_er_set_config()
950 "- Network configuration id\n"); in wpa_cli_cmd_wps_er_set_config()
951 return -1; in wpa_cli_cmd_wps_er_set_config()
992 "- AP UUID\n" in wpa_cli_cmd_wps_er_config()
993 "- AP PIN\n" in wpa_cli_cmd_wps_er_config()
994 "- new SSID\n" in wpa_cli_cmd_wps_er_config()
995 "- new auth (OPEN, WPAPSK, WPA2PSK)\n" in wpa_cli_cmd_wps_er_config()
996 "- new encr (NONE, WEP, TKIP, CCMP)\n" in wpa_cli_cmd_wps_er_config()
997 "- new key\n"); in wpa_cli_cmd_wps_er_config()
998 return -1; in wpa_cli_cmd_wps_er_config()
1003 return -1; in wpa_cli_cmd_wps_er_config()
1016 "- WPS/NDEF: token format\n" in wpa_cli_cmd_wps_er_nfc_config_token()
1017 "- UUID: specify which AP to use\n"); in wpa_cli_cmd_wps_er_nfc_config_token()
1018 return -1; in wpa_cli_cmd_wps_er_nfc_config_token()
1046 return -1; in wpa_cli_cmd_identity()
1051 ret = os_snprintf(pos, end - pos, WPA_CTRL_RSP "IDENTITY-%s:%s", in wpa_cli_cmd_identity()
1053 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_identity()
1055 return -1; in wpa_cli_cmd_identity()
1059 ret = os_snprintf(pos, end - pos, " %s", argv[i]); in wpa_cli_cmd_identity()
1060 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_identity()
1062 return -1; in wpa_cli_cmd_identity()
1079 return -1; in wpa_cli_cmd_password()
1084 ret = os_snprintf(pos, end - pos, WPA_CTRL_RSP "PASSWORD-%s:%s", in wpa_cli_cmd_password()
1086 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_password()
1088 return -1; in wpa_cli_cmd_password()
1092 ret = os_snprintf(pos, end - pos, " %s", argv[i]); in wpa_cli_cmd_password()
1093 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_password()
1095 return -1; in wpa_cli_cmd_password()
1113 return -1; in wpa_cli_cmd_new_password()
1118 ret = os_snprintf(pos, end - pos, WPA_CTRL_RSP "NEW_PASSWORD-%s:%s", in wpa_cli_cmd_new_password()
1120 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_new_password()
1122 return -1; in wpa_cli_cmd_new_password()
1126 ret = os_snprintf(pos, end - pos, " %s", argv[i]); in wpa_cli_cmd_new_password()
1127 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_new_password()
1129 return -1; in wpa_cli_cmd_new_password()
1146 return -1; in wpa_cli_cmd_pin()
1151 ret = os_snprintf(pos, end - pos, WPA_CTRL_RSP "PIN-%s:%s", in wpa_cli_cmd_pin()
1153 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_pin()
1155 return -1; in wpa_cli_cmd_pin()
1159 ret = os_snprintf(pos, end - pos, " %s", argv[i]); in wpa_cli_cmd_pin()
1160 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_pin()
1162 return -1; in wpa_cli_cmd_pin()
1178 return -1; in wpa_cli_cmd_otp()
1183 ret = os_snprintf(pos, end - pos, WPA_CTRL_RSP "OTP-%s:%s", in wpa_cli_cmd_otp()
1185 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_otp()
1187 return -1; in wpa_cli_cmd_otp()
1191 ret = os_snprintf(pos, end - pos, " %s", argv[i]); in wpa_cli_cmd_otp()
1192 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_otp()
1194 return -1; in wpa_cli_cmd_otp()
1211 return -1; in wpa_cli_cmd_sim()
1216 ret = os_snprintf(pos, end - pos, WPA_CTRL_RSP "SIM-%s:%s", in wpa_cli_cmd_sim()
1218 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_sim()
1220 return -1; in wpa_cli_cmd_sim()
1224 ret = os_snprintf(pos, end - pos, " %s", argv[i]); in wpa_cli_cmd_sim()
1225 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_sim()
1227 return -1; in wpa_cli_cmd_sim()
1243 return -1; in wpa_cli_cmd_psk_passphrase()
1248 ret = os_snprintf(pos, end - pos, WPA_CTRL_RSP "PSK_PASSPHRASE-%s:%s", in wpa_cli_cmd_psk_passphrase()
1250 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_psk_passphrase()
1252 return -1; in wpa_cli_cmd_psk_passphrase()
1256 ret = os_snprintf(pos, end - pos, " %s", argv[i]); in wpa_cli_cmd_psk_passphrase()
1257 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_psk_passphrase()
1259 return -1; in wpa_cli_cmd_psk_passphrase()
1277 return -1; in wpa_cli_cmd_passphrase()
1282 ret = os_snprintf(pos, end - pos, WPA_CTRL_RSP "PASSPHRASE-%s:%s", in wpa_cli_cmd_passphrase()
1284 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_passphrase()
1286 return -1; in wpa_cli_cmd_passphrase()
1290 ret = os_snprintf(pos, end - pos, " %s", argv[i]); in wpa_cli_cmd_passphrase()
1291 if (os_snprintf_error(end - pos, ret)) { in wpa_cli_cmd_passphrase()
1293 return -1; in wpa_cli_cmd_passphrase()
1307 return -1; in wpa_cli_cmd_bssid()
1379 " psk (WPA passphrase or pre-shared key)\n" in wpa_cli_show_network_variables()
1407 return -1; in wpa_cli_cmd_set_network()
1425 return -1; in wpa_cli_cmd_get_network()
1552 return -1; in wpa_cli_cmd_dup_network()
1652 return -1; in wpa_cli_cmd_set_cred()
1664 return -1; in wpa_cli_cmd_get_cred()
1738 return -1; in wpa_cli_cmd_get_capability()
1744 return -1; in wpa_cli_cmd_get_capability()
1750 return -1; in wpa_cli_cmd_get_capability()
1755 return -1; in wpa_cli_cmd_get_capability()
1850 printf("Could not connect to interface '%s' - re-trying\n", in wpa_cli_cmd_interface()
1882 return -1; in wpa_cli_cmd_interface_add()
1897 return -1; in wpa_cli_cmd_interface_add()
1898 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_interface_add()
1947 printf("Not connected to hostapd - command dropped.\n"); in wpa_ctrl_command_sta()
1948 return -1; in wpa_ctrl_command_sta()
1953 buf[sizeof(buf) - 1] = '\0'; in wpa_ctrl_command_sta()
1956 len = sizeof(buf) - 1; in wpa_ctrl_command_sta()
1959 if (ret == -2) { in wpa_ctrl_command_sta()
1961 return -2; in wpa_ctrl_command_sta()
1964 return -1; in wpa_ctrl_command_sta()
1970 return -1; in wpa_ctrl_command_sta()
1987 if (wpa_ctrl_command_sta(ctrl, "STA-FIRST", addr, sizeof(addr), 1)) in wpa_cli_cmd_all_sta()
1990 os_snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr); in wpa_cli_cmd_all_sta()
1993 return -1; in wpa_cli_cmd_all_sta()
2002 if (wpa_ctrl_command_sta(ctrl, "STA-FIRST", addr, sizeof(addr), 0)) in wpa_cli_cmd_list_sta()
2007 os_snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr); in wpa_cli_cmd_list_sta()
2299 return -1; in wpa_cli_cmd_p2p_prov_disc()
2321 return -1; in wpa_cli_cmd_p2p_serv_disc_req()
2325 return -1; in wpa_cli_cmd_p2p_serv_disc_req()
2346 return -1; in wpa_cli_cmd_p2p_serv_disc_resp()
2352 return -1; in wpa_cli_cmd_p2p_serv_disc_resp()
2353 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_p2p_serv_disc_resp()
2383 printf("Invalid P2P_SERVICE_ADD command: needs 3-6 arguments\n"); in wpa_cli_cmd_p2p_service_add()
2384 return -1; in wpa_cli_cmd_p2p_service_add()
2395 printf("Invalid P2P_SERVICE_REP command: needs 5-6 " in wpa_cli_cmd_p2p_service_rep()
2397 return -1; in wpa_cli_cmd_p2p_service_rep()
2413 return -1; in wpa_cli_cmd_p2p_service_del()
2425 return -1; in wpa_cli_cmd_p2p_service_del()
2426 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_p2p_service_del()
2475 return -1; in wpa_ctrl_command_p2p_peer()
2476 len = sizeof(buf) - 1; in wpa_ctrl_command_p2p_peer()
2479 if (ret == -2) { in wpa_ctrl_command_p2p_peer()
2481 return -2; in wpa_ctrl_command_p2p_peer()
2484 return -1; in wpa_ctrl_command_p2p_peer()
2489 return -1; in wpa_ctrl_command_p2p_peer()
2511 return -1; in wpa_cli_cmd_p2p_peers()
2513 os_snprintf(cmd, sizeof(cmd), "P2P_PEER NEXT-%s", addr); in wpa_cli_cmd_p2p_peers()
2599 return -1; in wpa_cli_cmd_p2p_presence_req()
2615 return -1; in wpa_cli_cmd_p2p_ext_listen()
2663 return -1; in wpa_cli_cmd_wfd_subelem_set()
2669 return -1; in wpa_cli_cmd_wfd_subelem_set()
2670 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_wfd_subelem_set()
2684 return -1; in wpa_cli_cmd_wfd_subelem_get()
2690 return -1; in wpa_cli_cmd_wfd_subelem_get()
2691 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_wfd_subelem_get()
2771 return -1; in wpa_cli_cmd_get_nai_home_realm_list()
2776 return -1; in wpa_cli_cmd_get_nai_home_realm_list()
2790 return -1; in wpa_cli_cmd_hs20_icon_request()
2794 return -1; in wpa_cli_cmd_hs20_icon_request()
2974 return -1; in wpa_cli_cmd_raw()
2975 return wpa_cli_cmd(ctrl, argv[0], 0, argc - 1, &argv[1]); in wpa_cli_cmd_raw()
3214 int ret, id = -1; in wpa_ctrl_command_bss()
3217 return -1; in wpa_ctrl_command_bss()
3218 len = sizeof(buf) - 1; in wpa_ctrl_command_bss()
3221 if (ret == -2) { in wpa_ctrl_command_bss()
3223 return -2; in wpa_ctrl_command_bss()
3226 return -1; in wpa_ctrl_command_bss()
3231 return -1; in wpa_ctrl_command_bss()
3252 if (id != -1) in wpa_ctrl_command_bss()
3263 int id = -1; in wpa_cli_cmd_all_bss()
3275 os_snprintf(cmd, sizeof(cmd), "BSS NEXT-%d MASK=0x%x", in wpa_cli_cmd_all_bss()
3358 { "ping", wpa_cli_cmd_ping, NULL,
3363 "= re-open log-file (allow rolling logs)" },
3452 "<network id> <password> = configure one-time-password for an SSID"
3557 "= force wpa_supplicant to re-read its configuration file" },
3591 "<addr> = request over-the-DS FT with <addr>" },
3594 "[BSSID] = start Wi-Fi Protected Setup: Push Button Configuration" },
3607 "[BSSID] = start Wi-Fi Protected Setup: NFC" },
3636 "[IP address] = start Wi-Fi Protected Setup External Registrar" },
3639 "= stop Wi-Fi Protected Setup External Registrar" },
3700 "= send Multi-Link Probe request <bssid=addr> <mld_id=id> [link_id=id] (test command)" },
3728 "[timeout] [type=*] = find P2P Devices for up-to timeout seconds" },
3741 "[timeout] = listen for P2P Devices for up-to timeout seconds" },
3834 "<subelem> [contents] = set Wi-Fi Display subelement" },
3837 "<subelem> = get Wi-Fi Display subelement" },
3901 "= add WMM-AC traffic stream" },
3904 "<tsid> = delete WMM-AC traffic stream" },
3907 "= show status for Wireless Multi-Media Admission-Control" },
3925 "= get TX/RX packet counters" },
3935 "<enter/exit> [interval=#] = enter/exit WNM-Sleep mode" },
3968 …-cmd>] [twt=<u64>] [requestor=0|1] [trigger=0|1] [implicit=0|1] [flow_type=0|1] [flow_id=<3-bit-id…
3978 "<scan|sched|pno|all> enable=<0/1> [addr=mac-address "
3979 "mask=mac-address-mask] = scan MAC randomization"
4074 …"[scs_id=<decimal number>] <add|remove|change> [scs_up=<0-7>] [classifier_type=<4|10>] [classifier…
4099 printf("%s%s ", pad, cmd->cmd); in print_cmd_help()
4100 for (n = 0; (c = cmd->usage[n]); n++) { in print_cmd_help()
4128 len = delim - cmd; in wpa_cli_edit_filter_history_cb()
4161 size_t len = 8 + os_strlen(e->txt); in wpa_list_cmd_list()
4165 os_snprintf(res[i], len, "ifname=%s", e->txt); in wpa_list_cmd_list()
4170 res[i] = os_strdup(e->txt); in wpa_list_cmd_list()
4209 if (end && pos > end - str) { in wpa_cli_edit_completion_cb()
4210 pos -= end - str + 1; in wpa_cli_edit_completion_cb()
4223 cmd[end - str] = '\0'; in wpa_cli_edit_completion_cb()
4239 argc--; in wpa_request()
4244 return -1; in wpa_request()
4248 while (cmd->cmd) { in wpa_request()
4249 if (os_strncasecmp(cmd->cmd, argv[0], os_strlen(argv[0])) == 0) in wpa_request()
4252 if (os_strcasecmp(cmd->cmd, argv[0]) == 0) { in wpa_request()
4265 while (cmd->cmd) { in wpa_request()
4266 if (os_strncasecmp(cmd->cmd, argv[0], in wpa_request()
4268 printf(" %s", cmd->cmd); in wpa_request()
4278 ret = match->handler(ctrl, argc - 1, &argv[1]); in wpa_request()
4299 return -1; in wpa_cli_exec()
4322 if (end && (unsigned int) (end - pos) < sizeof(ifname_buf)) { in wpa_cli_action_process()
4324 os_memcpy(ifname_buf, pos, end - pos); in wpa_cli_action_process()
4325 ifname_buf[end - pos] = '\0'; in wpa_cli_action_process()
4341 int new_id = -1; in wpa_cli_action_process()
4452 printf("wpa_supplicant is terminating - stop monitoring\n"); in wpa_cli_action_process()
4478 return -1; in wpa_cli_open_global_ctrl()
4511 printf("\rConnection to wpa_supplicant re-established\n"); in wpa_cli_reconnect()
4601 printf("\rConnection to wpa_supplicant lost - trying to " in check_terminating()
4621 size_t len = sizeof(buf) - 1; in wpa_cli_recv_pending()
4644 printf("Connection to wpa_supplicant lost - trying to " in wpa_cli_recv_pending()
4662 res = _wpa_ctrl_command(ctrl_conn, "PING", 0); in wpa_cli_ping()
4665 printf("Connection to wpa_supplicant lost - trying to " in wpa_cli_ping()
4872 if (wpa_ctrl_command_sta(ctrl, "STA-FIRST", addr, sizeof(addr), 0)) in update_stations()
4877 os_snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr); in update_stations()
4894 "%s - re-trying\n", in try_connection()
4944 len = sizeof(buf) - 1; in wpa_cli_action_ping()
4945 if (wpa_ctrl_request(ctrl, "PING", 4, buf, &len, in wpa_cli_action_ping()
4947 len < 4 || os_memcmp(buf, "PONG", 4) != 0) { in wpa_cli_action_ping()
4948 printf("wpa_supplicant did not reply to PING command - exiting\n"); in wpa_cli_action_ping()
5026 if (dent->d_type != DT_SOCK && dent->d_type != DT_UNKNOWN) in wpa_cli_get_default_ifname()
5031 if (os_strcmp(dent->d_name, ".") == 0 || in wpa_cli_get_default_ifname()
5032 os_strcmp(dent->d_name, "..") == 0 || in wpa_cli_get_default_ifname()
5033 os_strncmp(dent->d_name, "p2p-dev-", 8) == 0) in wpa_cli_get_default_ifname()
5035 printf("Selected interface '%s'\n", dent->d_name); in wpa_cli_get_default_ifname()
5036 ifname = os_strdup(dent->d_name); in wpa_cli_get_default_ifname()
5052 len = sizeof(buf) - 1; in wpa_cli_get_default_ifname()
5076 return -1; in main()
5119 return -1; in main()
5129 return -1; in main()
5132 return -1; in main()
5159 fprintf(stderr, "Failed to connect to non-global " in main()
5163 return -1; in main()
5172 return -1; in main()
5177 return -1; in main()
5182 ret = wpa_request(ctrl_conn, argc - optind, in main()
5196 printf("CONFIG_CTRL_IFACE not defined - wpa_cli disabled\n"); in main()
5197 return -1; in main()