wlantest: Add flush command for dropping all BSS data
This commit is contained in:
parent
6f2346c144
commit
d356bd630b
6 changed files with 29 additions and 3 deletions
|
@ -252,3 +252,11 @@ void bss_update(struct wlantest *wt, struct wlantest_bss *bss,
|
||||||
bss->rsn_capab & WPA_CAPABILITY_PEERKEY_ENABLED ?
|
bss->rsn_capab & WPA_CAPABILITY_PEERKEY_ENABLED ?
|
||||||
"PEERKEY " : "");
|
"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);
|
||||||
|
}
|
||||||
|
|
|
@ -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)
|
static void ctrl_read(int sock, void *eloop_ctx, void *sock_ctx)
|
||||||
{
|
{
|
||||||
struct wlantest *wt = eloop_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:
|
case WLANTEST_CTRL_LIST_STA:
|
||||||
ctrl_list_sta(wt, sock, buf + 4, len - 4);
|
ctrl_list_sta(wt, sock, buf + 4, len - 4);
|
||||||
break;
|
break;
|
||||||
|
case WLANTEST_CTRL_FLUSH:
|
||||||
|
ctrl_flush(wt, sock);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ctrl_send_simple(wt, sock, WLANTEST_CTRL_UNKNOWN_CMD);
|
ctrl_send_simple(wt, sock, WLANTEST_CTRL_UNKNOWN_CMD);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -78,7 +78,6 @@ void radius_deinit(struct wlantest_radius *r)
|
||||||
|
|
||||||
static void wlantest_deinit(struct wlantest *wt)
|
static void wlantest_deinit(struct wlantest *wt)
|
||||||
{
|
{
|
||||||
struct wlantest_bss *bss, *n;
|
|
||||||
struct wlantest_passphrase *p, *pn;
|
struct wlantest_passphrase *p, *pn;
|
||||||
struct wlantest_radius_secret *s, *sn;
|
struct wlantest_radius_secret *s, *sn;
|
||||||
struct wlantest_radius *r, *rn;
|
struct wlantest_radius *r, *rn;
|
||||||
|
@ -88,8 +87,7 @@ static void wlantest_deinit(struct wlantest *wt)
|
||||||
ctrl_deinit(wt);
|
ctrl_deinit(wt);
|
||||||
if (wt->monitor_sock >= 0)
|
if (wt->monitor_sock >= 0)
|
||||||
monitor_deinit(wt);
|
monitor_deinit(wt);
|
||||||
dl_list_for_each_safe(bss, n, &wt->bss, struct wlantest_bss, list)
|
bss_flush(wt);
|
||||||
bss_deinit(bss);
|
|
||||||
dl_list_for_each_safe(p, pn, &wt->passphrase,
|
dl_list_for_each_safe(p, pn, &wt->passphrase,
|
||||||
struct wlantest_passphrase, list)
|
struct wlantest_passphrase, list)
|
||||||
passphrase_deinit(p);
|
passphrase_deinit(p);
|
||||||
|
|
|
@ -148,6 +148,7 @@ struct wlantest_bss * bss_get(struct wlantest *wt, const u8 *bssid);
|
||||||
void bss_deinit(struct wlantest_bss *bss);
|
void bss_deinit(struct wlantest_bss *bss);
|
||||||
void bss_update(struct wlantest *wt, struct wlantest_bss *bss,
|
void bss_update(struct wlantest *wt, struct wlantest_bss *bss,
|
||||||
struct ieee802_11_elems *elems);
|
struct ieee802_11_elems *elems);
|
||||||
|
void bss_flush(struct wlantest *wt);
|
||||||
void pmk_deinit(struct wlantest_pmk *pmk);
|
void pmk_deinit(struct wlantest_pmk *pmk);
|
||||||
|
|
||||||
struct wlantest_sta * sta_get(struct wlantest_bss *bss, const u8 *addr);
|
struct wlantest_sta * sta_get(struct wlantest_bss *bss, const u8 *addr);
|
||||||
|
|
|
@ -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 {
|
struct wlantest_cli_cmd {
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
int (*handler)(int s, int argc, char *argv[]);
|
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" },
|
{ "terminate", cmd_terminate, "= terminate wlantest" },
|
||||||
{ "list_bss", cmd_list_bss, "= get BSS list" },
|
{ "list_bss", cmd_list_bss, "= get BSS list" },
|
||||||
{ "list_sta", cmd_list_sta, "<BSSID> = get STA list" },
|
{ "list_sta", cmd_list_sta, "<BSSID> = get STA list" },
|
||||||
|
{ "flush", cmd_flush, "= drop all collected BSS data" },
|
||||||
{ NULL, NULL, NULL }
|
{ NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ enum wlantest_ctrl_cmd {
|
||||||
WLANTEST_CTRL_TERMINATE,
|
WLANTEST_CTRL_TERMINATE,
|
||||||
WLANTEST_CTRL_LIST_BSS,
|
WLANTEST_CTRL_LIST_BSS,
|
||||||
WLANTEST_CTRL_LIST_STA,
|
WLANTEST_CTRL_LIST_STA,
|
||||||
|
WLANTEST_CTRL_FLUSH,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum wlantest_ctrl_attr {
|
enum wlantest_ctrl_attr {
|
||||||
|
|
Loading…
Reference in a new issue