@@ -1727,9 +1727,22 @@ static int wpa_supplicant_install_igtk(struct wpa_sm *sm,
keyidx, MAC2STR(igtk->pn));
wpa_hexdump_key(MSG_DEBUG, "WPA: IGTK", igtk->igtk, len);
if (keyidx > 4095) {
- wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
- "WPA: Invalid IGTK KeyID %d", keyidx);
- return -1;
+ int masked = keyidx & 0xFF;
+ if (masked == 4 || masked == 5) {
+ /* Some APs send an IGTK KeyID larger than 4095 with
+ * a valid key index (4 or 5) in the low byte and
+ * spurious bits in the high byte. Mask off the high
+ * byte and use the low byte as the key index instead
+ * of rejecting the IGTK and disconnecting. */
+ wpa_msg(sm->ctx->msg_ctx, MSG_INFO,
+ "WPA: Workaround for non-compliant AP: corrected IGTK KeyID %d to %d",
+ keyidx, masked);
+ keyidx = masked;
+ } else {
+ wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
+ "WPA: Invalid IGTK KeyID %d", keyidx);
+ return -1;
+ }
}
if (wpa_sm_set_key(sm, -1, wpa_cipher_to_alg(sm->mgmt_group_cipher),
broadcast_ether_addr,
Some APs send an IGTK KeyID larger than 4095 with a valid key index (4 or 5) in the low byte and spurious bits in the high byte, which would make the keyidx > 4095 validation reject the IGTK and force a disconnection. Detect this case by checking whether the low byte of the KeyID is a valid key index and, if so, mask off the high byte and use the low byte as the key index to install the IGTK with the corrected KeyID instead of disconnecting. Log an informational message instead of a warning. Signed-off-by: Chao Meng <chao.meng@unisoc.com> --- src/rsn_supp/wpa.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) -- 2.21.0.windows.1