aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2012-03-21 16:19:00 -0700
committerJouni Malinen <j@w1.fi>2012-03-21 16:19:00 -0700
commitc81defea8779108d2231aeb476e95e6759f5f6d3 (patch)
treef532808fa1c6e1868bbebbdca5aa6916ed135fb0 /wlantest
parente1bd4e19340b329da88d1b732316338827331dcf (diff)
downloadexternal_wpa_supplicant_8_ti-c81defea8779108d2231aeb476e95e6759f5f6d3.zip
external_wpa_supplicant_8_ti-c81defea8779108d2231aeb476e95e6759f5f6d3.tar.gz
external_wpa_supplicant_8_ti-c81defea8779108d2231aeb476e95e6759f5f6d3.tar.bz2
wlantest: Update STA info based on WPA/RSN IE in EAPOL-Key 2/4
The WPA/RSN IE in EAPOL-Key 2/4 is more reliable than the one in (Re)Association Request frame. Update the STA info base don the EAPOL-Key frame so that the correct cipher information is used even if the (Re)Association Request frame is missing or corrupted in the capture. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wlantest')
-rw-r--r--wlantest/rx_eapol.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/wlantest/rx_eapol.c b/wlantest/rx_eapol.c
index ad9035f..7f2015d 100644
--- a/wlantest/rx_eapol.c
+++ b/wlantest/rx_eapol.c
@@ -13,6 +13,7 @@
#include "crypto/crypto.h"
#include "common/defs.h"
#include "common/ieee802_11_defs.h"
+#include "common/ieee802_11_common.h"
#include "common/eapol_common.h"
#include "common/wpa_common.h"
#include "rsn_supp/wpa_ie.h"
@@ -219,6 +220,7 @@ static void rx_data_eapol_key_2_of_4(struct wlantest *wt, const u8 *dst,
wpa_hexdump(MSG_MSGDUMP, "EAPOL-Key Key Data - WPA IE",
ie.wpa_ie, ie.wpa_ie_len);
if (os_memcmp(ie.wpa_ie, sta->rsnie, ie.wpa_ie_len) != 0) {
+ struct ieee802_11_elems elems;
wpa_printf(MSG_INFO, "Mismatch in WPA IE between "
"EAPOL-Key 2/4 and (Re)Association "
"Request from " MACSTR, MAC2STR(sta->addr));
@@ -228,6 +230,17 @@ static void rx_data_eapol_key_2_of_4(struct wlantest *wt, const u8 *dst,
"Request",
sta->rsnie,
sta->rsnie[0] ? 2 + sta->rsnie[1] : 0);
+ /*
+ * The sniffer may have missed (Re)Association
+ * Request, so try to survive with the information from
+ * EAPOL-Key.
+ */
+ os_memset(&elems, 0, sizeof(elems));
+ elems.wpa_ie = ie.wpa_ie + 2;
+ elems.wpa_ie_len = ie.wpa_ie_len - 2;
+ wpa_printf(MSG_DEBUG, "Update STA data based on WPA "
+ "IE in EAPOL-Key 2/4");
+ sta_update_assoc(sta, &elems);
}
}
@@ -235,6 +248,7 @@ static void rx_data_eapol_key_2_of_4(struct wlantest *wt, const u8 *dst,
wpa_hexdump(MSG_MSGDUMP, "EAPOL-Key Key Data - RSN IE",
ie.rsn_ie, ie.rsn_ie_len);
if (os_memcmp(ie.rsn_ie, sta->rsnie, ie.rsn_ie_len) != 0) {
+ struct ieee802_11_elems elems;
wpa_printf(MSG_INFO, "Mismatch in RSN IE between "
"EAPOL-Key 2/4 and (Re)Association "
"Request from " MACSTR, MAC2STR(sta->addr));
@@ -244,6 +258,17 @@ static void rx_data_eapol_key_2_of_4(struct wlantest *wt, const u8 *dst,
"Request",
sta->rsnie,
sta->rsnie[0] ? 2 + sta->rsnie[1] : 0);
+ /*
+ * The sniffer may have missed (Re)Association
+ * Request, so try to survive with the information from
+ * EAPOL-Key.
+ */
+ os_memset(&elems, 0, sizeof(elems));
+ elems.rsn_ie = ie.rsn_ie + 2;
+ elems.rsn_ie_len = ie.rsn_ie_len - 2;
+ wpa_printf(MSG_DEBUG, "Update STA data based on RSN "
+ "IE in EAPOL-Key 2/4");
+ sta_update_assoc(sta, &elems);
}
}
}