WNM: Add option to disable keep-alive frames for testing purposes

"wpa_cli set no_keep_alive 1/0" can now be used to disable/enable
keep alive frames to enable testing.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2012-12-18 16:57:52 +02:00
parent 41014724e2
commit 2ec535fd37
3 changed files with 14 additions and 6 deletions

View file

@ -415,6 +415,8 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
ret = set_bssid_filter(wpa_s, value); ret = set_bssid_filter(wpa_s, value);
} else if (os_strcasecmp(cmd, "disallow_aps") == 0) { } else if (os_strcasecmp(cmd, "disallow_aps") == 0) {
ret = set_disallow_aps(wpa_s, value); ret = set_disallow_aps(wpa_s, value);
} else if (os_strcasecmp(cmd, "no_keep_alive") == 0) {
wpa_s->no_keep_alive = !!atoi(value);
} else { } else {
value[-1] = '='; value[-1] = '=';
ret = wpa_config_process_global(wpa_s->conf, cmd, -1); ret = wpa_config_process_global(wpa_s->conf, cmd, -1);

View file

@ -1316,12 +1316,16 @@ static void wnm_bss_keep_alive(void *eloop_ctx, void *sock_ctx)
if (wpa_s->wpa_state < WPA_ASSOCIATED) if (wpa_s->wpa_state < WPA_ASSOCIATED)
return; return;
if (!wpa_s->no_keep_alive) {
wpa_printf(MSG_DEBUG, "WNM: Send keep-alive to AP " MACSTR, wpa_printf(MSG_DEBUG, "WNM: Send keep-alive to AP " MACSTR,
MAC2STR(wpa_s->bssid)); MAC2STR(wpa_s->bssid));
/* TODO: could skip this if normal data traffic has been sent */ /* TODO: could skip this if normal data traffic has been sent */
/* TODO: Consider using some more appropriate data frame for this */ /* TODO: Consider using some more appropriate data frame for
* this */
if (wpa_s->l2) if (wpa_s->l2)
l2_packet_send(wpa_s->l2, wpa_s->bssid, 0x0800, (u8 *) "", 0); l2_packet_send(wpa_s->l2, wpa_s->bssid, 0x0800,
(u8 *) "", 0);
}
#ifdef CONFIG_SME #ifdef CONFIG_SME
if (wpa_s->sme.bss_max_idle_period) { if (wpa_s->sme.bss_max_idle_period) {

View file

@ -668,6 +668,8 @@ struct wpa_supplicant {
struct wpabuf *last_gas_resp; struct wpabuf *last_gas_resp;
u8 last_gas_addr[ETH_ALEN]; u8 last_gas_addr[ETH_ALEN];
u8 last_gas_dialog_token; u8 last_gas_dialog_token;
unsigned int no_keep_alive:1;
}; };