WNM: Remove unnecessary extra indentation level

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2012-12-16 12:51:02 +02:00
parent 68db9ab047
commit 0a47a6a747

View file

@ -213,63 +213,58 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s,
"TFS Resp IE"); "TFS Resp IE");
} }
} else if (wnmsleep_ie->action_type == 1) { } else if (wnmsleep_ie->action_type == 1) {
u8 *ptr, *end;
wpa_drv_wnm_oper(wpa_s, WNM_SLEEP_EXIT_CONFIRM, wpa_drv_wnm_oper(wpa_s, WNM_SLEEP_EXIT_CONFIRM,
wpa_s->bssid, NULL, NULL); wpa_s->bssid, NULL, NULL);
/* Install GTK/IGTK */ /* Install GTK/IGTK */
do { /* point to key data field */
/* point to key data field */ ptr = (u8 *) frm + 1 + 1 + 2;
u8 *ptr = (u8 *) frm + 1 + 1 + 2; end = ptr + key_len_total;
u8 *end = ptr + key_len_total; wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data",
wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data", ptr, key_len_total);
ptr, key_len_total); while (ptr + 1 < end) {
while (ptr + 1 < end) { if (ptr + 2 + 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, wpa_printf(MSG_DEBUG,
"WNM: Invalid Key " "WNM: Too short GTK subelem");
"Data element "
"length");
if (end > ptr)
wpa_hexdump(MSG_DEBUG, "WNM: Remaining data", ptr, end - ptr);
break; break;
} }
if (*ptr == WNM_SLEEP_SUBELEM_GTK) { gtk_len = *(ptr + 4);
if (ptr[1] < 11 + 5) { if (ptr[1] < 11 + gtk_len ||
wpa_printf(MSG_DEBUG, gtk_len < 5 || gtk_len > 32) {
"WNM: Too short GTK subelem"); wpa_printf(MSG_DEBUG,
break; "WNM: Invalid GTK subelem");
} break;
gtk_len = *(ptr + 4); }
if (ptr[1] < 11 + gtk_len || wpa_wnmsleep_install_key(
gtk_len < 5 || gtk_len > 32) wpa_s->wpa,
{ WNM_SLEEP_SUBELEM_GTK,
wpa_printf(MSG_DEBUG, ptr);
"WNM: Invalid GTK subelem"); ptr += 13 + gtk_len;
break;
}
wpa_wnmsleep_install_key(
wpa_s->wpa,
WNM_SLEEP_SUBELEM_GTK,
ptr);
ptr += 13 + gtk_len;
#ifdef CONFIG_IEEE80211W #ifdef CONFIG_IEEE80211W
} else if (*ptr == } else if (*ptr == WNM_SLEEP_SUBELEM_IGTK) {
WNM_SLEEP_SUBELEM_IGTK) { if (ptr[1] < 2 + 6 + WPA_IGTK_LEN) {
if (ptr[1] < 2 + 6 + wpa_printf(MSG_DEBUG,
WPA_IGTK_LEN) { "WNM: Too short IGTK subelem");
wpa_printf(MSG_DEBUG, break;
"WNM: Too short IGTK subelem"); }
break; wpa_wnmsleep_install_key(
} wpa_s->wpa,
wpa_wnmsleep_install_key( WNM_SLEEP_SUBELEM_IGTK,
wpa_s->wpa, ptr);
WNM_SLEEP_SUBELEM_IGTK, ptr += 10 + WPA_IGTK_LEN;
ptr);
ptr += 10 + WPA_IGTK_LEN;
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
} else } else
break; /* skip the loop */ break; /* skip the loop */
} }
} while(0);
} }
} else { } else {
wpa_printf(MSG_DEBUG, "Reject recv WNM-Sleep Response frame " wpa_printf(MSG_DEBUG, "Reject recv WNM-Sleep Response frame "