WNM: Ignore WNM-Sleep Mode Response if WNM-Sleep Mode has not been used

The AP is not expected to send out a WNM-Sleep Mode Response frame
without the STA trying to use WNM-Sleep Mode. Drop such unexpected
responses to reduce unnecessary processing of the frame.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-10-25 23:02:14 +02:00
parent 8823178c96
commit 03ed0a5239
4 changed files with 11 additions and 0 deletions

View File

@ -6905,6 +6905,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
}
eloop_cancel_timeout(wpas_network_reenabled, wpa_s, NULL);
wpa_s->wnmsleep_used = 0;
}

View File

@ -303,6 +303,7 @@ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s)
wpa_s->key_mgmt = 0;
wpas_rrm_reset(wpa_s);
wpa_s->wnmsleep_used = 0;
}

View File

@ -139,6 +139,8 @@ int ieee802_11_send_wnmsleep_req(struct wpa_supplicant *wpa_s,
if (res < 0)
wpa_printf(MSG_DEBUG, "Failed to send WNM-Sleep Request "
"(action=%d, intval=%d)", action, intval);
else
wpa_s->wnmsleep_used = 1;
os_free(wnmsleep_ie);
os_free(wnmtfs_ie);
@ -255,6 +257,12 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s,
const u8 *tfsresp_ie_end = NULL;
size_t left;
if (!wpa_s->wnmsleep_used) {
wpa_printf(MSG_DEBUG,
"WNM: Ignore WNM-Sleep Mode Response frame since WNM-Sleep Mode has not been used in this association");
return;
}
if (len < 3)
return;
key_len_total = WPA_GET_LE16(frm + 1);

View File

@ -669,6 +669,7 @@ struct wpa_supplicant {
unsigned int reattach:1; /* reassociation to the same BSS requested */
unsigned int mac_addr_changed:1;
unsigned int added_vif:1;
unsigned int wnmsleep_used:1;
struct os_reltime last_mac_addr_change;
int last_mac_addr_style;