aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/wlantest.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2011-01-28 11:33:21 (GMT)
committerJouni Malinen <j@w1.fi>2011-01-28 11:33:21 (GMT)
commit9a994178f19a3632c7a12b892c508e323de18cdb (patch)
treeae600e295e837e25d502445461f1bdd3531cdf8f /wlantest/wlantest.c
parentdfaeda049203eea631f0a916f49fadf08cd5cd6f (diff)
downloadhostap-9a994178f19a3632c7a12b892c508e323de18cdb.zip
hostap-9a994178f19a3632c7a12b892c508e323de18cdb.tar.gz
hostap-9a994178f19a3632c7a12b892c508e323de18cdb.tar.bz2
wlantest: Add command for adding WEP keys during run time
Diffstat (limited to 'wlantest/wlantest.c')
-rw-r--r--wlantest/wlantest.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/wlantest/wlantest.c b/wlantest/wlantest.c
index 17b3dd3..040cda1 100644
--- a/wlantest/wlantest.c
+++ b/wlantest/wlantest.c
@@ -136,25 +136,26 @@ static void add_secret(struct wlantest *wt, const char *secret)
}
-static void add_wep(struct wlantest *wt, const char *key)
+int add_wep(struct wlantest *wt, const char *key)
{
struct wlantest_wep *w;
size_t len = os_strlen(key);
if (len != 2 * 5 && len != 2 * 13) {
wpa_printf(MSG_INFO, "Invalid WEP key '%s'", key);
- return;
+ return -1;
}
w = os_zalloc(sizeof(*w));
if (w == NULL)
- return;
+ return -1;
if (hexstr2bin(key, w->key, len / 2) < 0) {
os_free(w);
wpa_printf(MSG_INFO, "Invalid WEP key '%s'", key);
- return;
+ return -1;
}
w->key_len = len / 2;
dl_list_add(&wt->wep, &w->list);
+ return 0;
}
@@ -217,7 +218,8 @@ int main(int argc, char *argv[])
write_file = optarg;
break;
case 'W':
- add_wep(&wt, optarg);
+ if (add_wep(&wt, optarg) < 0)
+ return -1;
break;
default:
usage();