netdev: work around APs that send igtk in big endian

It seems some APs send the IGTK key in big endian format (it is a
uin16).  The kernel rightly reports an -EINVAL error when iwd issues a
NEW_KEY with such a value, resulting in the connection being aborted.

Work around this by trying to detect big-endian key indexes and 'fixing'
them up.
This commit is contained in:
Denis Kenzior 2020-04-02 00:45:55 -05:00
parent 5576722d29
commit aba3da32ac
1 changed files with 8 additions and 0 deletions

View File

@ -1297,6 +1297,14 @@ static void netdev_set_igtk(struct handshake_state *hs, uint16_t key_index,
return;
}
if (key_index == 0x0400 || key_index == 0x0500) {
l_warn("Received an invalid IGTK key index (%04hx)"
" that is likely in"
" big endian format. Trying to fix and"
" proceed anyway", key_index);
key_index = bswap_16(key_index);
}
msg = nl80211_build_new_key_group(netdev->index, cipher, key_index,
igtk_buf, igtk_len, ipn, ipn_len, NULL);