aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2010-11-18 15:36:08 (GMT)
committerJouni Malinen <j@w1.fi>2010-11-18 15:36:08 (GMT)
commitd356bd630b6876866ca70e177a2b9eca13fb1e35 (patch)
treeb70652d7f2843e301b0277ae59fac0cd77f728da /wlantest
parent6f2346c144f8f7ee8973f0db841558e339fb9b15 (diff)
downloadhostap-d356bd630b6876866ca70e177a2b9eca13fb1e35.zip
hostap-d356bd630b6876866ca70e177a2b9eca13fb1e35.tar.gz
hostap-d356bd630b6876866ca70e177a2b9eca13fb1e35.tar.bz2
wlantest: Add flush command for dropping all BSS data
Diffstat (limited to 'wlantest')
-rw-r--r--wlantest/bss.c8
-rw-r--r--wlantest/ctrl.c11
-rw-r--r--wlantest/wlantest.c4
-rw-r--r--wlantest/wlantest.h1
-rw-r--r--wlantest/wlantest_cli.c7
-rw-r--r--wlantest/wlantest_ctrl.h1
6 files changed, 29 insertions, 3 deletions
diff --git a/wlantest/bss.c b/wlantest/bss.c
index a60ae33..20e4f20 100644
--- a/wlantest/bss.c
+++ b/wlantest/bss.c
@@ -252,3 +252,11 @@ void bss_update(struct wlantest *wt, struct wlantest_bss *bss,
bss->rsn_capab & WPA_CAPABILITY_PEERKEY_ENABLED ?
"PEERKEY " : "");
}
+
+
+void bss_flush(struct wlantest *wt)
+{
+ struct wlantest_bss *bss, *n;
+ dl_list_for_each_safe(bss, n, &wt->bss, struct wlantest_bss, list)
+ bss_deinit(bss);
+}
diff --git a/wlantest/ctrl.c b/wlantest/ctrl.c
index 3f88029..f2526eb 100644
--- a/wlantest/ctrl.c
+++ b/wlantest/ctrl.c
@@ -149,6 +149,14 @@ static void ctrl_list_sta(struct wlantest *wt, int sock, u8 *cmd, size_t clen)
}
+static void ctrl_flush(struct wlantest *wt, int sock)
+{
+ wpa_printf(MSG_DEBUG, "Drop all collected BSS data");
+ bss_flush(wt);
+ ctrl_send_simple(wt, sock, WLANTEST_CTRL_SUCCESS);
+}
+
+
static void ctrl_read(int sock, void *eloop_ctx, void *sock_ctx)
{
struct wlantest *wt = eloop_ctx;
@@ -193,6 +201,9 @@ static void ctrl_read(int sock, void *eloop_ctx, void *sock_ctx)
case WLANTEST_CTRL_LIST_STA:
ctrl_list_sta(wt, sock, buf + 4, len - 4);
break;
+ case WLANTEST_CTRL_FLUSH:
+ ctrl_flush(wt, sock);
+ break;
default:
ctrl_send_simple(wt, sock, WLANTEST_CTRL_UNKNOWN_CMD);
break;
diff --git a/wlantest/wlantest.c b/wlantest/wlantest.c
index d43379f..a98513a 100644
--- a/wlantest/wlantest.c
+++ b/wlantest/wlantest.c
@@ -78,7 +78,6 @@ void radius_deinit(struct wlantest_radius *r)
static void wlantest_deinit(struct wlantest *wt)
{
- struct wlantest_bss *bss, *n;
struct wlantest_passphrase *p, *pn;
struct wlantest_radius_secret *s, *sn;
struct wlantest_radius *r, *rn;
@@ -88,8 +87,7 @@ static void wlantest_deinit(struct wlantest *wt)
ctrl_deinit(wt);
if (wt->monitor_sock >= 0)
monitor_deinit(wt);
- dl_list_for_each_safe(bss, n, &wt->bss, struct wlantest_bss, list)
- bss_deinit(bss);
+ bss_flush(wt);
dl_list_for_each_safe(p, pn, &wt->passphrase,
struct wlantest_passphrase, list)
passphrase_deinit(p);
diff --git a/wlantest/wlantest.h b/wlantest/wlantest.h
index aed4fb8..18c1ddd 100644
--- a/wlantest/wlantest.h
+++ b/wlantest/wlantest.h
@@ -148,6 +148,7 @@ struct wlantest_bss * bss_get(struct wlantest *wt, const u8 *bssid);
void bss_deinit(struct wlantest_bss *bss);
void bss_update(struct wlantest *wt, struct wlantest_bss *bss,
struct ieee802_11_elems *elems);
+void bss_flush(struct wlantest *wt);
void pmk_deinit(struct wlantest_pmk *pmk);
struct wlantest_sta * sta_get(struct wlantest_bss *bss, const u8 *addr);
diff --git a/wlantest/wlantest_cli.c b/wlantest/wlantest_cli.c
index 7ba5ff1..ee8d0cc 100644
--- a/wlantest/wlantest_cli.c
+++ b/wlantest/wlantest_cli.c
@@ -163,6 +163,12 @@ static int cmd_list_sta(int s, int argc, char *argv[])
}
+static int cmd_flush(int s, int argc, char *argv[])
+{
+ return cmd_simple(s, WLANTEST_CTRL_FLUSH);
+}
+
+
struct wlantest_cli_cmd {
const char *cmd;
int (*handler)(int s, int argc, char *argv[]);
@@ -174,6 +180,7 @@ static const struct wlantest_cli_cmd wlantest_cli_commands[] = {
{ "terminate", cmd_terminate, "= terminate wlantest" },
{ "list_bss", cmd_list_bss, "= get BSS list" },
{ "list_sta", cmd_list_sta, "<BSSID> = get STA list" },
+ { "flush", cmd_flush, "= drop all collected BSS data" },
{ NULL, NULL, NULL }
};
diff --git a/wlantest/wlantest_ctrl.h b/wlantest/wlantest_ctrl.h
index 85db87e..3e7d6ca 100644
--- a/wlantest/wlantest_ctrl.h
+++ b/wlantest/wlantest_ctrl.h
@@ -28,6 +28,7 @@ enum wlantest_ctrl_cmd {
WLANTEST_CTRL_TERMINATE,
WLANTEST_CTRL_LIST_BSS,
WLANTEST_CTRL_LIST_STA,
+ WLANTEST_CTRL_FLUSH,
};
enum wlantest_ctrl_attr {