WNM: Add ctrl_iface command for sending WNM-Sleep Mode Request
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
2dfb9a447c
commit
e9199e3149
4 changed files with 48 additions and 3 deletions
|
@ -38,6 +38,7 @@
|
|||
#include "interworking.h"
|
||||
#include "blacklist.h"
|
||||
#include "autoscan.h"
|
||||
#include "wnm_sta.h"
|
||||
|
||||
extern struct wpa_driver_ops *wpa_drivers[];
|
||||
|
||||
|
@ -4671,6 +4672,31 @@ static int wpa_supplicant_ctrl_iface_autoscan(struct wpa_supplicant *wpa_s,
|
|||
#endif /* CONFIG_AUTOSCAN */
|
||||
|
||||
|
||||
#ifdef CONFIG_WNM
|
||||
|
||||
static int wpas_ctrl_iface_wnm_sleep(struct wpa_supplicant *wpa_s, char *cmd)
|
||||
{
|
||||
int enter;
|
||||
int intval = 0;
|
||||
char *pos;
|
||||
|
||||
if (os_strncmp(cmd, "enter", 5) == 0)
|
||||
enter = 1;
|
||||
else if (os_strncmp(cmd, "exit", 4) == 0)
|
||||
enter = 0;
|
||||
else
|
||||
return -1;
|
||||
|
||||
pos = os_strstr(cmd, " interval=");
|
||||
if (pos)
|
||||
intval = atoi(pos + 10);
|
||||
|
||||
return ieee802_11_send_wnmsleep_req(wpa_s, enter ? 0 : 1, intval);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_WNM */
|
||||
|
||||
|
||||
static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf,
|
||||
size_t buflen)
|
||||
{
|
||||
|
@ -5221,6 +5247,11 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
|
|||
} else if (os_strcmp(buf, "REAUTHENTICATE") == 0) {
|
||||
pmksa_cache_clear_current(wpa_s->wpa);
|
||||
eapol_sm_request_reauth(wpa_s->eapol);
|
||||
#ifdef CONFIG_WNM
|
||||
} else if (os_strncmp(buf, "WNM_SLEEP ", 10) == 0) {
|
||||
if (wpas_ctrl_iface_wnm_sleep(wpa_s, buf + 10))
|
||||
reply_len = -1;
|
||||
#endif /* CONFIG_WNM */
|
||||
} else {
|
||||
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
|
||||
reply_len = 16;
|
||||
|
|
|
@ -41,7 +41,7 @@ static int ieee80211_11_set_tfs_ie(struct wpa_supplicant *wpa_s,
|
|||
|
||||
/* MLME-SLEEPMODE.request */
|
||||
int ieee802_11_send_wnmsleep_req(struct wpa_supplicant *wpa_s,
|
||||
u8 action, u8 intval)
|
||||
u8 action, u16 intval)
|
||||
{
|
||||
struct ieee80211_mgmt *mgmt;
|
||||
int res;
|
||||
|
@ -62,7 +62,7 @@ int ieee802_11_send_wnmsleep_req(struct wpa_supplicant *wpa_s,
|
|||
wnmsleep_ie->len = wnmsleep_ie_len - 2;
|
||||
wnmsleep_ie->action_type = action;
|
||||
wnmsleep_ie->status = WNM_STATUS_SLEEP_ACCEPT;
|
||||
wnmsleep_ie->intval = intval;
|
||||
wnmsleep_ie->intval = host_to_le16(intval);
|
||||
|
||||
/* TFS IE(s) */
|
||||
wnmtfs_ie = os_zalloc(MAX_TFS_IE_LEN);
|
||||
|
|
|
@ -13,7 +13,7 @@ struct rx_action;
|
|||
struct wpa_supplicant;
|
||||
|
||||
int ieee802_11_send_wnmsleep_req(struct wpa_supplicant *wpa_s,
|
||||
u8 action, u8 intval);
|
||||
u8 action, u16 intval);
|
||||
|
||||
void ieee802_11_rx_wnm_action(struct wpa_supplicant *wpa_s,
|
||||
struct rx_action *action);
|
||||
|
|
|
@ -2247,6 +2247,16 @@ static int wpa_cli_cmd_autoscan(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
|||
#endif /* CONFIG_AUTOSCAN */
|
||||
|
||||
|
||||
#ifdef CONFIG_WNM
|
||||
|
||||
static int wpa_cli_cmd_wnm_sleep(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
||||
{
|
||||
return wpa_cli_cmd(ctrl, "WNM_SLEEP", 0, argc, argv);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_WNM */
|
||||
|
||||
|
||||
static int wpa_cli_cmd_raw(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
||||
{
|
||||
if (argc == 0)
|
||||
|
@ -2689,6 +2699,10 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
|
|||
{ "autoscan", wpa_cli_cmd_autoscan, NULL, cli_cmd_flag_none,
|
||||
"[params] = Set or unset (if none) autoscan parameters" },
|
||||
#endif /* CONFIG_AUTOSCAN */
|
||||
#ifdef CONFIG_WNM
|
||||
{ "wnm_sleep", wpa_cli_cmd_wnm_sleep, NULL, cli_cmd_flag_none,
|
||||
"<enter/exit> [interval=#] = enter/exit WNM-Sleep mode" },
|
||||
#endif /* CONFIG_WNM */
|
||||
{ "raw", wpa_cli_cmd_raw, NULL, cli_cmd_flag_sensitive,
|
||||
"<params..> = Sent unprocessed command" },
|
||||
{ NULL, NULL, NULL, cli_cmd_flag_none, NULL }
|
||||
|
|
Loading…
Reference in a new issue