aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wnm_sta.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-12-16 10:51:02 (GMT)
committerJouni Malinen <j@w1.fi>2012-12-16 10:51:02 (GMT)
commit0a47a6a74700220ecdd4ff41cce0c1d39453c4eb (patch)
treef529f1f33ce9e35fe749ca620b4675369fe4ee96 /wpa_supplicant/wnm_sta.c
parent68db9ab047b74b2795d57a62641b7f5d73ceda9c (diff)
downloadhostap-0a47a6a74700220ecdd4ff41cce0c1d39453c4eb.zip
hostap-0a47a6a74700220ecdd4ff41cce0c1d39453c4eb.tar.gz
hostap-0a47a6a74700220ecdd4ff41cce0c1d39453c4eb.tar.bz2
WNM: Remove unnecessary extra indentation level
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/wnm_sta.c')
-rw-r--r--wpa_supplicant/wnm_sta.c93
1 files changed, 44 insertions, 49 deletions
diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
index f1a1337..a2abf61 100644
--- a/wpa_supplicant/wnm_sta.c
+++ b/wpa_supplicant/wnm_sta.c
@@ -213,63 +213,58 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s,
"TFS Resp IE");
}
} else if (wnmsleep_ie->action_type == 1) {
+ u8 *ptr, *end;
wpa_drv_wnm_oper(wpa_s, WNM_SLEEP_EXIT_CONFIRM,
wpa_s->bssid, NULL, NULL);
/* Install GTK/IGTK */
- do {
- /* point to key data field */
- u8 *ptr = (u8 *) frm + 1 + 1 + 2;
- u8 *end = ptr + key_len_total;
- wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data",
- ptr, key_len_total);
- while (ptr + 1 < end) {
- if (ptr + 2 + ptr[1] > end) {
+ /* point to key data field */
+ ptr = (u8 *) frm + 1 + 1 + 2;
+ end = ptr + key_len_total;
+ wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data",
+ ptr, key_len_total);
+ while (ptr + 1 < end) {
+ if (ptr + 2 + ptr[1] > end) {
+ wpa_printf(MSG_DEBUG,
+ "WNM: Invalid Key "
+ "Data element length");
+ if (end > ptr)
+ wpa_hexdump(MSG_DEBUG, "WNM: Remaining data", ptr, end - ptr);
+ break;
+ }
+ if (*ptr == WNM_SLEEP_SUBELEM_GTK) {
+ if (ptr[1] < 11 + 5) {
wpa_printf(MSG_DEBUG,
- "WNM: Invalid Key "
- "Data element "
- "length");
- if (end > ptr)
- wpa_hexdump(MSG_DEBUG, "WNM: Remaining data", ptr, end - ptr);
+ "WNM: Too short GTK subelem");
break;
}
- if (*ptr == WNM_SLEEP_SUBELEM_GTK) {
- if (ptr[1] < 11 + 5) {
- wpa_printf(MSG_DEBUG,
- "WNM: Too short GTK subelem");
- break;
- }
- gtk_len = *(ptr + 4);
- if (ptr[1] < 11 + gtk_len ||
- gtk_len < 5 || gtk_len > 32)
- {
- wpa_printf(MSG_DEBUG,
- "WNM: Invalid GTK subelem");
- break;
- }
- wpa_wnmsleep_install_key(
- wpa_s->wpa,
- WNM_SLEEP_SUBELEM_GTK,
- ptr);
- ptr += 13 + gtk_len;
+ gtk_len = *(ptr + 4);
+ if (ptr[1] < 11 + gtk_len ||
+ gtk_len < 5 || gtk_len > 32) {
+ wpa_printf(MSG_DEBUG,
+ "WNM: Invalid GTK subelem");
+ break;
+ }
+ wpa_wnmsleep_install_key(
+ wpa_s->wpa,
+ WNM_SLEEP_SUBELEM_GTK,
+ ptr);
+ ptr += 13 + gtk_len;
#ifdef CONFIG_IEEE80211W
- } else if (*ptr ==
- WNM_SLEEP_SUBELEM_IGTK) {
- if (ptr[1] < 2 + 6 +
- WPA_IGTK_LEN) {
- wpa_printf(MSG_DEBUG,
- "WNM: Too short IGTK subelem");
- break;
- }
- wpa_wnmsleep_install_key(
- wpa_s->wpa,
- WNM_SLEEP_SUBELEM_IGTK,
- ptr);
- ptr += 10 + WPA_IGTK_LEN;
+ } else if (*ptr == WNM_SLEEP_SUBELEM_IGTK) {
+ if (ptr[1] < 2 + 6 + WPA_IGTK_LEN) {
+ wpa_printf(MSG_DEBUG,
+ "WNM: Too short IGTK subelem");
+ break;
+ }
+ wpa_wnmsleep_install_key(
+ wpa_s->wpa,
+ WNM_SLEEP_SUBELEM_IGTK,
+ ptr);
+ ptr += 10 + WPA_IGTK_LEN;
#endif /* CONFIG_IEEE80211W */
- } else
- break; /* skip the loop */
- }
- } while(0);
+ } else
+ break; /* skip the loop */
+ }
}
} else {
wpa_printf(MSG_DEBUG, "Reject recv WNM-Sleep Response frame "