aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpa_cli.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2014-04-29 20:41:47 (GMT)
committerJouni Malinen <j@w1.fi>2014-05-12 16:43:56 (GMT)
commit1c330a2fdc4d79752c844acc2945de233e5d323c (patch)
tree4a182fa26c0c84e5d1019872d8242ffcba116062 /wpa_supplicant/wpa_cli.c
parent316f92cd332668b884da11f909396bcc4effdd92 (diff)
downloadhostap-1c330a2fdc4d79752c844acc2945de233e5d323c.zip
hostap-1c330a2fdc4d79752c844acc2945de233e5d323c.tar.gz
hostap-1c330a2fdc4d79752c844acc2945de233e5d323c.tar.bz2
Add 'dup_network <id_s> <id_d> <name>' command
This command allows to copy network variable from one network to another, e.g., to clone the psk field without having to extract it from wpa_supplicant. Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'wpa_supplicant/wpa_cli.c')
-rw-r--r--wpa_supplicant/wpa_cli.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 77c5295..b3812ca 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -1416,6 +1416,24 @@ static int wpa_cli_cmd_get_network(struct wpa_ctrl *ctrl, int argc,
}
+static int wpa_cli_cmd_dup_network(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ if (argc == 0) {
+ wpa_cli_show_network_variables();
+ return 0;
+ }
+
+ if (argc < 3) {
+ printf("Invalid DUP_NETWORK command: needs three arguments\n"
+ "(src netid, dest netid, and variable name)\n");
+ return -1;
+ }
+
+ return wpa_cli_cmd(ctrl, "DUP_NETWORK", 3, argc, argv);
+}
+
+
static int wpa_cli_cmd_list_creds(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@@ -2570,6 +2588,10 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
{ "get_network", wpa_cli_cmd_get_network, NULL,
cli_cmd_flag_none,
"<network id> <variable> = get network variables" },
+ { "dup_network", wpa_cli_cmd_dup_network, NULL,
+ cli_cmd_flag_none,
+ "<src network id> <dst network id> <variable> = duplicate network variables"
+ },
{ "list_creds", wpa_cli_cmd_list_creds, NULL,
cli_cmd_flag_none,
"= list configured credentials" },