aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/wlantest_cli.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-03-29 17:12:35 (GMT)
committerJouni Malinen <j@w1.fi>2013-03-29 17:12:35 (GMT)
commit8cb9bc19fb172cdea1a21fd4b21eb7b4f9d5f54f (patch)
treef1874e560377cbb0ca3944066e5a24862b2788f9 /wlantest/wlantest_cli.c
parente492837b67e601a030cdcbcc3b6e87f838d16670 (diff)
downloadhostap-8cb9bc19fb172cdea1a21fd4b21eb7b4f9d5f54f.zip
hostap-8cb9bc19fb172cdea1a21fd4b21eb7b4f9d5f54f.tar.gz
hostap-8cb9bc19fb172cdea1a21fd4b21eb7b4f9d5f54f.tar.bz2
wlantest: Add wlantest_cli command add_wep
This can be used to configure a known WEP key for decrypting WEP frames. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wlantest/wlantest_cli.c')
-rw-r--r--wlantest/wlantest_cli.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/wlantest/wlantest_cli.c b/wlantest/wlantest_cli.c
index 9ce4545..e932be1 100644
--- a/wlantest/wlantest_cli.c
+++ b/wlantest/wlantest_cli.c
@@ -1,6 +1,6 @@
/*
* wlantest controller
- * Copyright (c) 2010, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2010-2013, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -1209,6 +1209,32 @@ static int cmd_add_passphrase(int s, int argc, char *argv[])
}
+static int cmd_add_wepkey(int s, int argc, char *argv[])
+{
+ u8 resp[WLANTEST_CTRL_MAX_RESP_LEN];
+ u8 buf[100], *pos, *end;
+ size_t len;
+ int rlen;
+
+ if (argc < 1) {
+ printf("add_wepkey needs one argument: WEP key\n");
+ return -1;
+ }
+
+ len = os_strlen(argv[0]);
+ pos = buf;
+ end = buf + sizeof(buf);
+ WPA_PUT_BE32(pos, WLANTEST_CTRL_ADD_PASSPHRASE);
+ pos += 4;
+ pos = attr_add_str(pos, end, WLANTEST_ATTR_WEPKEY, argv[0]);
+
+ rlen = cmd_send_and_recv(s, buf, pos - buf, resp, sizeof(resp));
+ if (rlen < 0)
+ return -1;
+ return 0;
+}
+
+
struct sta_infos {
const char *name;
enum wlantest_sta_info num;
@@ -1455,6 +1481,8 @@ static const struct wlantest_cli_cmd wlantest_cli_commands[] = {
{ "version", cmd_version, "= get wlantest version", NULL },
{ "add_passphrase", cmd_add_passphrase,
"<passphrase> = add a known passphrase", NULL },
+ { "add_wepkey", cmd_add_wepkey,
+ "<WEP key> = add a known WEP key", NULL },
{ "info_sta", cmd_info_sta,
"<field> <BSSID> <STA> = get STA information",
complete_info_sta },