Lines Matching refs:cmd
201 static int _wpa_ctrl_command(struct wpa_ctrl *ctrl, char *cmd, int print) in _wpa_ctrl_command() argument
212 ret = wpa_ctrl_request(ctrl, cmd, os_strlen(cmd), buf, &len, in _wpa_ctrl_command()
215 printf("'%s' command timed out.\n", cmd); in _wpa_ctrl_command()
218 printf("'%s' command failed.\n", cmd); in _wpa_ctrl_command()
229 static int wpa_ctrl_command(struct wpa_ctrl *ctrl, char *cmd) in wpa_ctrl_command() argument
231 return _wpa_ctrl_command(ctrl, cmd, 1); in wpa_ctrl_command()
303 char cmd[256]; in wpa_cli_cmd_set() local
317 res = os_snprintf(cmd, sizeof(cmd), "SET %s %s", argv[0], argv[1]); in wpa_cli_cmd_set()
318 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_set()
322 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_set()
348 char cmd[256]; in wpa_cli_cmd_preauthenticate() local
357 res = os_snprintf(cmd, sizeof(cmd), "PREAUTH %s", argv[0]); in wpa_cli_cmd_preauthenticate()
358 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_preauthenticate()
362 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_preauthenticate()
368 char cmd[256]; in wpa_cli_cmd_ap_scan() local
376 res = os_snprintf(cmd, sizeof(cmd), "AP_SCAN %s", argv[0]); in wpa_cli_cmd_ap_scan()
377 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_ap_scan()
381 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_ap_scan()
388 char cmd[256]; in wpa_cli_cmd_stkstart() local
397 res = os_snprintf(cmd, sizeof(cmd), "STKSTART %s", argv[0]); in wpa_cli_cmd_stkstart()
398 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_stkstart()
402 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_stkstart()
408 char cmd[256]; in wpa_cli_cmd_ft_ds() local
417 res = os_snprintf(cmd, sizeof(cmd), "FT_DS %s", argv[0]); in wpa_cli_cmd_ft_ds()
418 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_ft_ds()
422 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_ft_ds()
428 char cmd[256]; in wpa_cli_cmd_wps_pbc() local
437 res = os_snprintf(cmd, sizeof(cmd), "WPS_PBC %s", argv[0]); in wpa_cli_cmd_wps_pbc()
438 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_wps_pbc()
442 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_wps_pbc()
448 char cmd[256]; in wpa_cli_cmd_wps_pin() local
461 res = os_snprintf(cmd, sizeof(cmd), "WPS_PIN %s", argv[0]); in wpa_cli_cmd_wps_pin()
462 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_wps_pin()
466 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_wps_pin()
470 res = os_snprintf(cmd, sizeof(cmd), "WPS_PIN %s %s", argv[0], argv[1]); in wpa_cli_cmd_wps_pin()
471 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_wps_pin()
475 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_wps_pin()
481 char cmd[256]; in wpa_cli_cmd_wps_reg() local
491 res = os_snprintf(cmd, sizeof(cmd), "WPS_REG %s %s", argv[0], argv[1]); in wpa_cli_cmd_wps_reg()
492 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_wps_reg()
496 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_wps_reg()
502 char cmd[256]; in wpa_cli_cmd_level() local
510 res = os_snprintf(cmd, sizeof(cmd), "LEVEL %s", argv[0]); in wpa_cli_cmd_level()
511 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_level()
515 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_level()
521 char cmd[256], *pos, *end; in wpa_cli_cmd_identity() local
530 end = cmd + sizeof(cmd); in wpa_cli_cmd_identity()
531 pos = cmd; in wpa_cli_cmd_identity()
548 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_identity()
554 char cmd[256], *pos, *end; in wpa_cli_cmd_password() local
563 end = cmd + sizeof(cmd); in wpa_cli_cmd_password()
564 pos = cmd; in wpa_cli_cmd_password()
581 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_password()
588 char cmd[256], *pos, *end; in wpa_cli_cmd_new_password() local
597 end = cmd + sizeof(cmd); in wpa_cli_cmd_new_password()
598 pos = cmd; in wpa_cli_cmd_new_password()
615 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_new_password()
621 char cmd[256], *pos, *end; in wpa_cli_cmd_pin() local
630 end = cmd + sizeof(cmd); in wpa_cli_cmd_pin()
631 pos = cmd; in wpa_cli_cmd_pin()
647 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_pin()
653 char cmd[256], *pos, *end; in wpa_cli_cmd_otp() local
662 end = cmd + sizeof(cmd); in wpa_cli_cmd_otp()
663 pos = cmd; in wpa_cli_cmd_otp()
680 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_otp()
687 char cmd[256], *pos, *end; in wpa_cli_cmd_passphrase() local
696 end = cmd + sizeof(cmd); in wpa_cli_cmd_passphrase()
697 pos = cmd; in wpa_cli_cmd_passphrase()
714 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_passphrase()
720 char cmd[256], *pos, *end; in wpa_cli_cmd_bssid() local
729 end = cmd + sizeof(cmd); in wpa_cli_cmd_bssid()
730 pos = cmd; in wpa_cli_cmd_bssid()
746 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_bssid()
754 char cmd[256]; in wpa_cli_cmd_scan_interval() local
762 res = os_snprintf(cmd, sizeof(cmd), "SCAN_INTERVAL %s", argv[0]); in wpa_cli_cmd_scan_interval()
763 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_scan_interval()
767 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_scan_interval()
773 char cmd[256], *pos, *end; in wpa_cli_cmd_blacklist() local
776 end = cmd + sizeof(cmd); in wpa_cli_cmd_blacklist()
777 pos = cmd; in wpa_cli_cmd_blacklist()
793 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_blacklist()
799 char cmd[256], *pos, *end; in wpa_cli_cmd_log_level() local
802 end = cmd + sizeof(cmd); in wpa_cli_cmd_log_level()
803 pos = cmd; in wpa_cli_cmd_log_level()
819 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_log_level()
834 char cmd[32]; in wpa_cli_cmd_select_network() local
843 res = os_snprintf(cmd, sizeof(cmd), "SELECT_NETWORK %s", argv[0]); in wpa_cli_cmd_select_network()
844 if (res < 0 || (size_t) res >= sizeof(cmd)) in wpa_cli_cmd_select_network()
846 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_select_network()
848 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_select_network()
855 char cmd[32]; in wpa_cli_cmd_enable_network() local
864 res = os_snprintf(cmd, sizeof(cmd), "ENABLE_NETWORK %s", argv[0]); in wpa_cli_cmd_enable_network()
865 if (res < 0 || (size_t) res >= sizeof(cmd)) in wpa_cli_cmd_enable_network()
867 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_enable_network()
869 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_enable_network()
876 char cmd[32]; in wpa_cli_cmd_disable_network() local
885 res = os_snprintf(cmd, sizeof(cmd), "DISABLE_NETWORK %s", argv[0]); in wpa_cli_cmd_disable_network()
886 if (res < 0 || (size_t) res >= sizeof(cmd)) in wpa_cli_cmd_disable_network()
888 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_disable_network()
890 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_disable_network()
904 char cmd[32]; in wpa_cli_cmd_remove_network() local
913 res = os_snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %s", argv[0]); in wpa_cli_cmd_remove_network()
914 if (res < 0 || (size_t) res >= sizeof(cmd)) in wpa_cli_cmd_remove_network()
916 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_remove_network()
918 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_remove_network()
946 char cmd[256]; in wpa_cli_cmd_set_network() local
960 res = os_snprintf(cmd, sizeof(cmd), "SET_NETWORK %s %s %s", in wpa_cli_cmd_set_network()
962 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_set_network()
966 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_set_network()
973 char cmd[256]; in wpa_cli_cmd_get_network() local
987 res = os_snprintf(cmd, sizeof(cmd), "GET_NETWORK %s %s", in wpa_cli_cmd_get_network()
989 if (res < 0 || (size_t) res >= sizeof(cmd) - 1) { in wpa_cli_cmd_get_network()
993 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_get_network()
1033 char cmd[64]; in wpa_cli_cmd_bss() local
1042 res = os_snprintf(cmd, sizeof(cmd), "BSS %s", argv[0]); in wpa_cli_cmd_bss()
1043 if (res < 0 || (size_t) res >= sizeof(cmd)) in wpa_cli_cmd_bss()
1045 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_bss()
1047 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_bss()
1054 char cmd[64]; in wpa_cli_cmd_get_capability() local
1069 res = os_snprintf(cmd, sizeof(cmd), "GET_CAPABILITY %s%s", argv[0], in wpa_cli_cmd_get_capability()
1071 if (res < 0 || (size_t) res >= sizeof(cmd)) in wpa_cli_cmd_get_capability()
1073 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_get_capability()
1075 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_get_capability()
1130 char cmd[256]; in wpa_cli_cmd_interface_add() local
1145 res = os_snprintf(cmd, sizeof(cmd), in wpa_cli_cmd_interface_add()
1151 if (res < 0 || (size_t) res >= sizeof(cmd)) in wpa_cli_cmd_interface_add()
1153 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_interface_add()
1154 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_interface_add()
1161 char cmd[128]; in wpa_cli_cmd_interface_remove() local
1170 res = os_snprintf(cmd, sizeof(cmd), "INTERFACE_REMOVE %s", argv[0]); in wpa_cli_cmd_interface_remove()
1171 if (res < 0 || (size_t) res >= sizeof(cmd)) in wpa_cli_cmd_interface_remove()
1173 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_interface_remove()
1174 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_interface_remove()
1188 char cmd[32]; in wpa_cli_cmd_driver() local
1196 os_snprintf(cmd, sizeof(cmd), "DRIVER %s %s", argv[0], argv[1]); in wpa_cli_cmd_driver()
1198 os_snprintf(cmd, sizeof(cmd), "DRIVER %s", argv[0]); in wpa_cli_cmd_driver()
1199 cmd[sizeof(cmd) - 1] = '\0'; in wpa_cli_cmd_driver()
1201 return wpa_ctrl_command(ctrl, cmd); in wpa_cli_cmd_driver()
1211 const char *cmd; member
1392 static void print_cmd_help(struct wpa_cli_cmd *cmd, const char *pad) in print_cmd_help() argument
1397 printf("%s%s ", pad, cmd->cmd); in print_cmd_help()
1398 for (n = 0; (c = cmd->usage[n]); n++) { in print_cmd_help()
1411 for (n = 0; wpa_cli_commands[n].cmd; n++) in print_help()
1417 static int cmd_has_sensitive_data(const char *cmd) in cmd_has_sensitive_data() argument
1423 delim = os_strchr(cmd, ' '); in cmd_has_sensitive_data()
1425 len = delim - cmd; in cmd_has_sensitive_data()
1427 len = os_strlen(cmd); in cmd_has_sensitive_data()
1429 for (n = 0; (c = wpa_cli_commands[n].cmd); n++) { in cmd_has_sensitive_data()
1430 if (os_strncasecmp(cmd, c, len) == 0 && len == os_strlen(c)) in cmd_has_sensitive_data()
1441 struct wpa_cli_cmd *cmd, *match = NULL; in wpa_request() local
1446 cmd = wpa_cli_commands; in wpa_request()
1447 while (cmd->cmd) { in wpa_request()
1448 if (os_strncasecmp(cmd->cmd, argv[0], os_strlen(argv[0])) == 0) in wpa_request()
1450 match = cmd; in wpa_request()
1451 if (os_strcasecmp(cmd->cmd, argv[0]) == 0) { in wpa_request()
1458 cmd++; in wpa_request()
1463 cmd = wpa_cli_commands; in wpa_request()
1464 while (cmd->cmd) { in wpa_request()
1465 if (os_strncasecmp(cmd->cmd, argv[0], in wpa_request()
1467 printf(" %s", cmd->cmd); in wpa_request()
1469 cmd++; in wpa_request()
1496 char *cmd; in wpa_cli_exec() local
1502 cmd = os_malloc(len); in wpa_cli_exec()
1503 if (cmd == NULL) in wpa_cli_exec()
1505 res = os_snprintf(cmd, len, "%s %s %s", program, arg1, arg2); in wpa_cli_exec()
1507 os_free(cmd); in wpa_cli_exec()
1510 cmd[len - 1] = '\0'; in wpa_cli_exec()
1512 if (system(cmd) < 0) in wpa_cli_exec()
1515 os_free(cmd); in wpa_cli_exec()
1647 const char *cmd; in wpa_cli_cmd_gen() local
1654 while ((cmd = wpa_cli_commands[i].cmd)) { in wpa_cli_cmd_gen()
1656 if (os_strncasecmp(cmd, text, len) == 0) in wpa_cli_cmd_gen()
1657 return os_strdup(cmd); in wpa_cli_cmd_gen()
1681 char cmdbuf[256], *cmd, *argv[max_args], *pos; in wpa_cli_interactive() local
1715 cmd = readline("> "); in wpa_cli_interactive()
1716 if (cmd && *cmd) { in wpa_cli_interactive()
1721 if (h == NULL || os_strcmp(cmd, h->line) != 0) in wpa_cli_interactive()
1722 add_history(cmd); in wpa_cli_interactive()
1727 cmd = fgets(cmdbuf, sizeof(cmdbuf), stdin); in wpa_cli_interactive()
1732 if (cmd == NULL) in wpa_cli_interactive()
1735 pos = cmd; in wpa_cli_interactive()
1744 pos = cmd; in wpa_cli_interactive()
1767 if (cmd != cmdbuf) in wpa_cli_interactive()
1768 os_free(cmd); in wpa_cli_interactive()