mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
WNM: Add sending of BSS Transition Management Query
The new control interface command can be used to send a BSS Transition Management Query frame to the current AP. Signed-hostap: Vinayak Kamath <vkamat@codeaurora.org>
This commit is contained in:
parent
e27d20bb68
commit
65bcd0a92d
@ -549,6 +549,14 @@ struct ieee80211_mgmt {
|
|||||||
* Entries (optional) */
|
* Entries (optional) */
|
||||||
u8 variable[0];
|
u8 variable[0];
|
||||||
} STRUCT_PACKED bss_tm_resp;
|
} STRUCT_PACKED bss_tm_resp;
|
||||||
|
struct {
|
||||||
|
u8 action; /* 6 */
|
||||||
|
u8 dialog_token;
|
||||||
|
u8 query_reason;
|
||||||
|
/* BSS Transition Candidate List
|
||||||
|
* Entries (optional) */
|
||||||
|
u8 variable[0];
|
||||||
|
} STRUCT_PACKED bss_tm_query;
|
||||||
} u;
|
} u;
|
||||||
} STRUCT_PACKED action;
|
} STRUCT_PACKED action;
|
||||||
} u;
|
} u;
|
||||||
|
@ -4975,6 +4975,19 @@ static int wpas_ctrl_iface_wnm_sleep(struct wpa_supplicant *wpa_s, char *cmd)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int wpas_ctrl_iface_wnm_bss_query(struct wpa_supplicant *wpa_s, char *cmd)
|
||||||
|
{
|
||||||
|
int query_reason;
|
||||||
|
|
||||||
|
query_reason = atoi(cmd);
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "CTRL_IFACE: WNM_BSS_QUERY query_reason=%d",
|
||||||
|
query_reason);
|
||||||
|
|
||||||
|
return wnm_send_bss_transition_mgmt_query(wpa_s, query_reason);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_WNM */
|
#endif /* CONFIG_WNM */
|
||||||
|
|
||||||
|
|
||||||
@ -5589,6 +5602,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
|
|||||||
} else if (os_strncmp(buf, "WNM_SLEEP ", 10) == 0) {
|
} else if (os_strncmp(buf, "WNM_SLEEP ", 10) == 0) {
|
||||||
if (wpas_ctrl_iface_wnm_sleep(wpa_s, buf + 10))
|
if (wpas_ctrl_iface_wnm_sleep(wpa_s, buf + 10))
|
||||||
reply_len = -1;
|
reply_len = -1;
|
||||||
|
} else if (os_strncmp(buf, "WNM_BSS_QUERY ", 10) == 0) {
|
||||||
|
if (wpas_ctrl_iface_wnm_bss_query(wpa_s, buf + 10))
|
||||||
|
reply_len = -1;
|
||||||
#endif /* CONFIG_WNM */
|
#endif /* CONFIG_WNM */
|
||||||
} else if (os_strcmp(buf, "FLUSH") == 0) {
|
} else if (os_strcmp(buf, "FLUSH") == 0) {
|
||||||
wpa_supplicant_ctrl_iface_flush(wpa_s);
|
wpa_supplicant_ctrl_iface_flush(wpa_s);
|
||||||
|
@ -681,6 +681,41 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int wnm_send_bss_transition_mgmt_query(struct wpa_supplicant *wpa_s,
|
||||||
|
u8 query_reason)
|
||||||
|
{
|
||||||
|
u8 buf[1000], *pos;
|
||||||
|
struct ieee80211_mgmt *mgmt;
|
||||||
|
size_t len;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Query to "
|
||||||
|
MACSTR " query_reason=%u",
|
||||||
|
MAC2STR(wpa_s->bssid), query_reason);
|
||||||
|
|
||||||
|
mgmt = (struct ieee80211_mgmt *) buf;
|
||||||
|
os_memset(&buf, 0, sizeof(buf));
|
||||||
|
os_memcpy(mgmt->da, wpa_s->bssid, ETH_ALEN);
|
||||||
|
os_memcpy(mgmt->sa, wpa_s->own_addr, ETH_ALEN);
|
||||||
|
os_memcpy(mgmt->bssid, wpa_s->bssid, ETH_ALEN);
|
||||||
|
mgmt->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
|
||||||
|
WLAN_FC_STYPE_ACTION);
|
||||||
|
mgmt->u.action.category = WLAN_ACTION_WNM;
|
||||||
|
mgmt->u.action.u.bss_tm_query.action = WNM_BSS_TRANS_MGMT_QUERY;
|
||||||
|
mgmt->u.action.u.bss_tm_query.dialog_token = 0;
|
||||||
|
mgmt->u.action.u.bss_tm_query.query_reason = query_reason;
|
||||||
|
pos = mgmt->u.action.u.bss_tm_query.variable;
|
||||||
|
|
||||||
|
len = pos - (u8 *) &mgmt->u.action.category;
|
||||||
|
|
||||||
|
ret = wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid,
|
||||||
|
wpa_s->own_addr, wpa_s->bssid,
|
||||||
|
&mgmt->u.action.category, len, 0);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ieee802_11_rx_wnm_action(struct wpa_supplicant *wpa_s,
|
void ieee802_11_rx_wnm_action(struct wpa_supplicant *wpa_s,
|
||||||
struct rx_action *action)
|
struct rx_action *action)
|
||||||
{
|
{
|
||||||
|
@ -83,6 +83,8 @@ void ieee802_11_rx_wnm_action(struct wpa_supplicant *wpa_s,
|
|||||||
void wnm_scan_response(struct wpa_supplicant *wpa_s,
|
void wnm_scan_response(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_scan_results *scan_res);
|
struct wpa_scan_results *scan_res);
|
||||||
|
|
||||||
|
int wnm_send_bss_transition_mgmt_query(struct wpa_supplicant *wpa_s,
|
||||||
|
u8 query_reason);
|
||||||
void wnm_deallocate_memory(struct wpa_supplicant *wpa_s);
|
void wnm_deallocate_memory(struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
#endif /* WNM_STA_H */
|
#endif /* WNM_STA_H */
|
||||||
|
@ -2293,6 +2293,12 @@ 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);
|
return wpa_cli_cmd(ctrl, "WNM_SLEEP", 0, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int wpa_cli_cmd_wnm_bss_query(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
||||||
|
{
|
||||||
|
return wpa_cli_cmd(ctrl, "WNM_BSS_QUERY", 1, argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_WNM */
|
#endif /* CONFIG_WNM */
|
||||||
|
|
||||||
|
|
||||||
@ -2754,6 +2760,8 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
|
|||||||
#ifdef CONFIG_WNM
|
#ifdef CONFIG_WNM
|
||||||
{ "wnm_sleep", wpa_cli_cmd_wnm_sleep, NULL, cli_cmd_flag_none,
|
{ "wnm_sleep", wpa_cli_cmd_wnm_sleep, NULL, cli_cmd_flag_none,
|
||||||
"<enter/exit> [interval=#] = enter/exit WNM-Sleep mode" },
|
"<enter/exit> [interval=#] = enter/exit WNM-Sleep mode" },
|
||||||
|
{ "wnm_bss_query", wpa_cli_cmd_wnm_bss_query, NULL, cli_cmd_flag_none,
|
||||||
|
"<query reason> = Send BSS Transition Management Query" },
|
||||||
#endif /* CONFIG_WNM */
|
#endif /* CONFIG_WNM */
|
||||||
{ "raw", wpa_cli_cmd_raw, NULL, cli_cmd_flag_sensitive,
|
{ "raw", wpa_cli_cmd_raw, NULL, cli_cmd_flag_sensitive,
|
||||||
"<params..> = Sent unprocessed command" },
|
"<params..> = Sent unprocessed command" },
|
||||||
|
Loading…
Reference in New Issue
Block a user